@prisma/cli 2.20.0 → 3.0.0-alpha.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 (183) hide show
  1. package/LICENSE +158 -0
  2. package/README.md +29 -28
  3. package/dist/adapters/config.js +74 -0
  4. package/dist/adapters/local-state.js +98 -0
  5. package/dist/adapters/mock-api.js +57 -0
  6. package/dist/adapters/token-storage.js +43 -0
  7. package/dist/cli.js +9 -0
  8. package/dist/cli2.js +59 -0
  9. package/dist/commands/app/index.js +223 -0
  10. package/dist/commands/auth/index.js +42 -0
  11. package/dist/commands/branch/index.js +51 -0
  12. package/dist/commands/project/index.js +45 -0
  13. package/dist/controllers/app.js +813 -0
  14. package/dist/controllers/auth.js +107 -0
  15. package/dist/controllers/branch.js +73 -0
  16. package/dist/controllers/project.js +214 -0
  17. package/dist/controllers/select-prompt-port.js +12 -0
  18. package/dist/lib/app/bun-project.js +39 -0
  19. package/dist/lib/app/env-vars.js +24 -0
  20. package/dist/lib/app/local-dev.js +149 -0
  21. package/dist/lib/app/preview-build.js +283 -0
  22. package/dist/lib/app/preview-interaction.js +38 -0
  23. package/dist/lib/app/preview-progress.js +139 -0
  24. package/dist/lib/app/preview-provider.js +232 -0
  25. package/dist/lib/auth/auth-ops.js +57 -0
  26. package/dist/lib/auth/client.js +22 -0
  27. package/dist/lib/auth/guard.js +34 -0
  28. package/dist/lib/auth/login.js +117 -0
  29. package/dist/output/patterns.js +93 -0
  30. package/dist/presenters/app.js +405 -0
  31. package/dist/presenters/auth.js +73 -0
  32. package/dist/presenters/branch.js +111 -0
  33. package/dist/presenters/project.js +84 -0
  34. package/dist/shell/command-meta.js +320 -0
  35. package/dist/shell/command-runner.js +33 -0
  36. package/dist/shell/errors.js +66 -0
  37. package/dist/shell/global-flags.js +25 -0
  38. package/dist/shell/help.js +78 -0
  39. package/dist/shell/output.js +54 -0
  40. package/dist/shell/prompt.js +31 -0
  41. package/dist/shell/runtime.js +51 -0
  42. package/dist/shell/ui.js +59 -0
  43. package/dist/use-cases/auth.js +70 -0
  44. package/dist/use-cases/branch.js +95 -0
  45. package/dist/use-cases/create-cli-gateways.js +93 -0
  46. package/dist/use-cases/project.js +75 -0
  47. package/package.json +49 -137
  48. package/build/child.js +0 -4110
  49. package/build/index.js +0 -104447
  50. package/build/public/demo.html +0 -17
  51. package/build/public/demoChunk.js +0 -2
  52. package/build/public/electron-darwin.html +0 -19
  53. package/build/public/electron-linux.html +0 -18
  54. package/build/public/electron-mac.html +0 -18
  55. package/build/public/electron-win.html +0 -17
  56. package/build/public/electron-win32.html +0 -18
  57. package/build/public/electron.html +0 -17
  58. package/build/public/electronBus.js +0 -2
  59. package/build/public/electronChunk.js +0 -2
  60. package/build/public/favicon/apple-touch-icon.png +0 -0
  61. package/build/public/favicon/favicon-16x16.png +0 -0
  62. package/build/public/favicon/favicon-32x32.png +0 -0
  63. package/build/public/favicon/prisma.png +0 -0
  64. package/build/public/fonts/Inter.ttf +0 -0
  65. package/build/public/fonts/RobotoMono.ttf +0 -0
  66. package/build/public/icons/.DS_Store +0 -0
  67. package/build/public/icons/alert.svg +0 -5
  68. package/build/public/icons/array.svg +0 -4
  69. package/build/public/icons/bin.svg +0 -37
  70. package/build/public/icons/boolean.svg +0 -4
  71. package/build/public/icons/check.svg +0 -3
  72. package/build/public/icons/chevron-down.svg +0 -3
  73. package/build/public/icons/code.svg +0 -4
  74. package/build/public/icons/cross.svg +0 -11
  75. package/build/public/icons/data-tool.svg +0 -5
  76. package/build/public/icons/database.svg +0 -4
  77. package/build/public/icons/datetime.svg +0 -4
  78. package/build/public/icons/double-arrow-right.svg +0 -4
  79. package/build/public/icons/download.svg +0 -4
  80. package/build/public/icons/ellipsis.svg +0 -10
  81. package/build/public/icons/enum.svg +0 -6
  82. package/build/public/icons/expand.svg +0 -4
  83. package/build/public/icons/eye.svg +0 -20
  84. package/build/public/icons/filters.svg +0 -5
  85. package/build/public/icons/folder.svg +0 -6
  86. package/build/public/icons/hamburger.svg +0 -4
  87. package/build/public/icons/icon.svg +0 -199
  88. package/build/public/icons/logo.svg +0 -199
  89. package/build/public/icons/logotype.svg +0 -4
  90. package/build/public/icons/number.svg +0 -7
  91. package/build/public/icons/object.svg +0 -5
  92. package/build/public/icons/play.svg +0 -6
  93. package/build/public/icons/plus.svg +0 -4
  94. package/build/public/icons/refresh.svg +0 -4
  95. package/build/public/icons/search.svg +0 -7
  96. package/build/public/icons/settings.svg +0 -8
  97. package/build/public/icons/string.svg +0 -4
  98. package/build/public/icons/tick-indeterminate.svg +0 -3
  99. package/build/public/icons/tick.svg +0 -4
  100. package/build/public/illustrations/.DS_Store +0 -0
  101. package/build/public/illustrations/empty.svg +0 -1
  102. package/build/public/illustrations/read.svg +0 -1
  103. package/build/public/illustrations/searching.svg +0 -1
  104. package/build/public/images/.DS_Store +0 -0
  105. package/build/public/images/icon-1024.png +0 -0
  106. package/build/public/index.html +0 -49
  107. package/build/public/main.31f688a6254e294d9128.css +0 -118
  108. package/build/public/main.31f688a6254e294d9128.css.map +0 -1
  109. package/build/public/main.364c712f32662ff0e43d.css +0 -116
  110. package/build/public/main.364c712f32662ff0e43d.css.map +0 -1
  111. package/build/public/main.42ef3fe7e97347765c91.css +0 -118
  112. package/build/public/main.42ef3fe7e97347765c91.css.map +0 -1
  113. package/build/public/main.503446defafe7aeca2f3.css +0 -116
  114. package/build/public/main.503446defafe7aeca2f3.css.map +0 -1
  115. package/build/public/main.c50a3b5980fe26f78b65.css +0 -118
  116. package/build/public/main.c50a3b5980fe26f78b65.css.map +0 -1
  117. package/build/public/main.cda25e5813776c2af295.css +0 -116
  118. package/build/public/main.cda25e5813776c2af295.css.map +0 -1
  119. package/build/public/main.dbac3b290f78404ff579.css +0 -116
  120. package/build/public/main.dbac3b290f78404ff579.css.map +0 -1
  121. package/build/public/main.f8ce44e122e5e2b8f778.css +0 -118
  122. package/build/public/main.f8ce44e122e5e2b8f778.css.map +0 -1
  123. package/build/public/main.fc9ea7521a4aecce1a77.css +0 -118
  124. package/build/public/main.fc9ea7521a4aecce1a77.css.map +0 -1
  125. package/build/public/main.js +0 -403
  126. package/build/public/main.js.map +0 -1
  127. package/build/public/mainChunk.0a84f3ba4d2ab481e877.css +0 -116
  128. package/build/public/mainChunk.1b327d58afbddc917bce.css +0 -118
  129. package/build/public/mainChunk.2cdf583b2bd51aa67587.css +0 -118
  130. package/build/public/mainChunk.544af00f7e9ffcbe782c.css +0 -118
  131. package/build/public/mainChunk.56f96a13868b2b4a53be.css +0 -118
  132. package/build/public/mainChunk.5cee429bfbf06e7ecb39.css +0 -118
  133. package/build/public/mainChunk.a862474ed4cdb421ffa2.css +0 -118
  134. package/build/public/mainChunk.ada34153c4911b5ac22b.css +0 -118
  135. package/build/public/mainChunk.c16a8d01b2c49b2f2751.css +0 -118
  136. package/build/public/mainChunk.ca4a878d5478b9320be8.css +0 -116
  137. package/build/public/mainChunk.e3adc8758b4395546cef.css +0 -116
  138. package/build/public/mainChunk.f2c59fcbfc455d8b9de5.css +0 -118
  139. package/build/public/mainChunk.js +0 -396
  140. package/build/public/preview.html +0 -16
  141. package/build/public/previewBus.js +0 -2
  142. package/build/public/previewChunk.js +0 -2
  143. package/build/public/projects.html +0 -86
  144. package/build/public/server.html +0 -16
  145. package/build/public/serverBus.js +0 -2
  146. package/build/public/serverChunk.js +0 -2
  147. package/build/public/splash.html +0 -17
  148. package/build/public/studioBundle.828f34b1781061528841.css +0 -118
  149. package/build/public/studioBundle.bfe9138b2e0293fcb7da.css +0 -118
  150. package/build/public/studioBundle.c5b256eede880e502aac.css +0 -118
  151. package/build/public/studioBundle.e43df511c8e2e368900a.css +0 -118
  152. package/build/public/studioBundle.e69382554c2a2942ae32.css +0 -118
  153. package/build/public/studioBundle.ee21aa56a3999a2b380b.css +0 -118
  154. package/build/public/studioBundle.js +0 -396
  155. package/build/public/vercel.html +0 -16
  156. package/build/public/vercelChunk.js +0 -2
  157. package/build/xdg-open +0 -1066
  158. package/install/index.js +0 -5
  159. package/preinstall/index.js +0 -71
  160. package/prisma-client/README.md +0 -27
  161. package/prisma-client/generator-build/.DS_Store +0 -0
  162. package/prisma-client/generator-build/index.js +0 -79697
  163. package/prisma-client/index-browser.js +0 -3
  164. package/prisma-client/index.d.ts +0 -1
  165. package/prisma-client/index.js +0 -11
  166. package/prisma-client/package.json +0 -138
  167. package/prisma-client/runtime/index-browser.d.ts +0 -267
  168. package/prisma-client/runtime/index-browser.js +0 -2273
  169. package/prisma-client/runtime/index.d.ts +0 -1018
  170. package/prisma-client/runtime/index.js +0 -35028
  171. package/prisma-client/scripts/backup-index-browser.js +0 -3
  172. package/prisma-client/scripts/backup-index.d.ts +0 -1
  173. package/prisma-client/scripts/backup-index.js +0 -11
  174. package/prisma-client/scripts/colors.js +0 -180
  175. package/prisma-client/scripts/default-index-browser.js +0 -12
  176. package/prisma-client/scripts/default-index.d.ts +0 -47
  177. package/prisma-client/scripts/default-index.js +0 -12
  178. package/prisma-client/scripts/get-packed-client.js +0 -12
  179. package/prisma-client/scripts/mock-fs.js +0 -14
  180. package/prisma-client/scripts/postinstall.d.ts +0 -5
  181. package/prisma-client/scripts/postinstall.js +0 -398
  182. package/scripts/install-entry.js +0 -8
  183. package/scripts/preinstall-entry.js +0 -9
