@cedarjs/cli 7.0.0-canary.3108 → 7.0.0-canary.3110

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.
@@ -1,14 +1,13 @@
1
1
  import type { PrismaClient } from 'src/lib/db'
2
-
3
2
  import { ensureDefaultOrganization } from 'src/services/organizations/organizations'
4
3
 
5
4
  const BATCH_SIZE = 100
6
5
 
7
6
  /**
8
7
  * Existing users have no organization until this runs once: `setup tenancy`
9
- * only wires new signups (via the GraphQL `context` function and, for
10
- * dbAuth, the signup handler). Every user without a membership gets one, in
11
- * batches, using the same `ensureDefaultOrganization` new signups use.
8
+ * only wires new signups (via the GraphQL `context` function and, for dbAuth,
9
+ * the signup handler). Every user without a membership gets one, in batches,
10
+ * using the same `ensureDefaultOrganization` new signups use.
12
11
  *
13
12
  * Run with `__DATA_MIGRATE_UP_COMMAND__`, after
14
13
  * `__PRISMA_MIGRATE_DEV_COMMAND__` has applied the
@@ -16,8 +15,9 @@ const BATCH_SIZE = 100
16
15
  */
17
16
  export default async ({ db }: { db: PrismaClient }) => {
18
17
  let cursor: string | undefined
18
+ let hasMore = true
19
19
 
20
- for (;;) {
20
+ while (hasMore) {
21
21
  const users = await db.user.findMany({
22
22
  take: BATCH_SIZE,
23
23
  orderBy: { id: 'asc' },
@@ -25,10 +25,6 @@ export default async ({ db }: { db: PrismaClient }) => {
25
25
  include: { memberships: { select: { id: true } } },
26
26
  })
27
27
 
28
- if (users.length === 0) {
29
- break
30
- }
31
-
32
28
  for (const user of users) {
33
29
  if (user.memberships.length === 0) {
34
30
  await ensureDefaultOrganization({
@@ -37,10 +33,7 @@ export default async ({ db }: { db: PrismaClient }) => {
37
33
  }
38
34
  }
39
35
 
40
- cursor = users[users.length - 1].id
41
-
42
- if (users.length < BATCH_SIZE) {
43
- break
44
- }
36
+ cursor = users[users.length - 1]?.id
37
+ hasMore = users.length === BATCH_SIZE
45
38
  }
46
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "7.0.0-canary.3108",
3
+ "version": "7.0.0-canary.3110",
4
4
  "description": "The CedarJS Command Line",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,17 +36,17 @@
36
36
  "@babel/preset-typescript": "7.29.7",
37
37
  "@babel/traverse": "7.29.8",
38
38
  "@babel/types": "7.29.8",
39
- "@cedarjs/api-server": "7.0.0-canary.3108",
40
- "@cedarjs/babel-config": "7.0.0-canary.3108",
41
- "@cedarjs/cli-helpers": "7.0.0-canary.3108",
42
- "@cedarjs/internal": "7.0.0-canary.3108",
43
- "@cedarjs/prerender": "7.0.0-canary.3108",
44
- "@cedarjs/project-config": "7.0.0-canary.3108",
45
- "@cedarjs/structure": "7.0.0-canary.3108",
46
- "@cedarjs/telemetry": "7.0.0-canary.3108",
47
- "@cedarjs/utils": "7.0.0-canary.3108",
48
- "@cedarjs/vite": "7.0.0-canary.3108",
49
- "@cedarjs/web-server": "7.0.0-canary.3108",
39
+ "@cedarjs/api-server": "7.0.0-canary.3110",
40
+ "@cedarjs/babel-config": "7.0.0-canary.3110",
41
+ "@cedarjs/cli-helpers": "7.0.0-canary.3110",
42
+ "@cedarjs/internal": "7.0.0-canary.3110",
43
+ "@cedarjs/prerender": "7.0.0-canary.3110",
44
+ "@cedarjs/project-config": "7.0.0-canary.3110",
45
+ "@cedarjs/structure": "7.0.0-canary.3110",
46
+ "@cedarjs/telemetry": "7.0.0-canary.3110",
47
+ "@cedarjs/utils": "7.0.0-canary.3110",
48
+ "@cedarjs/vite": "7.0.0-canary.3110",
49
+ "@cedarjs/web-server": "7.0.0-canary.3110",
50
50
  "@listr2/prompt-adapter-enquirer": "4.3.1",
51
51
  "@opentelemetry/api": "1.9.1",
52
52
  "@opentelemetry/core": "1.30.1",
@@ -94,7 +94,7 @@
94
94
  "yargs": "17.7.3"
95
95
  },
96
96
  "devDependencies": {
97
- "@cedarjs/framework-tools": "7.0.0-canary.3108",
97
+ "@cedarjs/framework-tools": "7.0.0-canary.3110",
98
98
  "@prisma/dmmf": "7.10.0",
99
99
  "@types/archiver": "^7.0.0",
100
100
  "memfs": "4.68.2",