@cedarjs/cli 0.13.0 → 0.14.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.
Files changed (19) hide show
  1. package/dist/commands/generate/cell/templates/cell.tsx.template +1 -1
  2. package/dist/commands/generate/cell/templates/cellList.tsx.template +1 -1
  3. package/dist/commands/generate/function/templates/function.ts.template +1 -1
  4. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.service.ts.template +2 -2
  5. package/dist/commands/generate/realtime/templates/subscriptions/blank/blank.ts.template +1 -1
  6. package/dist/commands/generate/scaffold/templates/components/EditNameCell.tsx.template +1 -1
  7. package/dist/commands/generate/scaffold/templates/components/Name.tsx.template +1 -1
  8. package/dist/commands/generate/scaffold/templates/components/NameCell.tsx.template +1 -1
  9. package/dist/commands/generate/scaffold/templates/components/NameForm.tsx.template +1 -1
  10. package/dist/commands/generate/scaffold/templates/components/Names.tsx.template +1 -1
  11. package/dist/commands/generate/scaffold/templates/components/NamesCell.tsx.template +1 -1
  12. package/dist/commands/generate/scaffold/templates/components/NewName.tsx.template +1 -1
  13. package/dist/commands/generate/service/templates/service.ts.template +2 -2
  14. package/dist/commands/setup/realtime/templates/realtime.ts.template +4 -5
  15. package/dist/commands/setup/realtime/templates/subscriptions/countdown/countdown.ts.template +1 -1
  16. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/newMessage.ts.template +8 -6
  17. package/dist/commands/setup/realtime/templates/subscriptions/newMessage/rooms.ts.template +4 -3
  18. package/package.json +12 -12
  19. package/dist/commands/generate/realtime/templates/realtime.ts.template +0 -42
@@ -1,7 +1,7 @@
1
1
  import type {
2
2
  ${operationName},
3
3
  ${operationName}Variables,
4
- } from 'types/graphql.js'
4
+ } from 'types/graphql'
5
5
 