@@ -1,3 +0,0 @@
1
- const prisma = require('.prisma/client/index-browser')
2
-
3
- module.exports = prisma
@@ -1 +0,0 @@
1
- export * from '.prisma/client'
@@ -1,11 +0,0 @@
1
- const prisma = require('.prisma/client')
2
- const path = require('path')
3
-
4
- module.exports = prisma
5
-
6
- /**
7
- * Annotation for ncc/zeit
8
- */
9
- path.join(__dirname, '../../.prisma/client/schema.prisma')
10
- path.join(__dirname, '../../../.prisma/client/schema.prisma')
11
- path.join(__dirname, '../../../../.prisma/client/schema.prisma')
@@ -1,180 +0,0 @@
1
- 'use strict'
2
-
3
- const isObject = (val) =>
4
- val !== null && typeof val === 'object' && !Array.isArray(val)
5
-
6
- // this is a modified version of https://github.com/chalk/ansi-regex (MIT License)
7
- /* eslint-disable-next-line no-control-regex */
8
- const ANSI_REGEX = /[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g
9
-
10
- const create = () => {
11
- const colors = { enabled: true, visible: true, styles: {}, keys: {} }
12
-
13
- if ('FORCE_COLOR' in process.env) {
14
- colors.enabled = process.env.FORCE_COLOR !== '0'
15
- }
16
-
17
- const ansi = (style) => {
18
- let open = (style.open = `\u001b[${style.codes[0]}m`)
19
- let close = (style.close = `\u001b[${style.codes[1]}m`)
20
- let regex = (style.regex = new RegExp(`\\u001b\\[${style.codes[1]}m`, 'g'))
21
- style.wrap = (input, newline) => {
22
- if (input.includes(close)) input = input.replace(regex, close + open)
23
- let output = open + input + close
24
- // see https://github.com/chalk/chalk/pull/92, thanks to the
25
- // chalk contributors for this fix. However, we've confirmed that
26
- // this issue is also present in Windows terminals
27
- return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output
28
- }
29
- return style
30
- }
31
-
32
- const wrap = (style, input, newline) => {
33
- return typeof style === 'function'
34
- ? style(input)
35
- : style.wrap(input, newline)
36
- }
37
-
38
- const style = (input, stack) => {
39
- if (input === '' || input == null) return ''
40
- if (colors.enabled === false) return input
41
- if (colors.visible === false) return ''
42
- let str = '' + input
43
- let nl = str.includes('\n')
44
- let n = stack.length
45
- if (n > 0 && stack.includes('unstyle')) {
46
- stack = [...new Set(['unstyle', ...stack])].reverse()
47
- }
48
- while (n-- > 0) str = wrap(colors.styles[stack[n]], str, nl)
49
- return str
50
- }
51
-
52
- const define = (name, codes, type) => {
53
- colors.styles[name] = ansi({ name, codes })
54
- let keys = colors.keys[type] || (colors.keys[type] = [])
55
- keys.push(name)
56
-
57
- Reflect.defineProperty(colors, name, {
58
- configurable: true,
59
- enumerable: true,
60
- set(value) {
61
- colors.alias(name, value)
62
- },
63
- get() {
64
- let color = (input) => style(input, color.stack)
65
- Reflect.setPrototypeOf(color, colors)
66
- color.stack = this.stack ? this.stack.concat(name) : [name]
67
- return color
68
- },
69
- })
70
- }
71
-
72
- define('reset', [0, 0], 'modifier')
73
- define('bold', [1, 22], 'modifier')
74
- define('dim', [2, 22], 'modifier')
75
- define('italic', [3, 23], 'modifier')
76
- define('underline', [4, 24], 'modifier')
77
- define('inverse', [7, 27], 'modifier')
78
- define('hidden', [8, 28], 'modifier')
79
- define('strikethrough', [9, 29], 'modifier')
80
-
81
- define('black', [30, 39], 'color')
82
- define('red', [31, 39], 'color')
83
- define('green', [32, 39], 'color')
84
- define('yellow', [33, 39], 'color')
85
- define('blue', [34, 39], 'color')
86
- define('magenta', [35, 39], 'color')
87
- define('cyan', [36, 39], 'color')
88
- define('white', [37, 39], 'color')
89
- define('gray', [90, 39], 'color')
90
- define('grey', [90, 39], 'color')
91
-
92
- define('bgBlack', [40, 49], 'bg')
93
- define('bgRed', [41, 49], 'bg')
94
- define('bgGreen', [42, 49], 'bg')
95
- define('bgYellow', [43, 49], 'bg')
96
- define('bgBlue', [44, 49], 'bg')
97
- define('bgMagenta', [45, 49], 'bg')
98
- define('bgCyan', [46, 49], 'bg')
99
- define('bgWhite', [47, 49], 'bg')
100
-
101
- define('blackBright', [90, 39], 'bright')
102
- define('redBright', [91, 39], 'bright')
103
- define('greenBright', [92, 39], 'bright')
104
- define('yellowBright', [93, 39], 'bright')
105
- define('blueBright', [94, 39], 'bright')
106
- define('magentaBright', [95, 39], 'bright')
107
- define('cyanBright', [96, 39], 'bright')
108
- define('whiteBright', [97, 39], 'bright')
109
-
110
- define('bgBlackBright', [100, 49], 'bgBright')
111
- define('bgRedBright', [101, 49], 'bgBright')
112
- define('bgGreenBright', [102, 49], 'bgBright')
113
- define('bgYellowBright', [103, 49], 'bgBright')
114
- define('bgBlueBright', [104, 49], 'bgBright')
115
- define('bgMagentaBright', [105, 49], 'bgBright')
116
- define('bgCyanBright', [106, 49], 'bgBright')
117
- define('bgWhiteBright', [107, 49], 'bgBright')
118
-
119
- colors.ansiRegex = ANSI_REGEX
120
- colors.hasColor = colors.hasAnsi = (str) => {
121
- colors.ansiRegex.lastIndex = 0
122
- return typeof str === 'string' && str !== '' && colors.ansiRegex.test(str)
123
- }
124
-
125
- colors.alias = (name, color) => {
126
- let fn = typeof color === 'string' ? colors[color] : color
127
-
128
- if (typeof fn !== 'function') {
129
- throw new TypeError(
130
- 'Expected alias to be the name of an existing color (string) or a function',
131
- )
132
- }
133
-
134
- if (!fn.stack) {
135
- Reflect.defineProperty(fn, 'name', { value: name })
136
- colors.styles[name] = fn
137
- fn.stack = [name]
138
- }
139
-
140
- Reflect.defineProperty(colors, name, {
141
- configurable: true,
142
- enumerable: true,
143
- set(value) {
144
- colors.alias(name, value)
145
- },
146
- get() {
147
- let color = (input) => style(input, color.stack)
148
- Reflect.setPrototypeOf(color, colors)
149
- color.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack
150
- return color
151
- },
152
- })
153
- }
154
-
155
- colors.theme = (custom) => {
156
- if (!isObject(custom)) throw new TypeError('Expected theme to be an object')
157
- for (let name of Object.keys(custom)) {
158
- colors.alias(name, custom[name])
159
- }
160
- return colors
161
- }
162
-
163
- colors.alias('unstyle', (str) => {
164
- if (typeof str === 'string' && str !== '') {
165
- colors.ansiRegex.lastIndex = 0
166
- return str.replace(colors.ansiRegex, '')
167
- }
168
- return ''
169
- })
170
-
171
- colors.alias('noop', (str) => str)
172
- colors.none = colors.clear = colors.noop
173
-
174
- colors.stripColor = colors.unstyle
175
- colors.define = define
176
- return colors
177
- }
178
-
179
- module.exports = create()
180
- module.exports.create = create
@@ -1,12 +0,0 @@
1
- class PrismaClient {
2
- constructor() {
3
- throw new Error(
4
- `@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
5
- In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues/new`,
6
- )
7
- }
8
- }
9
-
10
- module.exports = {
11
- PrismaClient,
12
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * ## Prisma Client ʲˢ
3
- *
4
- * Type-safe database client for TypeScript & Node.js (ORM replacement)
5
- * @example
6
- * ```
7
- * const prisma = new Prisma()
8
- * // Fetch zero or more Users
9
- * const users = await prisma.user.findMany()
10
- * ```
11
- *
12
- *
13
- * Read more in our [docs](https://github.com/prisma/prisma/blob/master/docs/prisma-client-js/api.md).
14
- */
15
- export declare const PrismaClient: any
16
- /**
17
- * ## Prisma Client ʲˢ
18
- *
19
- * Type-safe database client for TypeScript & Node.js (ORM replacement)
20
- * @example
21
- * ```
22
- * const prisma = new Prisma()
23
- * // Fetch zero or more Users
24
- * const users = await prisma.user.findMany()
25
- * ```
26
- *
27
- *
28
- * Read more in our [docs](https://github.com/prisma/prisma/blob/master/docs/prisma-client-js/api.md).
29
- */
30
- export declare type PrismaClient = any
31
-
32
- export declare const dmmf: any
33
- export declare type dmmf = any
34
-
35
- /**
36
- * Get the type of the value, that the Promise holds.
37
- */
38
- export declare type PromiseType<
39
- T extends PromiseLike<any>
40
- > = T extends PromiseLike<infer U> ? U : T
41
-
42
- /**
43
- * Get the return type of a function which returns a Promise.
44
- */
45
- export declare type PromiseReturnType<
46
- T extends (...args: any) => Promise<any>
47
- > = PromiseType<ReturnType<T>>
@@ -1,12 +0,0 @@
1
- class PrismaClient {
2
- constructor() {
3
- throw new Error(
4
- `@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
5
- In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
6
- )
7
- }
8
- }
9
-
10
- module.exports = {
11
- PrismaClient,
12
- }
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const path = require('path')
4
- const { getPackedPackage } = require('@prisma/sdk')
5
-
6
- async function main() {
7
- const target = path.join(process.cwd(), './node_modules/@prisma/client')
8
- await getPackedPackage('@prisma/client', target, path.join(__dirname, '../'))
9
- console.log(`Saving packed client to ${target}`)
10
- }
11
-
12
- main()
@@ -1,14 +0,0 @@
1
- const { patchFs } = require('fs-monkey')
2
- const fs = require('fs')
3
-
4
- module.exports = function mockFs(fileMap) {
5
- const originalFsRead = fs.readFileSync
6
-
7
- const myFs = {
8
- readFileSync: (fileName, ...args) => {
9
- return fileMap[fileName] || originalFsRead.call(fs, fileName, ...args)
10
- },
11
- }
12
-
13
- patchFs(myFs)
14
- }
@@ -1,5 +0,0 @@
1
- export function getPostInstallTrigger(): string
2
- export const UNABLE_TO_FIND_POSTINSTALL_TRIGGER__EMPTY_STRING
3
- export const UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING
4
- export const UNABLE_TO_FIND_POSTINSTALL_TRIGGER_JSON_PARSE_ERROR
5
- export const UNABLE_TO_FIND_POSTINSTALL_TRIGGER_JSON_SCHEMA_ERROR