@platformatic/db 3.0.0-alpha.1 → 3.0.0-alpha.2

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/config.d.ts CHANGED
@@ -400,6 +400,7 @@ export interface PlatformaticDatabaseConfig {
400
400
  plugins?: {
401
401
  [k: string]: unknown;
402
402
  };
403
+ application?: {};
403
404
  telemetry?: {
404
405
  enabled?: boolean | string;
405
406
  /**
@@ -476,17 +477,6 @@ export interface PlatformaticDatabaseConfig {
476
477
  [k: string]: unknown;
477
478
  };
478
479
  };
479
- clients?: {
480
- serviceId?: string;
481
- name?: string;
482
- type?: "openapi" | "graphql";
483
- path?: string;
484
- schema?: string;
485
- url?: string;
486
- fullResponse?: boolean;
487
- fullRequest?: boolean;
488
- validateResponse?: boolean;
489
- }[];
490
480
  runtime?: {
491
481
  preload?: string | string[];
492
482
  basePath?: string;
package/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { DBAuthorizationPluginInterface } from '@platformatic/db-authorization'
2
+ import { Configuration, ConfigurationOptions } from '@platformatic/foundation'
2
3
  import { BaseGenerator } from '@platformatic/generators'
3
4
  import { PlatformaticApplication, ServiceStackable } from '@platformatic/service'
4
5
  import { SQLEventsPluginInterface } from '@platformatic/sql-events'
5
6
  import { Entities, SQLMapperPluginInterface } from '@platformatic/sql-mapper'
6
- import { Configuration, ConfigurationOptions } from '@platformatic/utils'
7
7
  import { JSONSchemaType } from 'ajv'
8
8
  import { FastifyError, FastifyInstance } from 'fastify'
9
9
  import { PlatformaticDatabaseConfig } from './config'
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve, validationOptions } from '@platformatic/basic'
2
+ import { kMetadata, loadConfiguration as utilsLoadConfiguration } from '@platformatic/foundation'
2
3
  import { transform as serviceTransform } from '@platformatic/service'
3
- import { kMetadata, loadConfiguration as utilsLoadConfiguration } from '@platformatic/utils'
4
4
  import { readFile } from 'node:fs/promises'
5
5
  import { resolve as resolvePath } from 'node:path'
6
6
  import { schema } from './lib/schema.js'
@@ -1,7 +1,7 @@
1
1
  import auth from '@platformatic/db-authorization'
2
2
  import core from '@platformatic/db-core'
3
+ import { isKeyEnabled } from '@platformatic/foundation'
3
4
  import { platformaticService } from '@platformatic/service'
4
- import { isKeyEnabled } from '@platformatic/utils'
5
5
  import { readFile, writeFile } from 'node:fs/promises'
6
6
  import { execute as applyMigrations } from './migrator.js'
7
7
  import { root } from './root.js'
@@ -1,4 +1,4 @@
1
- import { loadConfiguration } from '@platformatic/utils'
1
+ import { loadConfiguration } from '@platformatic/foundation'
2
2
  import { utimesSync } from 'node:fs'
3
3
  import { execute } from '../migrator.js'
4
4
  import { schema } from '../schema.js'
@@ -1,4 +1,4 @@
1
- import { loadConfiguration } from '@platformatic/utils'
1
+ import { loadConfiguration } from '@platformatic/foundation'
2
2
  import { writeFile } from 'node:fs/promises'
3
3
  import { join, relative } from 'node:path'
4
4
  import * as errors from '../errors.js'
@@ -1,4 +1,4 @@
1
- import { abstractLogger, kMetadata, loadConfiguration } from '@platformatic/utils'
1
+ import { abstractLogger, kMetadata, loadConfiguration } from '@platformatic/foundation'
2
2
  import { printSchema as printGraphqlSchema } from 'graphql'
3
3
  import { create } from '../../index.js'
4
4
  import { schema } from '../schema.js'
@@ -1,8 +1,7 @@
1
- import tsCompiler from '@platformatic/ts-compiler'
2
- import { loadConfiguration, loadModule } from '@platformatic/utils'
3
- import { access, readFile } from 'fs/promises'
1
+ import { loadConfiguration, loadModule } from '@platformatic/foundation'
2
+ import { access } from 'fs/promises'
4
3
  import { createRequire } from 'node:module'
5
- import { join, resolve } from 'node:path'
4
+ import { resolve } from 'node:path'
6
5
  import { MissingSeedFileError } from '../errors.js'
7
6
  import { Migrator } from '../migrator.js'
8
7
  import { schema } from '../schema.js'
@@ -29,22 +28,7 @@ export async function seed (logger, configFile, args, { colorette: { bold }, log
29
28
  throw new MissingSeedFileError()
30
29
  }
31
30
 
32
- let seedFile = resolve(process.cwd(), args[0])
33
-
34
- // check if we are in Typescript and, in case, compile it
35
- if (seedFile.endsWith('.ts')) {
36
- await tsCompiler.compile({
37
- cwd: process.cwd(),
38
- logger,
39
- tsConfig: config.plugins?.typescript?.tsConfig,
40
- flags: config.plugins?.typescript?.flags
41
- })
42
- const tsConfigPath = config?.plugins?.typescript?.tsConfig || resolve(process.cwd(), 'tsconfig.json')
43
- const tsConfig = JSON.parse(await readFile(tsConfigPath, 'utf8'))
44
- const outDir = tsConfig.compilerOptions.outDir
45
- seedFile = join(outDir, seedFile.replace('.ts', '.js'))
46
- }
47
-
31
+ const seedFile = resolve(process.cwd(), args[0])
48
32
  await access(seedFile)
49
33
 
50
34
  logger.info(`Seeding from ${bold(seedFile)}`)
@@ -1,4 +1,4 @@
1
- import { loadConfiguration } from '@platformatic/utils'
1
+ import { loadConfiguration } from '@platformatic/foundation'
2
2
  import { schema } from '../schema.js'
3
3
  import { execute } from '../types.js'
4
4
 
package/lib/generator.js CHANGED
@@ -1,8 +1,16 @@
1
- import { BaseGenerator, generateTests } from '@platformatic/generators'
1
+ import { Generator as ServiceGenerator } from '@platformatic/service'
2
2
  import { join } from 'node:path'
3
- import { jsHelperMySQL, jsHelperPostgres, jsHelperSqlite, moviesTestJS, moviesTestTS, README } from './templates.js'
4
-
5
- export class Generator extends BaseGenerator {
3
+ import {
4
+ ENVIRONMENT_TEMPLATE,
5
+ jsHelperMySQL,
6
+ jsHelperPostgres,
7
+ jsHelperSqlite,
8
+ moviesTestJS,
9
+ moviesTestTS,
10
+ README
11
+ } from './templates.js'
12
+
13
+ export class Generator extends ServiceGenerator {
6
14
  constructor (opts = {}) {
7
15
  super({
8
16
  ...opts,
@@ -16,8 +24,27 @@ export class Generator extends BaseGenerator {
16
24
  }
17
25
  }
18
26
 
27
+ getConfigFieldsDefinitions () {
28
+ return [
29
+ {
30
+ var: 'DATABASE_URL',
31
+ label: 'What is the connection string?',
32
+ default: this.connectionStrings.sqlite,
33
+ type: 'string',
34
+ configValue: 'connectionString'
35
+ },
36
+ {
37
+ var: 'PLT_APPLY_MIGRATIONS',
38
+ label: 'Should migrations be applied automatically on startup?',
39
+ default: true,
40
+ type: 'boolean'
41
+ }
42
+ ]
43
+ }
44
+
19
45
  getDefaultConfig () {
20
46
  const defaultBaseConfig = super.getDefaultConfig()
47
+
21
48
  return {
22
49
  ...defaultBaseConfig,
23
50
  database: 'sqlite',
@@ -30,160 +57,29 @@ export class Generator extends BaseGenerator {
30
57
  }
31
58
  }
32
59
 
33
- async _getConfigFileContents () {
34
- const { isRuntimeContext, migrations, plugin, types } = this.config
35
- const version = this.platformaticVersion
36
-
37
- const config = {
38
- $schema: `https://schemas.platformatic.dev/@platformatic/db/${version}.json`,
39
- db: {
40
- connectionString: `{${this.getEnvVarName('DATABASE_URL')}}`,
41
- graphql: true,
42
- openapi: true,
43
- schemalock: true
44
- },
45
- watch: {
46
- ignore: ['*.sqlite', '*.sqlite-journal']
47
- }
48
- }
49
-
50
- if (!isRuntimeContext) {
51
- config.server = {
52
- hostname: '{PLT_SERVER_HOSTNAME}',
53
- port: '{PORT}',
54
- logger: {
55
- level: '{PLT_SERVER_LOGGER_LEVEL}'
56
- }
57
- }
58
- }
59
-
60
- if (migrations) {
61
- config.migrations = {
62
- dir: migrations,
63
- autoApply: `{${this.getEnvVarName('PLT_APPLY_MIGRATIONS')}}`
64
- }
65
-
66
- this.addFile({ path: 'migrations', file: '.gitkeep', contents: '' })
67
- }
68
-
69
- if (plugin === true) {
70
- config.plugins = {
71
- paths: [
72
- {
73
- path: './plugins',
74
- encapsulate: false
75
- },
76
- {
77
- path: './routes'
78
- }
79
- ],
80
- typescript: `{${this.getEnvVarName('PLT_TYPESCRIPT')}}`
81
- }
82
- }
83
-
84
- if (types === true) {
85
- config.types = {
86
- autogenerate: true
87
- }
88
- }
89
-
90
- return config
91
- }
92
-
93
- async _beforePrepare () {
94
- if (!this.config.isUpdating) {
95
- this.config.connectionString = this.config.connectionString || this.connectionStrings[this.config.database]
96
- this.config.dependencies = {
97
- '@platformatic/db': `^${this.platformaticVersion}`
98
- }
99
-
100
- if (!this.config.isRuntimeContext) {
101
- this.addEnvVars(
102
- {
103
- PLT_SERVER_HOSTNAME: this.config.hostname,
104
- PLT_SERVER_LOGGER_LEVEL: 'info',
105
- PORT: 3042
106
- },
107
- { overwrite: false, default: true }
108
- )
109
- }
110
-
111
- this.addEnvVars(
112
- {
113
- PLT_TYPESCRIPT: this.config.typescript,
114
- DATABASE_URL: this.connectionStrings[this.config.database],
115
- PLT_APPLY_MIGRATIONS: 'true'
116
- },
117
- { overwrite: false, default: true }
118
- )
60
+ async prepareQuestions () {
61
+ if (!this.config.connectionString) {
62
+ const def = this.getConfigFieldsDefinitions().find(q => q.var === 'DATABASE_URL')
63
+ this.questions.push({
64
+ type: 'input',
65
+ name: def.configValue,
66
+ message: def.label,
67
+ default: def.default
68
+ })
119
69
  }
120
- }
121
-
122
- async _afterPrepare () {
123
- if (!this.config.isUpdating) {
124
- if (this.config.createMigrations) {
125
- this.createMigrationFiles()
126
- }
127
-
128
- this.addFile({ path: '', file: 'README.md', contents: README })
129
-
130
- if (this.config.plugin) {
131
- let jsHelper = { pre: '', config: '', post: '' }
132
- switch (this.config.database) {
133
- case 'sqlite':
134
- jsHelper = jsHelperSqlite
135
- break
136
- case 'mysql':
137
- jsHelper = jsHelperMySQL(this.config.connectionString)
138
- break
139
- case 'postgres':
140
- jsHelper = jsHelperPostgres(this.config.connectionString)
141
- break
142
- case 'mariadb':
143
- jsHelper = jsHelperMySQL(this.config.connectionString)
144
- break
145
- }
146
-
147
- if (this.config.createMigrations) {
148
- if (this.config.typescript) {
149
- this.addFile({ path: join('test', 'routes'), file: 'movies.test.ts', contents: moviesTestTS })
150
- } else {
151
- this.addFile({ path: join('test', 'routes'), file: 'movies.test.js', contents: moviesTestJS })
152
- }
153
- }
154
70
 
155
- // TODO(leorossi): this is unfortunate. We have already generated tests in BaseGenerator
156
- // next line will override the test files
157
- generateTests(this.config.typescript, '@platformatic/db', jsHelper).forEach(fileObject => {
158
- this.addFile(fileObject)
159
- })
160
-
161
- if (this.config.isRuntimeContext) {
162
- // remove .env file and env variables since they are all for the config.server property
163
- const envFile = this.getFileObject('.env')
164
- if (envFile) {
165
- envFile.contents = ''
166
- }
167
- }
168
- }
169
-
170
- const ENVIRONMENT_TEMPLATE = `
171
- import { FastifyInstance } from 'fastify'
172
- import { PlatformaticApplication, PlatformaticDatabaseConfig, PlatformaticDatabaseMixin, Entities } from '@platformatic/db'
173
-
174
- declare module 'fastify' {
175
- interface FastifyInstance {
176
- platformatic: PlatformaticApplication<PlatformaticDatabaseConfig> & PlatformaticDatabaseMixin<Entities>
177
- }
178
- }
179
- `
180
- this.addFile({ path: '', file: 'plt-env.d.ts', contents: ENVIRONMENT_TEMPLATE })
181
- }
182
- }
71
+ this.questions.push({
72
+ type: 'list',
73
+ name: 'createMigrations',
74
+ message: 'Do you want to create default migrations?',
75
+ default: true,
76
+ choices: [
77
+ { name: 'yes', value: true },
78
+ { name: 'no', value: false }
79
+ ]
80
+ })
183
81
 
184
- createMigrationFiles () {
185
- this.addFile({ path: 'migrations', file: '001.do.sql', contents: this.getMoviesMigrationDo() })
186
- this.addFile({ path: 'migrations', file: '001.undo.sql', contents: this.getMoviesMigrationUndo() })
82
+ await super.prepareQuestions()
187
83
  }
188
84
 
189
85
  getMoviesMigrationDo () {
@@ -223,45 +119,111 @@ declare module 'fastify' {
223
119
  return null
224
120
  }
225
121
 
226
- getConfigFieldsDefinitions () {
227
- return [
122
+ async _beforePrepare () {
123
+ if (this.config.isUpdating) {
124
+ return
125
+ }
126
+
127
+ await super._beforePrepare()
128
+
129
+ this.config.connectionString = this.config.connectionString || this.connectionStrings[this.config.database]
130
+ this.config.dependencies = {
131
+ '@platformatic/db': `^${this.platformaticVersion}`
132
+ }
133
+
134
+ if (!this.config.isRuntimeContext) {
135
+ this.addEnvVars(
136
+ {
137
+ PLT_SERVER_HOSTNAME: this.config.hostname,
138
+ PLT_SERVER_LOGGER_LEVEL: 'info',
139
+ PORT: 3042
140
+ },
141
+ { overwrite: false, default: true }
142
+ )
143
+ }
144
+
145
+ this.addEnvVars(
228
146
  {
229
- var: 'DATABASE_URL',
230
- label: 'What is the connection string?',
231
- default: this.connectionStrings.sqlite,
232
- type: 'string',
233
- configValue: 'connectionString'
147
+ DATABASE_URL: this.connectionStrings[this.config.database],
148
+ PLT_APPLY_MIGRATIONS: 'true'
234
149
  },
235
- {
236
- var: 'PLT_APPLY_MIGRATIONS',
237
- label: 'Should migrations be applied automatically on startup?',
238
- default: true,
239
- type: 'boolean'
150
+ { overwrite: false, default: true }
151
+ )
152
+ }
153
+
154
+ async _afterPrepare () {
155
+ if (this.config.isUpdating) {
156
+ return
157
+ }
158
+
159
+ if (this.config.createMigrations) {
160
+ this.addFile({ path: 'migrations', file: '001.do.sql', contents: this.getMoviesMigrationDo() })
161
+ this.addFile({ path: 'migrations', file: '001.undo.sql', contents: this.getMoviesMigrationUndo() })
162
+ }
163
+
164
+ this.addFile({ path: '', file: 'README.md', contents: README })
165
+
166
+ if (this.config.plugin) {
167
+ switch (this.config.database) {
168
+ case 'sqlite':
169
+ this.testHelperCustomizations = jsHelperSqlite
170
+ break
171
+ case 'mysql':
172
+ this.testHelperCustomizations = jsHelperMySQL(this.config.connectionString)
173
+ break
174
+ case 'postgres':
175
+ this.testHelperCustomizations = jsHelperPostgres(this.config.connectionString)
176
+ break
177
+ case 'mariadb':
178
+ this.testHelperCustomizations = jsHelperMySQL(this.config.connectionString)
179
+ break
240
180
  }
241
- ]
181
+
182
+ if (this.config.createMigrations) {
183
+ if (this.config.typescript) {
184
+ this.addFile({ path: join('test', 'routes'), file: 'movies.test.ts', contents: moviesTestTS })
185
+ } else {
186
+ this.addFile({ path: join('test', 'routes'), file: 'movies.test.js', contents: moviesTestJS })
187
+ }
188
+ }
189
+ }
190
+
191
+ super._afterPrepare()
192
+
193
+ this.addFile({ path: '', file: 'plt-env.d.ts', contents: ENVIRONMENT_TEMPLATE })
242
194
  }
243
195
 
244
- async prepareQuestions () {
245
- await super.prepareQuestions()
246
- if (!this.config.connectionString) {
247
- const def = this.getConfigFieldsDefinitions().find(q => q.var === 'DATABASE_URL')
248
- this.questions.push({
249
- type: 'input',
250
- name: def.configValue,
251
- message: def.label,
252
- default: def.default
253
- })
196
+ async _getConfigFileContents () {
197
+ const config = await super._getConfigFileContents()
198
+ delete config.service
199
+ config.$schema = `https://schemas.platformatic.dev/@platformatic/db/${this.platformaticVersion}.json`
200
+
201
+ config.db = {
202
+ connectionString: `{${this.getEnvVarName('DATABASE_URL')}}`,
203
+ graphql: true,
204
+ openapi: true,
205
+ schemalock: true
254
206
  }
255
207
 
256
- this.questions.push({
257
- type: 'list',
258
- name: 'createMigrations',
259
- message: 'Do you want to create default migrations?',
260
- default: true,
261
- choices: [
262
- { name: 'yes', value: true },
263
- { name: 'no', value: false }
264
- ]
265
- })
208
+ config.watch = {
209
+ ignore: ['*.sqlite', '*.sqlite-journal']
210
+ }
211
+
212
+ if (this.config.migrations) {
213
+ config.migrations = {
214
+ dir: this.config.migrations,
215
+ autoApply: `{${this.getEnvVarName('PLT_APPLY_MIGRATIONS')}}`
216
+ }
217
+
218
+ this.addFile({ path: 'migrations', file: '.gitkeep', contents: '' })
219
+ }
220
+
221
+ if (this.config.types === true) {
222
+ config.types = {
223
+ autogenerate: true
224
+ }
225
+ }
226
+
227
+ return config
266
228
  }
267
229
  }
package/lib/migrator.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createConnectionPool } from '@platformatic/sql-mapper'
2
2
  import { readdir, stat } from 'node:fs/promises'
3
3
  import { basename } from 'node:path'
4
+ import Postgrator from 'postgrator'
4
5
  import { MigrateMissingMigrationsDirError, MigrateMissingMigrationsError } from './errors.js'
5
6
 
6
7
  export class Migrator {
@@ -20,8 +21,6 @@ export class Migrator {
20
21
  }
21
22
 
22
23
  async setupPostgrator () {
23
- const { default: Postgrator } = await import('postgrator')
24
-
25
24
  this.appliedMigrationsCount = 0
26
25
  if (this.postgrator instanceof Postgrator) return
27
26
 
package/lib/schema.js CHANGED
@@ -1,14 +1,20 @@
1
1
  #! /usr/bin/env node
2
2
 
3
+ import { schemaComponents as basicSchemaComponents } from '@platformatic/basic'
4
+ import {
5
+ fastifyServer as server,
6
+ schemaComponents as utilsSchemaComponents,
7
+ watch,
8
+ wrappedRuntime
9
+ } from '@platformatic/foundation'
3
10
  import { schemaComponents as serviceSchemaComponents } from '@platformatic/service'
4
- import { fastifyServer as server, schemaComponents as utilsSchemaComponents, watch, wrappedRuntime } from '@platformatic/utils'
5
11
  import { readFileSync } from 'node:fs'
6
12
  import { resolve } from 'node:path'
7
13
 
8
14
  export const packageJson = JSON.parse(readFileSync(resolve(import.meta.dirname, '../package.json'), 'utf8'))
9
15
  export const version = packageJson.version
10
16
 
11
- const { plugins, openApiBase, clients, $defs } = serviceSchemaComponents
17
+ const { plugins, openApiBase, $defs } = serviceSchemaComponents
12
18
 
13
19
  export const db = {
14
20
  type: 'object',
@@ -469,8 +475,8 @@ export const schema = {
469
475
  migrations,
470
476
  types,
471
477
  plugins,
478
+ application: basicSchemaComponents.application,
472
479
  telemetry: utilsSchemaComponents.telemetry,
473
- clients,
474
480
  runtime: wrappedRuntime,
475
481
  watch: {
476
482
  anyOf: [
package/lib/templates.js CHANGED
@@ -247,3 +247,14 @@ npm start
247
247
  - 🔍 Try out the GraphiQL web UI at http://localhost:3042/graphiql
248
248
 
249
249
  `
250
+
251
+ export const ENVIRONMENT_TEMPLATE = `
252
+ import { type FastifyInstance } from 'fastify'
253
+ import { PlatformaticApplication, PlatformaticDatabaseConfig, PlatformaticDatabaseMixin, Entities } from '@platformatic/db'
254
+
255
+ declare module 'fastify' {
256
+ interface FastifyInstance {
257
+ platformatic: PlatformaticApplication<PlatformaticDatabaseConfig> & PlatformaticDatabaseMixin<Entities>
258
+ }
259
+ }
260
+ `
package/lib/types.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { createDirectory, isFileAccessible } from '@platformatic/foundation'
1
2
  import { mapOpenAPItoTypes, mapSQLEntityToJSONSchema } from '@platformatic/sql-json-schema-mapper'
2
- import { createDirectory, isFileAccessible } from '@platformatic/utils'
3
3
  import camelcase from 'camelcase'
4
4
  import { readFile, readdir, unlink, writeFile } from 'node:fs/promises'
5
5
  import { basename, join, relative, resolve, sep } from 'node:path'
@@ -56,7 +56,7 @@ async function generateIndexTypes (entities) {
56
56
 
57
57
  const content = `import { Entity, EntityHooks, Entities as DatabaseEntities, PlatformaticDatabaseConfig, PlatformaticDatabaseMixin } from '@platformatic/db'
58
58
  import { PlatformaticApplication, PlatformaticServiceConfig } from '@platformatic/service'
59
- import { FastifyInstance } from 'fastify'
59
+ import { type FastifyInstance } from 'fastify'
60
60
 
61
61
  ${allImports.join('\n')}
62
62
 
package/lib/upgrade.js CHANGED
@@ -1,10 +1,9 @@
1
+ import { abstractLogger } from '@platformatic/foundation'
1
2
  import zeroSixteen from '@platformatic/service/lib/versions/0.16.0.js'
2
- import { abstractLogger } from '@platformatic/utils'
3
3
  import { join } from 'node:path'
4
+ import { loadMigrationsFromPath, semgrator } from 'semgrator'
4
5
 
5
6
  export async function upgrade (logger, config, version) {
6
- const { semgrator, loadMigrationsFromPath } = await import('semgrator')
7
-
8
7
  const iterator = loadMigrationsFromPath(join(import.meta.dirname, 'versions'))
9
8
 
10
9
  const migrations = [zeroSixteen]
package/lib/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { connect } from '@platformatic/db-core'
2
- import { kMetadata } from '@platformatic/utils'
2
+ import { kMetadata } from '@platformatic/foundation'
3
3
  import fs from 'node:fs/promises'
4
4
  import { dirname, join } from 'node:path'
5
5
  import { fileURLToPath } from 'node:url'
@@ -0,0 +1,14 @@
1
+ export default {
2
+ version: '2.99.0',
3
+ up (config) {
4
+ if (typeof config.plugins?.typescript !== 'undefined') {
5
+ delete config.plugins.typescript
6
+ }
7
+
8
+ if (typeof config.clients !== 'undefined') {
9
+ delete config.clients
10
+ }
11
+
12
+ return config
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/db",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "devDependencies": {
19
19
  "@databases/pg": "^5.5.0",
20
20
  "@databases/sql": "^3.3.0",
21
- "@opentelemetry/api": "^1.8.0",
21
+ "@opentelemetry/api": "^1.9.0",
22
22
  "ajv": "^8.12.0",
23
23
  "bindings": "^1.5.0",
24
24
  "borp": "^0.20.0",
@@ -30,7 +30,6 @@
30
30
  "neostandard": "^0.12.0",
31
31
  "openapi-types": "^12.1.3",
32
32
  "split2": "^4.2.0",
33
- "strip-ansi": "^7.1.0",
34
33
  "tsd": "^0.32.0",
35
34
  "typescript": "^5.5.4",
36
35
  "undici": "^7.0.0",
@@ -49,10 +48,8 @@
49
48
  "camelcase": "^6.3.0",
50
49
  "close-with-grace": "^2.0.0",
51
50
  "code-block-writer": "^13.0.1",
52
- "commist": "^3.2.0",
53
51
  "console-table-printer": "^2.12.0",
54
52
  "env-schema": "^6.0.0",
55
- "es-main": "^1.3.0",
56
53
  "execa": "^9.0.0",
57
54
  "fastify": "^5.0.0",
58
55
  "fastify-metrics": "^12.0.0",
@@ -63,25 +60,27 @@
63
60
  "minimist": "^1.2.8",
64
61
  "my-ua-parser": "^2.0.2",
65
62
  "ora": "^6.3.1",
66
- "pino": "^9.0.0",
63
+ "pino": "^9.9.0",
67
64
  "pino-pretty": "^13.0.0",
68
65
  "postgrator": "^8.0.0",
69
66
  "rfdc": "^1.3.1",
70
67
  "rimraf": "^4.4.1",
71
68
  "semgrator": "^0.3.0",
72
- "@platformatic/basic": "3.0.0-alpha.1",
73
- "@platformatic/db-authorization": "3.0.0-alpha.1",
74
- "@platformatic/generators": "3.0.0-alpha.1",
75
- "@platformatic/db-core": "3.0.0-alpha.1",
76
- "@platformatic/service": "3.0.0-alpha.1",
77
- "@platformatic/sql-events": "3.0.0-alpha.1",
78
- "@platformatic/sql-graphql": "3.0.0-alpha.1",
79
- "@platformatic/sql-json-schema-mapper": "3.0.0-alpha.1",
80
- "@platformatic/sql-mapper": "3.0.0-alpha.1",
81
- "@platformatic/telemetry": "3.0.0-alpha.1",
82
- "@platformatic/ts-compiler": "3.0.0-alpha.1",
83
- "@platformatic/utils": "3.0.0-alpha.1",
84
- "@platformatic/sql-openapi": "3.0.0-alpha.1"
69
+ "@platformatic/db-authorization": "3.0.0-alpha.2",
70
+ "@platformatic/db-core": "3.0.0-alpha.2",
71
+ "@platformatic/generators": "3.0.0-alpha.2",
72
+ "@platformatic/sql-events": "3.0.0-alpha.2",
73
+ "@platformatic/sql-graphql": "3.0.0-alpha.2",
74
+ "@platformatic/service": "3.0.0-alpha.2",
75
+ "@platformatic/basic": "3.0.0-alpha.2",
76
+ "@platformatic/sql-mapper": "3.0.0-alpha.2",
77
+ "@platformatic/sql-openapi": "3.0.0-alpha.2",
78
+ "@platformatic/sql-json-schema-mapper": "3.0.0-alpha.2",
79
+ "@platformatic/telemetry": "3.0.0-alpha.2",
80
+ "@platformatic/foundation": "3.0.0-alpha.2"
81
+ },
82
+ "engines": {
83
+ "node": ">=22.18.0"
85
84
  },
86
85
  "scripts": {
87
86
  "test": "pnpm run lint && borp -T --concurrency=1 --timeout 1200000",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/db/3.0.0-alpha.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/db/3.0.0-alpha.2.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Database Config",
5
5
  "type": "object",
@@ -1151,45 +1151,6 @@
1151
1151
  }
1152
1152
  ]
1153
1153
  }
1154
- },
1155
- "typescript": {
1156
- "anyOf": [
1157
- {
1158
- "type": "object",
1159
- "properties": {
1160
- "enabled": {
1161
- "anyOf": [
1162
- {
1163
- "type": "boolean"
1164
- },
1165
- {
1166
- "type": "string"
1167
- }
1168
- ]
1169
- },
1170
- "tsConfig": {
1171
- "type": "string",
1172
- "resolvePath": true
1173
- },
1174
- "outDir": {
1175
- "type": "string",
1176
- "resolvePath": true
1177
- },
1178
- "flags": {
1179
- "type": "array",
1180
- "items": {
1181
- "type": "string"
1182
- }
1183
- }
1184
- }
1185
- },
1186
- {
1187
- "type": "boolean"
1188
- },
1189
- {
1190
- "type": "string"
1191
- }
1192
- ]
1193
1154
  }
1194
1155
  },
1195
1156
  "additionalProperties": false,
@@ -1206,6 +1167,13 @@
1206
1167
  }
1207
1168
  ]
1208
1169
  },
1170
+ "application": {
1171
+ "type": "object",
1172
+ "properties": {},
1173
+ "additionalProperties": false,
1174
+ "required": [],
1175
+ "default": {}
1176
+ },
1209
1177
  "telemetry": {
1210
1178
  "type": "object",
1211
1179
  "properties": {
@@ -1336,48 +1304,6 @@
1336
1304
  ],
1337
1305
  "additionalProperties": false
1338
1306
  },
1339
- "clients": {
1340
- "type": "array",
1341
- "items": {
1342
- "type": "object",
1343
- "properties": {
1344
- "serviceId": {
1345
- "type": "string"
1346
- },
1347
- "name": {
1348
- "type": "string"
1349
- },
1350
- "type": {
1351
- "type": "string",
1352
- "enum": [
1353
- "openapi",
1354
- "graphql"
1355
- ]
1356
- },
1357
- "path": {
1358
- "type": "string",
1359
- "resolvePath": true
1360
- },
1361
- "schema": {
1362
- "type": "string",
1363
- "resolvePath": true
1364
- },
1365
- "url": {
1366
- "type": "string"
1367
- },
1368
- "fullResponse": {
1369
- "type": "boolean"
1370
- },
1371
- "fullRequest": {
1372
- "type": "boolean"
1373
- },
1374
- "validateResponse": {
1375
- "type": "boolean"
1376
- }
1377
- },
1378
- "additionalProperties": false
1379
- }
1380
- },
1381
1307
  "runtime": {
1382
1308
  "type": "object",
1383
1309
  "properties": {