6
6
  import type {
7
7
  CellSuccessProps,
@@ -1,4 +1,4 @@
1
- import type { ${operationName}, ${operationName}Variables } from 'types/graphql.js'
1
+ import type { ${operationName}, ${operationName}Variables } from 'types/graphql'
2
2
 
3
3
  import type {
4
4
  CellSuccessProps,
@@ -1,6 +1,6 @@
1
1
  import type { APIGatewayEvent, Context } from 'aws-lambda'
2
2
 
3
- import { logger } from 'src/lib/logger.js'
3
+ import { logger } from 'src/lib/logger'
4
4
 
5
5
  /**
6
6
  * The handler function is your code that processes http request events.
@@ -1,6 +1,6 @@
1
- import type { ${subscriptionInputType} } from 'types/graphql.js'
1
+ import type { ${subscriptionInputType} } from 'types/graphql'
2
2
 
3
- import { logger } from 'src/lib/logger.js'
3
+ import { logger } from 'src/lib/logger'
4
4
  import type { Publish${typeName}ChannelType } from 'src/subscriptions/${name}/${name}.service.js'
5
5
 
6
6
  export const ${subscriptionQueryName} = ({ id }) => [id]
@@ -2,7 +2,7 @@ import gql from 'graphql-tag'
2
2
 
3
3
  import type { PubSub } from '@cedarjs/realtime'
4
4
 
5
- import { logger } from 'src/lib/logger.js'
5
+ import { logger } from 'src/lib/logger'
6
6
 
7
7
  export const schema = gql`
8
8
  type Subscription {
@@ -2,7 +2,7 @@ ${useClientDirective}import type {
2
2
  Edit${singularPascalName}By${pascalIdName},
3
3
  Update${singularPascalName}Input,
4
4
  Update${singularPascalName}MutationVariables
5
- } from 'types/graphql.js'
5
+ } from 'types/graphql'
6
6
 
7
7
  import { navigate, routes } from '@cedarjs/router'
8
8
  import type {
@@ -1,4 +1,4 @@
1
- import type { Delete${singularPascalName}Mutation, Delete${singularPascalName}MutationVariables, Find${singularPascalName}By${pascalIdName} } from 'types/graphql.js'
1
+ import type { Delete${singularPascalName}Mutation, Delete${singularPascalName}MutationVariables, Find${singularPascalName}By${pascalIdName} } from 'types/graphql'
2
2
 
3
3
  import { Link, routes, navigate } from '@cedarjs/router'
4
4
  import { useMutation } from '@cedarjs/web'
@@ -1,4 +1,4 @@
1
- ${useClientDirective}import type { Find${singularPascalName}By${pascalIdName}, Find${singularPascalName}By${pascalIdName}Variables } from 'types/graphql.js'
1
+ ${useClientDirective}import type { Find${singularPascalName}By${pascalIdName}, Find${singularPascalName}By${pascalIdName}Variables } from 'types/graphql'
2
2
 
3
3
  import type {
4
4
  CellSuccessProps,
@@ -1,4 +1,4 @@
1
- import type { Edit${singularPascalName}By${pascalIdName}, Update${singularPascalName}Input } from 'types/graphql.js'
1
+ import type { Edit${singularPascalName}By${pascalIdName}, Update${singularPascalName}Input } from 'types/graphql'
2
2
 
3
3
  import type { RWGqlError } from '@cedarjs/forms'
4
4
  import {
@@ -1,4 +1,4 @@
1
- import type { Delete${singularPascalName}Mutation, Delete${singularPascalName}MutationVariables, Find${pluralPascalName} } from 'types/graphql.js'
1
+ import type { Delete${singularPascalName}Mutation, Delete${singularPascalName}MutationVariables, Find${pluralPascalName} } from 'types/graphql'
2
2
 
3
3
  import { Link, routes } from '@cedarjs/router'
4
4
  import { useMutation } from '@cedarjs/web'
@@ -1,4 +1,4 @@
1
- ${useClientDirective}import type { Find${pluralPascalName}, Find${pluralPascalName}Variables } from 'types/graphql.js'
1
+ ${useClientDirective}import type { Find${pluralPascalName}, Find${pluralPascalName}Variables } from 'types/graphql'
2
2
 
3
3
  import { Link, routes } from '@cedarjs/router'
4
4
  import type {
@@ -2,7 +2,7 @@ ${useClientDirective}import type {
2
2
  Create${singularPascalName}Mutation,
3
3
  Create${singularPascalName}Input,
4
4
  Create${singularPascalName}MutationVariables
5
- } from 'types/graphql.js'
5
+ } from 'types/graphql'
6
6
 
7
7
  import { navigate, routes } from '@cedarjs/router'
8
8
  import { useMutation } from '@cedarjs/web'
@@ -1,6 +1,6 @@
1
- import type { QueryResolvers<% if (crud) { %>, MutationResolvers<% } %><% if (relations.length) { %>, ${singularPascalName}RelationResolvers<% } %> } from 'types/graphql.js'
1
+ import type { QueryResolvers<% if (crud) { %>, MutationResolvers<% } %><% if (relations.length) { %>, ${singularPascalName}RelationResolvers<% } %> } from 'types/graphql'
2
2
 
3
- import { db } from 'src/lib/db.js'
3
+ import { db } from 'src/lib/db'
4
4
 
5
5
  export const ${pluralCamelName}: QueryResolvers['${pluralCamelName}'] = () => {
6
6
  return db.${singularCamelName}.findMany()
@@ -8,9 +8,9 @@ import subscriptions from 'src/subscriptions/**/*.{js,ts}'
8
8
  // const subscribeClient = new Redis()
9
9
 
10
10
  /**
11
- * Configure RedwoodJS Realtime
11
+ * Configure CedarJS Realtime
12
12
  *
13
- * See https://redwoodjs.com/docs/realtime
13
+ * See https://cedarjs.com/docs/realtime
14
14
  *
15
15
  * Realtime supports Live Queries and Subscriptions over GraphQL SSE.
16
16
  *
@@ -18,16 +18,15 @@ import subscriptions from 'src/subscriptions/**/*.{js,ts}'
18
18
  *
19
19
  * Subscriptions are GraphQL queries that are run when a client subscribes to a channel.
20
20
  *
21
- * Redwood Realtime
21
+ * CedarJS Realtime
22
22
  * - uses a publish/subscribe model to broadcast data to clients.
23
23
  * - uses a store to persist Live Query and Subscription data.
24
24
  * - and enable defer and stream directives to improve latency
25
25
  * for clients by sending data the most important data as soon as it's ready.
26
26
  *
27
- * Redwood Realtime supports in-memory and Redis stores:
27
+ * CedarJS Realtime supports in-memory and Redis stores:
28
28
  * - In-memory stores are useful for development and testing.
29
29
  * - Redis stores are useful for production.
30
- *
31
30
  */
32
31
  export const realtime: RedwoodRealtimeOptions = {
33
32
  subscriptions: {
@@ -20,7 +20,7 @@ export const schema = gql`
20
20
  const countdown = {
21
21
  countdown: {
22
22
  subscribe: (
23
- _,
23
+ _: unknown,
24
24
  {
25
25
  from = 100,
26
26
  interval = 10,
@@ -16,30 +16,32 @@ export type NewMessageChannel = {
16
16
  export type NewMessageChannelType = PubSub<NewMessageChannel>
17
17
 
18
18
  /**
19
- * To test this NewMessage subscription, run the following in one GraphQL Playground to subscribe:
19
+ * To test this NewMessage subscription, run the following in one GraphQL
20
+ * Playground to subscribe:
20
21
  *
21
22
  * subscription ListenForNewMessagesInRoom {
22
23
  * newMessage(roomId: "1") {
23
- * body
24
24
  * from
25
+ * body
25
26
  * }
26
27
  * }
27
28
  *
28
29
  *
29
- * And run the following in another GraphQL Playground to publish and send a message to the room:
30
+ * And run the following in another GraphQL Playground to publish and send a
31
+ * message to the room:
30
32
  *
31
33
  * mutation SendMessageToRoom {
32
34
  * sendMessage(input: {roomId: "1", from: "hello", body: "bob"}) {
33
- * body
34
35
  * from
36
+ * body
35
37
  * }
36
38
  * }
37
39
  */
38
40
  const newMessage = {
39
41
  newMessage: {
40
42
  subscribe: (
41
- _,
42
- { roomId },
43
+ _: unknown,
44
+ { roomId }: { roomId: string },
43
45
  { pubSub }: { pubSub: NewMessageChannelType }
44
46
  ) => {
45
47
  logger.debug({ roomId }, 'newMessage subscription')
@@ -1,8 +1,9 @@
1
- import type { SendMessageInput } from 'types/graphql.js'
1
+ import type { SendMessageInput } from 'types/graphql'
2
+
3
+ import { logger } from 'src/lib/logger'
2
4
  import type { NewMessageChannelType } from 'src/subscriptions/newMessage/newMessage.js'
3
- import { logger } from 'src/lib/logger.js'
4
5
 
5
- export const room = ({ id }) => [id]
6
+ export const room = ({ id }: { id: string }) => [id]
6
7
 
7
8
  export const sendMessage = async (
8
9
  { input }: { input: SendMessageInput },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,8 +10,8 @@
10
10
  "license": "MIT",
11
11
  "type": "module",
12
12
  "bin": {
13
+ "cdr": "./dist/index.js",
13
14
  "cedarjs": "./dist/index.js",
14
- "cj": "./dist/index.js",
15
15
  "redwood": "./dist/index.js",
16
16
  "rw": "./dist/index.js",
17
17
  "rwfw": "./dist/rwfw.js"
@@ -32,15 +32,15 @@
32
32
  "dependencies": {
33
33
  "@babel/preset-typescript": "7.27.1",
34
34
  "@babel/runtime-corejs3": "7.27.6",
35
- "@cedarjs/api-server": "0.13.0",
36
- "@cedarjs/cli-helpers": "0.13.0",
37
- "@cedarjs/fastify-web": "0.13.0",
38
- "@cedarjs/internal": "0.13.0",
39
- "@cedarjs/prerender": "0.13.0",
40
- "@cedarjs/project-config": "0.13.0",
41
- "@cedarjs/structure": "0.13.0",
42
- "@cedarjs/telemetry": "0.13.0",
43
- "@cedarjs/web-server": "0.13.0",
35
+ "@cedarjs/api-server": "0.14.0",
36
+ "@cedarjs/cli-helpers": "0.14.0",
37
+ "@cedarjs/fastify-web": "0.14.0",
38
+ "@cedarjs/internal": "0.14.0",
39
+ "@cedarjs/prerender": "0.14.0",
40
+ "@cedarjs/project-config": "0.14.0",
41
+ "@cedarjs/structure": "0.14.0",
42
+ "@cedarjs/telemetry": "0.14.0",
43
+ "@cedarjs/web-server": "0.14.0",
44
44
  "@listr2/prompt-adapter-enquirer": "2.0.16",
45
45
  "@opentelemetry/api": "1.8.0",
46
46
  "@opentelemetry/core": "1.22.0",
@@ -102,5 +102,5 @@
102
102
  "publishConfig": {
103
103
  "access": "public"
104
104
  },
105
- "gitHead": "d4c79be88cc81bb222625c0841085b878ad47728"
105
+ "gitHead": "e948779c6fc67b7c8b339ffd8bd51d87cea6dbd3"
106
106
  }
@@ -1,42 +0,0 @@
1
- import { RedwoodRealtimeOptions } from '@cedarjs/realtime'
2
-
3
- import subscriptions from 'src/subscriptions/**/*.{js,ts}'
4
-
5
- // if using a Redis store
6
- // import { Redis } from 'ioredis'
7
- // const publishClient = new Redis()
8
- // const subscribeClient = new Redis()
9
-
10
- /**
11
- * Configure RedwoodJS Realtime
12
- *
13
- * See https://redwoodjs.com/docs/realtime
14
- *
15
- * Realtime supports Live Queries and Subscriptions over GraphQL SSE.
16
- *
17
- * Live Queries are GraphQL queries that are automatically re-run when the data they depend on changes.
18
- *
19
- * Subscriptions are GraphQL queries that are run when a client subscribes to a channel.
20
- *
21
- * Redwood Realtime
22
- * - uses a publish/subscribe model to broadcast data to clients.
23
- * - uses a store to persist Live Query and Subscription data.
24
- *
25
- * Redwood Realtime supports in-memory and Redis stores:
26
- * - In-memory stores are useful for development and testing.
27
- * - Redis stores are useful for production.
28
- *
29
- */
30
- export const realtime: RedwoodRealtimeOptions = {
31
- subscriptions: {
32
- subscriptions,
33
- store: 'in-memory',
34
- // if using a Redis store
35
- // store: { redis: { publishClient, subscribeClient } },
36
- },
37
- liveQueries: {
38
- store: 'in-memory',
39
- // if using a Redis store
40
- // store: { redis: { publishClient, subscribeClient } },
41
- },
42
- }