graphile-meta-schema 0.2.4 → 0.2.6
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/LICENSE +3 -1
- package/README.md +101 -4
- package/belongs-to.d.ts +3 -0
- package/belongs-to.js +37 -0
- package/esm/belongs-to.js +35 -0
- package/esm/has.js +36 -0
- package/esm/index.js +503 -0
- package/esm/many-to-many.js +81 -0
- package/esm/types.js +1 -0
- package/has.d.ts +3 -0
- package/has.js +38 -0
- package/index.d.ts +4 -0
- package/index.js +509 -0
- package/many-to-many.d.ts +3 -0
- package/many-to-many.js +83 -0
- package/package.json +28 -43
- package/types.d.ts +105 -0
- package/types.js +2 -0
- package/main/index.js +0 -496
- package/main/many-to-many.js +0 -124
- package/module/index.js +0 -629
- package/module/many-to-many.js +0 -79
package/package.json
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-meta-schema",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "graphile meta schema",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
|
-
"homepage": "https://github.com/
|
|
6
|
+
"homepage": "https://github.com/launchql/launchql",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
|
-
"main": "
|
|
9
|
-
"module": "
|
|
10
|
-
"
|
|
11
|
-
"lib": "src",
|
|
12
|
-
"test": "__tests__"
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"main",
|
|
16
|
-
"module"
|
|
17
|
-
],
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"module": "esm/index.js",
|
|
10
|
+
"types": "index.d.ts",
|
|
18
11
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
12
|
+
"clean": "makage clean",
|
|
13
|
+
"copy": "makage assets",
|
|
14
|
+
"prepack": "pnpm run build",
|
|
15
|
+
"build": "makage build",
|
|
16
|
+
"build:dev": "makage build --dev",
|
|
17
|
+
"lint": "eslint . --fix",
|
|
24
18
|
"test": "jest",
|
|
25
|
-
"test:watch": "jest --watch"
|
|
26
|
-
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
|
19
|
+
"test:watch": "jest --watch"
|
|
27
20
|
},
|
|
28
21
|
"publishConfig": {
|
|
29
|
-
"access": "public"
|
|
22
|
+
"access": "public",
|
|
23
|
+
"directory": "dist"
|
|
30
24
|
},
|
|
31
25
|
"repository": {
|
|
32
26
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/launchql/launchql"
|
|
34
28
|
},
|
|
35
29
|
"keywords": [
|
|
36
30
|
"postgraphile",
|
|
@@ -38,33 +32,24 @@
|
|
|
38
32
|
"plugin",
|
|
39
33
|
"postgres",
|
|
40
34
|
"graphql",
|
|
41
|
-
"metaschema"
|
|
35
|
+
"metaschema",
|
|
36
|
+
"launchql"
|
|
42
37
|
],
|
|
43
38
|
"bugs": {
|
|
44
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/launchql/launchql/issues"
|
|
45
40
|
},
|
|
46
41
|
"devDependencies": {
|
|
47
|
-
"@babel/cli": "7.11.6",
|
|
48
|
-
"@babel/core": "7.11.6",
|
|
49
|
-
"@babel/plugin-proposal-class-properties": "7.10.4",
|
|
50
|
-
"@babel/plugin-proposal-export-default-from": "7.10.4",
|
|
51
|
-
"@babel/plugin-proposal-object-rest-spread": "7.11.0",
|
|
52
|
-
"@babel/plugin-transform-runtime": "7.11.5",
|
|
53
|
-
"@babel/preset-env": "7.11.5",
|
|
54
42
|
"@graphile-contrib/pg-many-to-many": "^1.0.0",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"eslint-config-prettier": "^6.10.0",
|
|
60
|
-
"eslint-plugin-prettier": "^3.1.2",
|
|
61
|
-
"graphile-test": "0.1.0",
|
|
62
|
-
"jest": "^24.5.0",
|
|
63
|
-
"prettier": "^1.19.1",
|
|
64
|
-
"regenerator-runtime": "^0.13.2"
|
|
43
|
+
"graphile-test": "^2.8.5",
|
|
44
|
+
"graphql-tag": "2.12.6",
|
|
45
|
+
"makage": "^0.1.6",
|
|
46
|
+
"pgsql-test": "^2.14.8"
|
|
65
47
|
},
|
|
66
48
|
"dependencies": {
|
|
67
|
-
"
|
|
68
|
-
"graphile-
|
|
69
|
-
|
|
49
|
+
"graphile-build": "^4.14.1",
|
|
50
|
+
"graphile-build-pg": "^4.14.1",
|
|
51
|
+
"graphile-utils": "^4.14.1",
|
|
52
|
+
"graphql": "15.10.1"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "e4643c07b6a961b964bbb132308366fc549504a1"
|
|
70
55
|
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { Build, Options } from 'graphile-build';
|
|
2
|
+
import type { GraphQLType } from 'graphql';
|
|
3
|
+
export type Identifier = string | number;
|
|
4
|
+
export interface PgType {
|
|
5
|
+
id: Identifier;
|
|
6
|
+
name: string;
|
|
7
|
+
isPgArray: boolean;
|
|
8
|
+
arrayItemType?: PgType | null;
|
|
9
|
+
attrTypeModifier?: number | null;
|
|
10
|
+
}
|
|
11
|
+
export interface PgAttribute {
|
|
12
|
+
num: number;
|
|
13
|
+
name?: string;
|
|
14
|
+
type: PgType;
|
|
15
|
+
typeModifier: number;
|
|
16
|
+
}
|
|
17
|
+
export type ConstraintType = 'p' | 'f' | 'u' | 'c' | 'x' | string;
|
|
18
|
+
export interface PgConstraint {
|
|
19
|
+
id: Identifier;
|
|
20
|
+
name: string;
|
|
21
|
+
type: ConstraintType;
|
|
22
|
+
classId: Identifier;
|
|
23
|
+
foreignClassId?: Identifier | null;
|
|
24
|
+
foreignClass?: PgClass;
|
|
25
|
+
keyAttributes: PgAttribute[];
|
|
26
|
+
foreignKeyAttributes: PgAttribute[];
|
|
27
|
+
keyAttributeNums: number[];
|
|
28
|
+
}
|
|
29
|
+
export interface PgClass {
|
|
30
|
+
id?: Identifier;
|
|
31
|
+
name: string;
|
|
32
|
+
namespaceName: string;
|
|
33
|
+
classKind: string;
|
|
34
|
+
attributes: PgAttribute[];
|
|
35
|
+
constraints: PgConstraint[];
|
|
36
|
+
foreignConstraints: PgConstraint[];
|
|
37
|
+
primaryKeyConstraint?: PgConstraint | null;
|
|
38
|
+
}
|
|
39
|
+
export interface PgIntrospectionResultsByKind {
|
|
40
|
+
class: PgClass[];
|
|
41
|
+
classById: Record<string, PgClass>;
|
|
42
|
+
}
|
|
43
|
+
export interface PgInflection {
|
|
44
|
+
column(attr: PgAttribute): string;
|
|
45
|
+
tableType(table: PgClass): string;
|
|
46
|
+
allRows(table: PgClass): string;
|
|
47
|
+
allRowsSimple(table: PgClass): string;
|
|
48
|
+
tableFieldName(table: PgClass): string;
|
|
49
|
+
orderByType(typeName: string): string;
|
|
50
|
+
filterType?(typeName: string): string | null;
|
|
51
|
+
inputType(typeName: string): string;
|
|
52
|
+
patchType(typeName: string): string;
|
|
53
|
+
conditionType(typeName: string): string;
|
|
54
|
+
patchField(typeName: string): string;
|
|
55
|
+
edge(typeName: string): string;
|
|
56
|
+
edgeField(table: PgClass): string;
|
|
57
|
+
connection(typeName: string): string;
|
|
58
|
+
_typeName(table: PgClass): string;
|
|
59
|
+
enumType(table: PgClass): string;
|
|
60
|
+
createPayloadType(table: PgClass): string;
|
|
61
|
+
updatePayloadType(table: PgClass): string;
|
|
62
|
+
deletePayloadType(table: PgClass): string;
|
|
63
|
+
createField(table: PgClass): string;
|
|
64
|
+
createInputType(table: PgClass): string;
|
|
65
|
+
deleteByKeys(keys: PgAttribute[], table: PgClass, constraint: PgConstraint): string;
|
|
66
|
+
updateByKeys(keys: PgAttribute[], table: PgClass, constraint: PgConstraint): string;
|
|
67
|
+
singleRelationByKeys(keys: PgAttribute[], foreignTable: PgClass, table: PgClass, constraint: PgConstraint): string;
|
|
68
|
+
singleRelationByKeysBackwards(keys: PgAttribute[], table: PgClass, foreignTable: PgClass, constraint: PgConstraint): string;
|
|
69
|
+
manyRelationByKeys(keys: PgAttribute[], table: PgClass, foreignTable: PgClass, constraint: PgConstraint): string;
|
|
70
|
+
manyToManyRelationByKeys?: (leftKeyAttributes: PgAttribute[], junctionLeftKeyAttributes: PgAttribute[], junctionRightKeyAttributes: PgAttribute[], rightKeyAttributes: PgAttribute[], junctionTable: PgClass, rightTable: PgClass, junctionLeftConstraint: PgConstraint, junctionRightConstraint: PgConstraint) => string;
|
|
71
|
+
}
|
|
72
|
+
export type PgOmit = (entity: PgClass | PgConstraint | PgAttribute, action: string) => boolean;
|
|
73
|
+
export type PgBuild = Build & {
|
|
74
|
+
inflection: PgInflection;
|
|
75
|
+
pgIntrospectionResultsByKind: PgIntrospectionResultsByKind;
|
|
76
|
+
pgGetGqlTypeByTypeIdAndModifier: (typeId: Identifier, typeModifier?: number | null) => GraphQLType;
|
|
77
|
+
pgOmit: PgOmit;
|
|
78
|
+
};
|
|
79
|
+
export type SchemaOptions = Options & {
|
|
80
|
+
pgSchemas: string[];
|
|
81
|
+
};
|
|
82
|
+
export interface HasRelation {
|
|
83
|
+
referencedBy: PgClass;
|
|
84
|
+
isUnique: boolean;
|
|
85
|
+
fieldName: string;
|
|
86
|
+
type: 'hasOne' | 'hasMany';
|
|
87
|
+
keys: PgAttribute[];
|
|
88
|
+
}
|
|
89
|
+
export interface BelongsToRelation {
|
|
90
|
+
references: PgClass;
|
|
91
|
+
isUnique: boolean;
|
|
92
|
+
fieldName: string;
|
|
93
|
+
keys: PgAttribute[];
|
|
94
|
+
}
|
|
95
|
+
export interface ManyToManyRelation {
|
|
96
|
+
leftKeyAttributes: PgAttribute[];
|
|
97
|
+
junctionLeftKeyAttributes: PgAttribute[];
|
|
98
|
+
junctionRightKeyAttributes: PgAttribute[];
|
|
99
|
+
rightKeyAttributes: PgAttribute[];
|
|
100
|
+
junctionTable: PgClass;
|
|
101
|
+
rightTable: PgClass;
|
|
102
|
+
junctionLeftConstraint: PgConstraint;
|
|
103
|
+
junctionRightConstraint: PgConstraint;
|
|
104
|
+
allowsMultipleEdgesToNode: boolean;
|
|
105
|
+
}
|
package/types.js
ADDED