@contember/engine-system-api 1.4.0-alpha.1 → 1.4.0-alpha.3
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/src/SystemContainer.d.ts +3 -2
- package/dist/src/SystemContainer.d.ts.map +1 -1
- package/dist/src/SystemContainer.js +3 -2
- package/dist/src/SystemContainer.js.map +1 -1
- package/dist/src/bin/runMigrations.js +1 -1
- package/dist/src/bin/runMigrations.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/migrations/2023-10-24-140000-schema-nullable-checksum.d.ts +3 -0
- package/dist/src/migrations/2023-10-24-140000-schema-nullable-checksum.d.ts.map +1 -0
- package/dist/src/migrations/2023-10-24-140000-schema-nullable-checksum.js +12 -0
- package/dist/src/migrations/2023-10-24-140000-schema-nullable-checksum.js.map +1 -0
- package/dist/src/migrations/runner.d.ts +1 -2
- package/dist/src/migrations/runner.d.ts.map +1 -1
- package/dist/src/migrations/runner.js +6 -7
- package/dist/src/migrations/runner.js.map +1 -1
- package/dist/src/migrations/snapshot.d.ts.map +1 -1
- package/dist/src/migrations/snapshot.js +7 -2
- package/dist/src/migrations/snapshot.js.map +1 -1
- package/dist/src/model/authorization/AuthorizationActions.d.ts +5 -0
- package/dist/src/model/authorization/AuthorizationActions.d.ts.map +1 -1
- package/dist/src/model/authorization/AuthorizationActions.js +1 -0
- package/dist/src/model/authorization/AuthorizationActions.js.map +1 -1
- package/dist/src/model/authorization/PermissionsFactory.d.ts.map +1 -1
- package/dist/src/model/authorization/PermissionsFactory.js +1 -0
- package/dist/src/model/authorization/PermissionsFactory.js.map +1 -1
- package/dist/src/model/commands/migrations/SaveMigrationCommand.d.ts +4 -4
- package/dist/src/model/commands/migrations/SaveMigrationCommand.d.ts.map +1 -1
- package/dist/src/model/commands/migrations/SaveMigrationCommand.js +11 -3
- package/dist/src/model/commands/migrations/SaveMigrationCommand.js.map +1 -1
- package/dist/src/model/dependencies/content/ContentQueryExecutor.d.ts +35 -0
- package/dist/src/model/dependencies/content/ContentQueryExecutor.d.ts.map +1 -0
- package/dist/src/model/dependencies/content/ContentQueryExecutor.js +3 -0
- package/dist/src/model/dependencies/content/ContentQueryExecutor.js.map +1 -0
- package/dist/src/model/dependencies/index.d.ts +1 -0
- package/dist/src/model/dependencies/index.d.ts.map +1 -1
- package/dist/src/model/dependencies/index.js +1 -0
- package/dist/src/model/dependencies/index.js.map +1 -1
- package/dist/src/model/dtos/ExecutedMigration.d.ts +3 -2
- package/dist/src/model/dtos/ExecutedMigration.d.ts.map +1 -1
- package/dist/src/model/dtos/ExecutedMigration.js +2 -1
- package/dist/src/model/dtos/ExecutedMigration.js.map +1 -1
- package/dist/src/model/migrations/MigrationInput.d.ts +18 -0
- package/dist/src/model/migrations/MigrationInput.d.ts.map +1 -0
- package/dist/src/model/migrations/MigrationInput.js +3 -0
- package/dist/src/model/migrations/MigrationInput.js.map +1 -0
- package/dist/src/model/migrations/ProjectMigrator.d.ts +28 -6
- package/dist/src/model/migrations/ProjectMigrator.d.ts.map +1 -1
- package/dist/src/model/migrations/ProjectMigrator.js +80 -22
- package/dist/src/model/migrations/ProjectMigrator.js.map +1 -1
- package/dist/src/model/migrations/SchemaVersionBuilder.d.ts.map +1 -1
- package/dist/src/model/migrations/SchemaVersionBuilder.js +10 -5
- package/dist/src/model/migrations/SchemaVersionBuilder.js.map +1 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.d.ts +2 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.d.ts.map +1 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.js +2 -1
- package/dist/src/model/queries/migrations/ExecutedMigrationsQueryHelper.js.map +1 -1
- package/dist/src/resolvers/SystemResolverContext.d.ts +2 -2
- package/dist/src/resolvers/SystemResolverContext.d.ts.map +1 -1
- package/dist/src/resolvers/SystemResolverContext.js.map +1 -1
- package/dist/src/resolvers/mutation/MigrateMutationResolver.d.ts +1 -0
- package/dist/src/resolvers/mutation/MigrateMutationResolver.d.ts.map +1 -1
- package/dist/src/resolvers/mutation/MigrateMutationResolver.js +62 -4
- package/dist/src/resolvers/mutation/MigrateMutationResolver.js.map +1 -1
- package/dist/src/resolvers/query/ExecutedMigrationsQueryResolver.d.ts.map +1 -1
- package/dist/src/resolvers/query/ExecutedMigrationsQueryResolver.js +4 -0
- package/dist/src/resolvers/query/ExecutedMigrationsQueryResolver.js.map +1 -1
- package/dist/src/schema/system.graphql.d.ts.map +1 -1
- package/dist/src/schema/system.graphql.js +30 -4
- package/dist/src/schema/system.graphql.js.map +1 -1
- package/dist/src/schema/types.d.ts +170 -106
- package/dist/src/schema/types.d.ts.map +1 -1
- package/dist/src/schema/types.js +8 -1
- package/dist/src/schema/types.js.map +1 -1
- package/dist/src/tsconfig.tsbuildinfo +1 -1
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tests/cases/migrations/2020-05-06-150000-composed-primary.test.js +1 -0
- package/dist/tests/cases/migrations/2020-05-06-150000-composed-primary.test.js.map +1 -1
- package/dist/tests/cases/migrations/2020-06-01-103000-event-trigger-perf.test.js +1 -0
- package/dist/tests/cases/migrations/2020-06-01-103000-event-trigger-perf.test.js.map +1 -1
- package/dist/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.js +1 -0
- package/dist/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.js.map +1 -1
- package/dist/tests/cases/migrations/2023-09-11-174000-fix-on-delete.test.js +2 -0
- package/dist/tests/cases/migrations/2023-09-11-174000-fix-on-delete.test.js.map +1 -1
- package/dist/tests/cases/migrations/2023-10-19-173000-fix-unique.test.js +1 -0
- package/dist/tests/cases/migrations/2023-10-19-173000-fix-unique.test.js.map +1 -1
- package/dist/tests/tsconfig.tsbuildinfo +1 -1
- package/package.json +22 -22
- package/src/SystemContainer.ts +3 -1
- package/src/bin/runMigrations.ts +1 -2
- package/src/index.ts +5 -1
- package/src/migrations/2023-10-24-140000-schema-nullable-checksum.ts +11 -0
- package/src/migrations/runner.ts +10 -6
- package/src/migrations/snapshot.ts +7 -2
- package/src/model/authorization/AuthorizationActions.ts +1 -0
- package/src/model/authorization/PermissionsFactory.ts +1 -0
- package/src/model/commands/migrations/SaveMigrationCommand.ts +20 -7
- package/src/model/dependencies/content/ContentQueryExecutor.ts +27 -0
- package/src/model/dependencies/index.ts +1 -0
- package/src/model/dtos/ExecutedMigration.ts +3 -1
- package/src/model/migrations/MigrationInput.ts +25 -0
- package/src/model/migrations/ProjectMigrator.ts +113 -47
- package/src/model/migrations/SchemaVersionBuilder.ts +10 -5
- package/src/model/queries/migrations/ExecutedMigrationsQueryHelper.ts +3 -1
- package/src/resolvers/SystemResolverContext.ts +2 -2
- package/src/resolvers/mutation/MigrateMutationResolver.ts +61 -5
- package/src/resolvers/query/ExecutedMigrationsQueryResolver.ts +6 -1
- package/src/schema/system.graphql.ts +30 -4
- package/src/schema/types.ts +145 -106
- package/src/types.ts +1 -0
- package/tests/cases/migrations/2020-05-06-150000-composed-primary.test.ts +1 -0
- package/tests/cases/migrations/2020-06-01-103000-event-trigger-perf.test.ts +1 -0
- package/tests/cases/migrations/2022-10-03-110000-table-on-delete.test.ts +1 -0
- package/tests/cases/migrations/2023-09-11-174000-fix-on-delete.test.ts +2 -0
- package/tests/cases/migrations/2023-10-19-173000-fix-unique.test.ts +1 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { GraphQLResolveInfo } from 'graphql'
|
|
2
2
|
import { SystemResolverContext } from '../SystemResolverContext'
|
|
3
3
|
import { MutationResolver } from '../Resolver'
|
|
4
|
-
import { MigrateResponse, MutationMigrateArgs } from '../../schema'
|
|
4
|
+
import { MigrateResponse, MigrationType, MutationMigrateArgs } from '../../schema'
|
|
5
5
|
import { Migration } from '@contember/schema-migrations'
|
|
6
6
|
import { AuthorizationActions, MigrationError, ProjectMigrator, StagesQuery } from '../../model'
|
|
7
|
+
import { MigrationInput } from '../../model/migrations/MigrationInput'
|
|
8
|
+
import { UserInputError } from '@contember/graphql-utils'
|
|
9
|
+
import { SchemaValidatorSkippedErrors } from '@contember/schema-utils'
|
|
10
|
+
import { assertNever } from '../../utils'
|
|
7
11
|
|
|
8
12
|
const pg_lock_id = 1597474138739147
|
|
9
13
|
|
|
@@ -26,7 +30,7 @@ export class MigrateMutationResolver implements MutationResolver<'migrate'> {
|
|
|
26
30
|
info: GraphQLResolveInfo,
|
|
27
31
|
force = false,
|
|
28
32
|
): Promise<MigrateResponse> {
|
|
29
|
-
const migrations = args
|
|
33
|
+
const migrations = this.parseMigrationInput(args)
|
|
30
34
|
|
|
31
35
|
return context.db.locked(pg_lock_id, db => db.transaction(async trx => {
|
|
32
36
|
const stages = await trx.queryHandler.fetch(new StagesQuery())
|
|
@@ -34,9 +38,16 @@ export class MigrateMutationResolver implements MutationResolver<'migrate'> {
|
|
|
34
38
|
await context.requireAccess(AuthorizationActions.PROJECT_MIGRATE, stage.slug)
|
|
35
39
|
}
|
|
36
40
|
try {
|
|
37
|
-
await this.projectMigrator.migrate(
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
await this.projectMigrator.migrate({
|
|
42
|
+
db: trx,
|
|
43
|
+
project: context.project,
|
|
44
|
+
identity: context.identity,
|
|
45
|
+
stages,
|
|
46
|
+
migrationsToExecute: migrations,
|
|
47
|
+
options: {
|
|
48
|
+
ignoreOrder: force,
|
|
49
|
+
skipExecuted: true,
|
|
50
|
+
},
|
|
40
51
|
})
|
|
41
52
|
} catch (e) {
|
|
42
53
|
if (e instanceof MigrationError) {
|
|
@@ -61,4 +72,49 @@ export class MigrateMutationResolver implements MutationResolver<'migrate'> {
|
|
|
61
72
|
}
|
|
62
73
|
}))
|
|
63
74
|
}
|
|
75
|
+
|
|
76
|
+
private parseMigrationInput(args: MutationMigrateArgs): MigrationInput[] {
|
|
77
|
+
return args.migrations.map((it): MigrationInput => {
|
|
78
|
+
if (!it.type) {
|
|
79
|
+
if (!it.modifications || !it.formatVersion) {
|
|
80
|
+
throw new UserInputError('invalid migration format')
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
type: 'schema',
|
|
84
|
+
formatVersion: it.formatVersion,
|
|
85
|
+
modifications: it.modifications as Migration.Modification[],
|
|
86
|
+
version: it.version,
|
|
87
|
+
name: it.name,
|
|
88
|
+
skippedErrors: (it.skippedErrors as SchemaValidatorSkippedErrors[]) ?? undefined,
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (it.type === MigrationType.Schema) {
|
|
92
|
+
if (!it.schemaMigration) {
|
|
93
|
+
throw new UserInputError('schemaMigration must be defined for SCHEMA type')
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
type: 'schema',
|
|
97
|
+
name: it.name,
|
|
98
|
+
version: it.version,
|
|
99
|
+
...(it.schemaMigration as Omit<Migration, 'name' | 'version'>),
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (it.type === MigrationType.Content) {
|
|
103
|
+
if (!it.contentMigration) {
|
|
104
|
+
throw new UserInputError('contentMigration must be defined for CONTENT type')
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
type: 'content',
|
|
108
|
+
name: it.name,
|
|
109
|
+
version: it.version,
|
|
110
|
+
queries: it.contentMigration.map(it => ({
|
|
111
|
+
query: it.query,
|
|
112
|
+
stage: it.stage ?? undefined,
|
|
113
|
+
variables: it.variables ?? undefined,
|
|
114
|
+
})),
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return assertNever(it.type)
|
|
118
|
+
})
|
|
119
|
+
}
|
|
64
120
|
}
|
|
@@ -2,7 +2,7 @@ import { GraphQLResolveInfo } from 'graphql'
|
|
|
2
2
|
import { SystemResolverContext } from '../SystemResolverContext'
|
|
3
3
|
import { QueryResolver } from '../Resolver'
|
|
4
4
|
import { ExecutedMigration, QueryExecutedMigrationsArgs } from '../../schema'
|
|
5
|
-
import { ExecutedMigrationByVersionQuery, ExecutedMigrationsQuery } from '../../model'
|
|
5
|
+
import { AuthorizationActions, ExecutedMigrationByVersionQuery, ExecutedMigrationsQuery, StagesQuery } from '../../model'
|
|
6
6
|
|
|
7
7
|
export class ExecutedMigrationsQueryResolver implements QueryResolver<'executedMigrations'> {
|
|
8
8
|
async executedMigrations(
|
|
@@ -11,6 +11,11 @@ export class ExecutedMigrationsQueryResolver implements QueryResolver<'executedM
|
|
|
11
11
|
context: SystemResolverContext,
|
|
12
12
|
info: GraphQLResolveInfo,
|
|
13
13
|
): Promise<ExecutedMigration[]> {
|
|
14
|
+
const stages = await context.db.queryHandler.fetch(new StagesQuery())
|
|
15
|
+
for (const stage of stages) {
|
|
16
|
+
await context.requireAccess(AuthorizationActions.PROJECT_LIST_MIGRATIONS, stage.slug)
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
if (args.version) {
|
|
15
20
|
const migration = await context.db.queryHandler.fetch(new ExecutedMigrationByVersionQuery(args.version))
|
|
16
21
|
return migration ? [migration] : []
|
|
@@ -127,16 +127,40 @@ const schema: DocumentNode = gql`
|
|
|
127
127
|
version: String!
|
|
128
128
|
name: String!
|
|
129
129
|
executedAt: DateTime!
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
|
|
131
|
+
checksum: String
|
|
132
|
+
formatVersion: Int
|
|
133
|
+
modifications: [Json!]
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
# === migrate ===
|
|
136
|
-
|
|
137
|
+
enum MigrationType {
|
|
138
|
+
SCHEMA
|
|
139
|
+
CONTENT
|
|
140
|
+
}
|
|
141
|
+
|
|
137
142
|
input Migration {
|
|
138
143
|
version: String!
|
|
139
144
|
name: String!
|
|
145
|
+
|
|
146
|
+
type: MigrationType
|
|
147
|
+
schemaMigration: SchemaMigration
|
|
148
|
+
contentMigration: [ContentMigration!]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
formatVersion: Int @deprecated(reason: "Use schemaMigration with SCHEMA type")
|
|
152
|
+
modifications: [Json!] @deprecated(reason: "Use schemaMigration with SCHEMA type")
|
|
153
|
+
skippedErrors: [MigrationSkippedError!] @deprecated(reason: "Use schemaMigration with SCHEMA type")
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
input ContentMigration {
|
|
157
|
+
query: String!
|
|
158
|
+
stage: String
|
|
159
|
+
variables: Json
|
|
160
|
+
checkMutationResult: Boolean
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
input SchemaMigration {
|
|
140
164
|
formatVersion: Int!
|
|
141
165
|
modifications: [Json!]!
|
|
142
166
|
skippedErrors: [MigrationSkippedError!]
|
|
@@ -153,6 +177,8 @@ const schema: DocumentNode = gql`
|
|
|
153
177
|
INVALID_FORMAT
|
|
154
178
|
INVALID_SCHEMA
|
|
155
179
|
MIGRATION_FAILED
|
|
180
|
+
CONTENT_MIGRATION_FAILED
|
|
181
|
+
CONTENT_MIGRATION_NOT_SUCCESSFUL
|
|
156
182
|
}
|
|
157
183
|
|
|
158
184
|
type MigrateError {
|
package/src/schema/types.ts
CHANGED
|
@@ -4,65 +4,74 @@ export type InputMaybe<T> = Maybe<T>
|
|
|
4
4
|
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }
|
|
5
5
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> }
|
|
6
6
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> }
|
|
7
|
+
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never }
|
|
8
|
+
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }
|
|
7
9
|
export type RequireFields<T, K extends keyof T> = Omit<T, K> & { [P in K]-?: NonNullable<T[P]> }
|
|
8
10
|
/** All built-in and custom scalars, mapped to their actual values */
|
|
9
11
|
export type Scalars = {
|
|
10
|
-
ID: string
|
|
11
|
-
String: string
|
|
12
|
-
Boolean: boolean
|
|
13
|
-
Int: number
|
|
14
|
-
Float: number
|
|
15
|
-
DateTime: Date
|
|
16
|
-
Json: unknown
|
|
17
|
-
PrimaryKey: any
|
|
12
|
+
ID: { input: string; output: string }
|
|
13
|
+
String: { input: string; output: string }
|
|
14
|
+
Boolean: { input: boolean; output: boolean }
|
|
15
|
+
Int: { input: number; output: number }
|
|
16
|
+
Float: { input: number; output: number }
|
|
17
|
+
DateTime: { input: Date; output: Date }
|
|
18
|
+
Json: { input: unknown; output: unknown }
|
|
19
|
+
PrimaryKey: { input: any; output: any }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type ContentMigration = {
|
|
23
|
+
readonly checkMutationResult?: InputMaybe<Scalars['Boolean']['input']>
|
|
24
|
+
readonly query: Scalars['String']['input']
|
|
25
|
+
readonly stage?: InputMaybe<Scalars['String']['input']>
|
|
26
|
+
readonly variables?: InputMaybe<Scalars['Json']['input']>
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
export type CreateEvent = Event & {
|
|
21
30
|
readonly __typename?: 'CreateEvent'
|
|
22
|
-
readonly appliedAt: Scalars['DateTime']
|
|
23
|
-
readonly createdAt: Scalars['DateTime']
|
|
24
|
-
readonly description: Scalars['String']
|
|
25
|
-
readonly id: Scalars['String']
|
|
26
|
-
readonly identityDescription: Scalars['String']
|
|
27
|
-
readonly identityId: Scalars['String']
|
|
28
|
-
readonly newValues: Scalars['Json']
|
|
29
|
-
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']>
|
|
30
|
-
readonly tableName: Scalars['String']
|
|
31
|
-
readonly transactionId: Scalars['String']
|
|
31
|
+
readonly appliedAt: Scalars['DateTime']['output']
|
|
32
|
+
readonly createdAt: Scalars['DateTime']['output']
|
|
33
|
+
readonly description: Scalars['String']['output']
|
|
34
|
+
readonly id: Scalars['String']['output']
|
|
35
|
+
readonly identityDescription: Scalars['String']['output']
|
|
36
|
+
readonly identityId: Scalars['String']['output']
|
|
37
|
+
readonly newValues: Scalars['Json']['output']
|
|
38
|
+
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']['output']>
|
|
39
|
+
readonly tableName: Scalars['String']['output']
|
|
40
|
+
readonly transactionId: Scalars['String']['output']
|
|
32
41
|
readonly type: EventType
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
export type DeleteEvent = Event & {
|
|
36
45
|
readonly __typename?: 'DeleteEvent'
|
|
37
|
-
readonly appliedAt: Scalars['DateTime']
|
|
38
|
-
readonly createdAt: Scalars['DateTime']
|
|
39
|
-
readonly description: Scalars['String']
|
|
40
|
-
readonly id: Scalars['String']
|
|
41
|
-
readonly identityDescription: Scalars['String']
|
|
42
|
-
readonly identityId: Scalars['String']
|
|
43
|
-
readonly oldValues: Scalars['Json']
|
|
44
|
-
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']>
|
|
45
|
-
readonly tableName: Scalars['String']
|
|
46
|
-
readonly transactionId: Scalars['String']
|
|
46
|
+
readonly appliedAt: Scalars['DateTime']['output']
|
|
47
|
+
readonly createdAt: Scalars['DateTime']['output']
|
|
48
|
+
readonly description: Scalars['String']['output']
|
|
49
|
+
readonly id: Scalars['String']['output']
|
|
50
|
+
readonly identityDescription: Scalars['String']['output']
|
|
51
|
+
readonly identityId: Scalars['String']['output']
|
|
52
|
+
readonly oldValues: Scalars['Json']['output']
|
|
53
|
+
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']['output']>
|
|
54
|
+
readonly tableName: Scalars['String']['output']
|
|
55
|
+
readonly transactionId: Scalars['String']['output']
|
|
47
56
|
readonly type: EventType
|
|
48
57
|
}
|
|
49
58
|
|
|
50
59
|
export type Event = {
|
|
51
|
-
readonly appliedAt: Scalars['DateTime']
|
|
52
|
-
readonly createdAt: Scalars['DateTime']
|
|
53
|
-
readonly description: Scalars['String']
|
|
54
|
-
readonly id: Scalars['String']
|
|
55
|
-
readonly identityDescription: Scalars['String']
|
|
56
|
-
readonly identityId: Scalars['String']
|
|
57
|
-
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']>
|
|
58
|
-
readonly tableName: Scalars['String']
|
|
59
|
-
readonly transactionId: Scalars['String']
|
|
60
|
+
readonly appliedAt: Scalars['DateTime']['output']
|
|
61
|
+
readonly createdAt: Scalars['DateTime']['output']
|
|
62
|
+
readonly description: Scalars['String']['output']
|
|
63
|
+
readonly id: Scalars['String']['output']
|
|
64
|
+
readonly identityDescription: Scalars['String']['output']
|
|
65
|
+
readonly identityId: Scalars['String']['output']
|
|
66
|
+
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']['output']>
|
|
67
|
+
readonly tableName: Scalars['String']['output']
|
|
68
|
+
readonly transactionId: Scalars['String']['output']
|
|
60
69
|
readonly type: EventType
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
export type EventFilterRow = {
|
|
64
|
-
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']>
|
|
65
|
-
readonly tableName: Scalars['String']
|
|
73
|
+
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']['input']>
|
|
74
|
+
readonly tableName: Scalars['String']['input']
|
|
66
75
|
}
|
|
67
76
|
|
|
68
77
|
export enum EventType {
|
|
@@ -74,25 +83,25 @@ export enum EventType {
|
|
|
74
83
|
export type EventsArgs = {
|
|
75
84
|
readonly filter?: InputMaybe<EventsFilter>
|
|
76
85
|
/** Max 10000 */
|
|
77
|
-
readonly limit?: InputMaybe<Scalars['Int']>
|
|
78
|
-
readonly offset?: InputMaybe<Scalars['Int']>
|
|
86
|
+
readonly limit?: InputMaybe<Scalars['Int']['input']>
|
|
87
|
+
readonly offset?: InputMaybe<Scalars['Int']['input']>
|
|
79
88
|
readonly order?: InputMaybe<EventsOrder>
|
|
80
|
-
readonly stage?: InputMaybe<Scalars['String']>
|
|
89
|
+
readonly stage?: InputMaybe<Scalars['String']['input']>
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
export type EventsFilter = {
|
|
84
93
|
readonly appliedAt?: InputMaybe<EventsFilterDate>
|
|
85
94
|
readonly createdAt?: InputMaybe<EventsFilterDate>
|
|
86
|
-
readonly identities?: InputMaybe<ReadonlyArray<Scalars['String']>>
|
|
95
|
+
readonly identities?: InputMaybe<ReadonlyArray<Scalars['String']['input']>>
|
|
87
96
|
readonly rows?: InputMaybe<ReadonlyArray<EventFilterRow>>
|
|
88
|
-
readonly tables?: InputMaybe<ReadonlyArray<Scalars['String']>>
|
|
89
|
-
readonly transactions?: InputMaybe<ReadonlyArray<Scalars['String']>>
|
|
97
|
+
readonly tables?: InputMaybe<ReadonlyArray<Scalars['String']['input']>>
|
|
98
|
+
readonly transactions?: InputMaybe<ReadonlyArray<Scalars['String']['input']>>
|
|
90
99
|
readonly types?: InputMaybe<ReadonlyArray<EventType>>
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
export type EventsFilterDate = {
|
|
94
|
-
readonly from?: InputMaybe<Scalars['DateTime']>
|
|
95
|
-
readonly to?: InputMaybe<Scalars['DateTime']>
|
|
103
|
+
readonly from?: InputMaybe<Scalars['DateTime']['input']>
|
|
104
|
+
readonly to?: InputMaybe<Scalars['DateTime']['input']>
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
export enum EventsOrder {
|
|
@@ -104,23 +113,25 @@ export enum EventsOrder {
|
|
|
104
113
|
|
|
105
114
|
export type ExecutedMigration = {
|
|
106
115
|
readonly __typename?: 'ExecutedMigration'
|
|
107
|
-
readonly checksum
|
|
108
|
-
readonly executedAt: Scalars['DateTime']
|
|
109
|
-
readonly formatVersion
|
|
110
|
-
readonly modifications
|
|
111
|
-
readonly name: Scalars['String']
|
|
112
|
-
readonly version: Scalars['String']
|
|
116
|
+
readonly checksum?: Maybe<Scalars['String']['output']>
|
|
117
|
+
readonly executedAt: Scalars['DateTime']['output']
|
|
118
|
+
readonly formatVersion?: Maybe<Scalars['Int']['output']>
|
|
119
|
+
readonly modifications?: Maybe<ReadonlyArray<Scalars['Json']['output']>>
|
|
120
|
+
readonly name: Scalars['String']['output']
|
|
121
|
+
readonly version: Scalars['String']['output']
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
export type MigrateError = {
|
|
116
125
|
readonly __typename?: 'MigrateError'
|
|
117
126
|
readonly code: MigrateErrorCode
|
|
118
|
-
readonly developerMessage: Scalars['String']
|
|
119
|
-
readonly migration: Scalars['String']
|
|
127
|
+
readonly developerMessage: Scalars['String']['output']
|
|
128
|
+
readonly migration: Scalars['String']['output']
|
|
120
129
|
}
|
|
121
130
|
|
|
122
131
|
export enum MigrateErrorCode {
|
|
123
132
|
AlreadyExecuted = 'ALREADY_EXECUTED',
|
|
133
|
+
ContentMigrationFailed = 'CONTENT_MIGRATION_FAILED',
|
|
134
|
+
ContentMigrationNotSuccessful = 'CONTENT_MIGRATION_NOT_SUCCESSFUL',
|
|
124
135
|
InvalidFormat = 'INVALID_FORMAT',
|
|
125
136
|
InvalidSchema = 'INVALID_SCHEMA',
|
|
126
137
|
MigrationFailed = 'MIGRATION_FAILED',
|
|
@@ -132,27 +143,33 @@ export type MigrateResponse = {
|
|
|
132
143
|
readonly error?: Maybe<MigrateError>
|
|
133
144
|
/** @deprecated Field no longer supported */
|
|
134
145
|
readonly errors: ReadonlyArray<MigrateError>
|
|
135
|
-
readonly ok: Scalars['Boolean']
|
|
146
|
+
readonly ok: Scalars['Boolean']['output']
|
|
136
147
|
readonly result?: Maybe<MigrateResult>
|
|
137
148
|
}
|
|
138
149
|
|
|
139
150
|
export type MigrateResult = {
|
|
140
151
|
readonly __typename?: 'MigrateResult'
|
|
141
|
-
readonly message: Scalars['String']
|
|
152
|
+
readonly message: Scalars['String']['output']
|
|
142
153
|
}
|
|
143
154
|
|
|
144
155
|
export type Migration = {
|
|
145
|
-
readonly
|
|
146
|
-
|
|
147
|
-
readonly
|
|
156
|
+
readonly contentMigration?: InputMaybe<ReadonlyArray<ContentMigration>>
|
|
157
|
+
/** @deprecated Use schemaMigration with SCHEMA type */
|
|
158
|
+
readonly formatVersion?: InputMaybe<Scalars['Int']['input']>
|
|
159
|
+
/** @deprecated Use schemaMigration with SCHEMA type */
|
|
160
|
+
readonly modifications?: InputMaybe<ReadonlyArray<Scalars['Json']['input']>>
|
|
161
|
+
readonly name: Scalars['String']['input']
|
|
162
|
+
readonly schemaMigration?: InputMaybe<SchemaMigration>
|
|
163
|
+
/** @deprecated Use schemaMigration with SCHEMA type */
|
|
148
164
|
readonly skippedErrors?: InputMaybe<ReadonlyArray<MigrationSkippedError>>
|
|
149
|
-
readonly
|
|
165
|
+
readonly type?: InputMaybe<MigrationType>
|
|
166
|
+
readonly version: Scalars['String']['input']
|
|
150
167
|
}
|
|
151
168
|
|
|
152
169
|
export type MigrationDeleteError = {
|
|
153
170
|
readonly __typename?: 'MigrationDeleteError'
|
|
154
171
|
readonly code: MigrationDeleteErrorCode
|
|
155
|
-
readonly developerMessage: Scalars['String']
|
|
172
|
+
readonly developerMessage: Scalars['String']['output']
|
|
156
173
|
}
|
|
157
174
|
|
|
158
175
|
export enum MigrationDeleteErrorCode {
|
|
@@ -163,20 +180,20 @@ export enum MigrationDeleteErrorCode {
|
|
|
163
180
|
export type MigrationDeleteResponse = {
|
|
164
181
|
readonly __typename?: 'MigrationDeleteResponse'
|
|
165
182
|
readonly error?: Maybe<MigrationDeleteError>
|
|
166
|
-
readonly ok: Scalars['Boolean']
|
|
183
|
+
readonly ok: Scalars['Boolean']['output']
|
|
167
184
|
}
|
|
168
185
|
|
|
169
186
|
export type MigrationModification = {
|
|
170
|
-
readonly formatVersion?: InputMaybe<Scalars['Int']>
|
|
171
|
-
readonly modifications?: InputMaybe<ReadonlyArray<Scalars['Json']>>
|
|
172
|
-
readonly name?: InputMaybe<Scalars['String']>
|
|
173
|
-
readonly version?: InputMaybe<Scalars['String']>
|
|
187
|
+
readonly formatVersion?: InputMaybe<Scalars['Int']['input']>
|
|
188
|
+
readonly modifications?: InputMaybe<ReadonlyArray<Scalars['Json']['input']>>
|
|
189
|
+
readonly name?: InputMaybe<Scalars['String']['input']>
|
|
190
|
+
readonly version?: InputMaybe<Scalars['String']['input']>
|
|
174
191
|
}
|
|
175
192
|
|
|
176
193
|
export type MigrationModifyError = {
|
|
177
194
|
readonly __typename?: 'MigrationModifyError'
|
|
178
195
|
readonly code: MigrationModifyErrorCode
|
|
179
|
-
readonly developerMessage: Scalars['String']
|
|
196
|
+
readonly developerMessage: Scalars['String']['output']
|
|
180
197
|
}
|
|
181
198
|
|
|
182
199
|
export enum MigrationModifyErrorCode {
|
|
@@ -186,12 +203,17 @@ export enum MigrationModifyErrorCode {
|
|
|
186
203
|
export type MigrationModifyResponse = {
|
|
187
204
|
readonly __typename?: 'MigrationModifyResponse'
|
|
188
205
|
readonly error?: Maybe<MigrationModifyError>
|
|
189
|
-
readonly ok: Scalars['Boolean']
|
|
206
|
+
readonly ok: Scalars['Boolean']['output']
|
|
190
207
|
}
|
|
191
208
|
|
|
192
209
|
export type MigrationSkippedError = {
|
|
193
|
-
readonly code: Scalars['String']
|
|
194
|
-
readonly path?: InputMaybe<Scalars['String']>
|
|
210
|
+
readonly code: Scalars['String']['input']
|
|
211
|
+
readonly path?: InputMaybe<Scalars['String']['input']>
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export enum MigrationType {
|
|
215
|
+
Content = 'CONTENT',
|
|
216
|
+
Schema = 'SCHEMA'
|
|
195
217
|
}
|
|
196
218
|
|
|
197
219
|
export type Mutation = {
|
|
@@ -215,12 +237,12 @@ export type MutationMigrateArgs = {
|
|
|
215
237
|
|
|
216
238
|
|
|
217
239
|
export type MutationMigrationDeleteArgs = {
|
|
218
|
-
migration: Scalars['String']
|
|
240
|
+
migration: Scalars['String']['input']
|
|
219
241
|
}
|
|
220
242
|
|
|
221
243
|
|
|
222
244
|
export type MutationMigrationModifyArgs = {
|
|
223
|
-
migration: Scalars['String']
|
|
245
|
+
migration: Scalars['String']['input']
|
|
224
246
|
modification: MigrationModification
|
|
225
247
|
}
|
|
226
248
|
|
|
@@ -238,34 +260,40 @@ export type QueryEventsArgs = {
|
|
|
238
260
|
|
|
239
261
|
|
|
240
262
|
export type QueryExecutedMigrationsArgs = {
|
|
241
|
-
version?: InputMaybe<Scalars['String']>
|
|
263
|
+
version?: InputMaybe<Scalars['String']['input']>
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type SchemaMigration = {
|
|
267
|
+
readonly formatVersion: Scalars['Int']['input']
|
|
268
|
+
readonly modifications: ReadonlyArray<Scalars['Json']['input']>
|
|
269
|
+
readonly skippedErrors?: InputMaybe<ReadonlyArray<MigrationSkippedError>>
|
|
242
270
|
}
|
|
243
271
|
|
|
244
272
|
export type Stage = {
|
|
245
273
|
readonly __typename?: 'Stage'
|
|
246
|
-
readonly id: Scalars['String']
|
|
247
|
-
readonly name: Scalars['String']
|
|
248
|
-
readonly slug: Scalars['String']
|
|
274
|
+
readonly id: Scalars['String']['output']
|
|
275
|
+
readonly name: Scalars['String']['output']
|
|
276
|
+
readonly slug: Scalars['String']['output']
|
|
249
277
|
}
|
|
250
278
|
|
|
251
279
|
export type TruncateResponse = {
|
|
252
280
|
readonly __typename?: 'TruncateResponse'
|
|
253
|
-
readonly ok: Scalars['Boolean']
|
|
281
|
+
readonly ok: Scalars['Boolean']['output']
|
|
254
282
|
}
|
|
255
283
|
|
|
256
284
|
export type UpdateEvent = Event & {
|
|
257
285
|
readonly __typename?: 'UpdateEvent'
|
|
258
|
-
readonly appliedAt: Scalars['DateTime']
|
|
259
|
-
readonly createdAt: Scalars['DateTime']
|
|
260
|
-
readonly description: Scalars['String']
|
|
261
|
-
readonly diffValues: Scalars['Json']
|
|
262
|
-
readonly id: Scalars['String']
|
|
263
|
-
readonly identityDescription: Scalars['String']
|
|
264
|
-
readonly identityId: Scalars['String']
|
|
265
|
-
readonly oldValues: Scalars['Json']
|
|
266
|
-
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']>
|
|
267
|
-
readonly tableName: Scalars['String']
|
|
268
|
-
readonly transactionId: Scalars['String']
|
|
286
|
+
readonly appliedAt: Scalars['DateTime']['output']
|
|
287
|
+
readonly createdAt: Scalars['DateTime']['output']
|
|
288
|
+
readonly description: Scalars['String']['output']
|
|
289
|
+
readonly diffValues: Scalars['Json']['output']
|
|
290
|
+
readonly id: Scalars['String']['output']
|
|
291
|
+
readonly identityDescription: Scalars['String']['output']
|
|
292
|
+
readonly identityId: Scalars['String']['output']
|
|
293
|
+
readonly oldValues: Scalars['Json']['output']
|
|
294
|
+
readonly primaryKey: ReadonlyArray<Scalars['PrimaryKey']['output']>
|
|
295
|
+
readonly tableName: Scalars['String']['output']
|
|
296
|
+
readonly transactionId: Scalars['String']['output']
|
|
269
297
|
readonly type: EventType
|
|
270
298
|
}
|
|
271
299
|
|
|
@@ -336,13 +364,20 @@ export type DirectiveResolverFn<TResult = {}, TParent = {}, TContext = {}, TArgs
|
|
|
336
364
|
info: GraphQLResolveInfo
|
|
337
365
|
) => TResult | Promise<TResult>
|
|
338
366
|
|
|
367
|
+
|
|
368
|
+
/** Mapping of interface types */
|
|
369
|
+
export type ResolversInterfaceTypes<RefType extends Record<string, unknown>> = {
|
|
370
|
+
Event: (CreateEvent) | (DeleteEvent) | (UpdateEvent)
|
|
371
|
+
}
|
|
372
|
+
|
|
339
373
|
/** Mapping between all available schema types and the resolvers types */
|
|
340
374
|
export type ResolversTypes = {
|
|
341
|
-
Boolean: ResolverTypeWrapper<Scalars['Boolean']>
|
|
375
|
+
Boolean: ResolverTypeWrapper<Scalars['Boolean']['output']>
|
|
376
|
+
ContentMigration: ContentMigration
|
|
342
377
|
CreateEvent: ResolverTypeWrapper<CreateEvent>
|
|
343
|
-
DateTime: ResolverTypeWrapper<Scalars['DateTime']>
|
|
378
|
+
DateTime: ResolverTypeWrapper<Scalars['DateTime']['output']>
|
|
344
379
|
DeleteEvent: ResolverTypeWrapper<DeleteEvent>
|
|
345
|
-
Event: ResolversTypes['
|
|
380
|
+
Event: ResolverTypeWrapper<ResolversInterfaceTypes<ResolversTypes>['Event']>
|
|
346
381
|
EventFilterRow: EventFilterRow
|
|
347
382
|
EventType: EventType
|
|
348
383
|
EventsArgs: EventsArgs
|
|
@@ -350,8 +385,8 @@ export type ResolversTypes = {
|
|
|
350
385
|
EventsFilterDate: EventsFilterDate
|
|
351
386
|
EventsOrder: EventsOrder
|
|
352
387
|
ExecutedMigration: ResolverTypeWrapper<ExecutedMigration>
|
|
353
|
-
Int: ResolverTypeWrapper<Scalars['Int']>
|
|
354
|
-
Json: ResolverTypeWrapper<Scalars['Json']>
|
|
388
|
+
Int: ResolverTypeWrapper<Scalars['Int']['output']>
|
|
389
|
+
Json: ResolverTypeWrapper<Scalars['Json']['output']>
|
|
355
390
|
MigrateError: ResolverTypeWrapper<MigrateError>
|
|
356
391
|
MigrateErrorCode: MigrateErrorCode
|
|
357
392
|
MigrateResponse: ResolverTypeWrapper<MigrateResponse>
|
|
@@ -365,29 +400,32 @@ export type ResolversTypes = {
|
|
|
365
400
|
MigrationModifyErrorCode: MigrationModifyErrorCode
|
|
366
401
|
MigrationModifyResponse: ResolverTypeWrapper<MigrationModifyResponse>
|
|
367
402
|
MigrationSkippedError: MigrationSkippedError
|
|
403
|
+
MigrationType: MigrationType
|
|
368
404
|
Mutation: ResolverTypeWrapper<{}>
|
|
369
|
-
PrimaryKey: ResolverTypeWrapper<Scalars['PrimaryKey']>
|
|
405
|
+
PrimaryKey: ResolverTypeWrapper<Scalars['PrimaryKey']['output']>
|
|
370
406
|
Query: ResolverTypeWrapper<{}>
|
|
407
|
+
SchemaMigration: SchemaMigration
|
|
371
408
|
Stage: ResolverTypeWrapper<Stage>
|
|
372
|
-
String: ResolverTypeWrapper<Scalars['String']>
|
|
409
|
+
String: ResolverTypeWrapper<Scalars['String']['output']>
|
|
373
410
|
TruncateResponse: ResolverTypeWrapper<TruncateResponse>
|
|
374
411
|
UpdateEvent: ResolverTypeWrapper<UpdateEvent>
|
|
375
412
|
}
|
|
376
413
|
|
|
377
414
|
/** Mapping between all available schema types and the resolvers parents */
|
|
378
415
|
export type ResolversParentTypes = {
|
|
379
|
-
Boolean: Scalars['Boolean']
|
|
416
|
+
Boolean: Scalars['Boolean']['output']
|
|
417
|
+
ContentMigration: ContentMigration
|
|
380
418
|
CreateEvent: CreateEvent
|
|
381
|
-
DateTime: Scalars['DateTime']
|
|
419
|
+
DateTime: Scalars['DateTime']['output']
|
|
382
420
|
DeleteEvent: DeleteEvent
|
|
383
|
-
Event: ResolversParentTypes['
|
|
421
|
+
Event: ResolversInterfaceTypes<ResolversParentTypes>['Event']
|
|
384
422
|
EventFilterRow: EventFilterRow
|
|
385
423
|
EventsArgs: EventsArgs
|
|
386
424
|
EventsFilter: EventsFilter
|
|
387
425
|
EventsFilterDate: EventsFilterDate
|
|
388
426
|
ExecutedMigration: ExecutedMigration
|
|
389
|
-
Int: Scalars['Int']
|
|
390
|
-
Json: Scalars['Json']
|
|
427
|
+
Int: Scalars['Int']['output']
|
|
428
|
+
Json: Scalars['Json']['output']
|
|
391
429
|
MigrateError: MigrateError
|
|
392
430
|
MigrateResponse: MigrateResponse
|
|
393
431
|
MigrateResult: MigrateResult
|
|
@@ -399,10 +437,11 @@ export type ResolversParentTypes = {
|
|
|
399
437
|
MigrationModifyResponse: MigrationModifyResponse
|
|
400
438
|
MigrationSkippedError: MigrationSkippedError
|
|
401
439
|
Mutation: {}
|
|
402
|
-
PrimaryKey: Scalars['PrimaryKey']
|
|
440
|
+
PrimaryKey: Scalars['PrimaryKey']['output']
|
|
403
441
|
Query: {}
|
|
442
|
+
SchemaMigration: SchemaMigration
|
|
404
443
|
Stage: Stage
|
|
405
|
-
String: Scalars['String']
|
|
444
|
+
String: Scalars['String']['output']
|
|
406
445
|
TruncateResponse: TruncateResponse
|
|
407
446
|
UpdateEvent: UpdateEvent
|
|
408
447
|
}
|
|
@@ -456,10 +495,10 @@ export type EventResolvers<ContextType = any, ParentType extends ResolversParent
|
|
|
456
495
|
}
|
|
457
496
|
|
|
458
497
|
export type ExecutedMigrationResolvers<ContextType = any, ParentType extends ResolversParentTypes['ExecutedMigration'] = ResolversParentTypes['ExecutedMigration']> = {
|
|
459
|
-
checksum?: Resolver<ResolversTypes['String']
|
|
498
|
+
checksum?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>
|
|
460
499
|
executedAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>
|
|
461
|
-
formatVersion?: Resolver<ResolversTypes['Int']
|
|
462
|
-
modifications?: Resolver<ReadonlyArray<ResolversTypes['Json']
|
|
500
|
+
formatVersion?: Resolver<Maybe<ResolversTypes['Int']>, ParentType, ContextType>
|
|
501
|
+
modifications?: Resolver<Maybe<ReadonlyArray<ResolversTypes['Json']>>, ParentType, ContextType>
|
|
463
502
|
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>
|
|
464
503
|
version?: Resolver<ResolversTypes['String'], ParentType, ContextType>
|
|
465
504
|
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>
|
package/src/types.ts
CHANGED
|
@@ -38,6 +38,7 @@ test('table-on-delete test', async () => {
|
|
|
38
38
|
.buildSchema() })),
|
|
39
39
|
project: {
|
|
40
40
|
slug: 'test',
|
|
41
|
+
systemSchema: 'system',
|
|
41
42
|
stages: [
|
|
42
43
|
{
|
|
43
44
|
slug: 'prod',
|
|
@@ -90,6 +91,7 @@ test('table-on-delete test valid', async () => {
|
|
|
90
91
|
})),
|
|
91
92
|
project: {
|
|
92
93
|
slug: 'test',
|
|
94
|
+
systemSchema: 'system',
|
|
93
95
|
stages: [
|
|
94
96
|
{
|
|
95
97
|
slug: 'prod',
|