@pgpmjs/migrate-client 0.1.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 (51) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +112 -0
  3. package/esm/index.d.ts +1 -0
  4. package/esm/index.js +1 -0
  5. package/esm/migrate/index.d.ts +5 -0
  6. package/esm/migrate/index.js +5 -0
  7. package/esm/migrate/orm/client.d.ts +55 -0
  8. package/esm/migrate/orm/client.js +99 -0
  9. package/esm/migrate/orm/index.d.ts +48 -0
  10. package/esm/migrate/orm/index.js +45 -0
  11. package/esm/migrate/orm/input-types.d.ts +513 -0
  12. package/esm/migrate/orm/input-types.js +2 -0
  13. package/esm/migrate/orm/models/index.d.ts +7 -0
  14. package/esm/migrate/orm/models/index.js +7 -0
  15. package/esm/migrate/orm/models/migrateFile.d.ts +56 -0
  16. package/esm/migrate/orm/models/migrateFile.js +94 -0
  17. package/esm/migrate/orm/models/sqlAction.d.ts +56 -0
  18. package/esm/migrate/orm/models/sqlAction.js +94 -0
  19. package/esm/migrate/orm/mutation/index.d.ts +27 -0
  20. package/esm/migrate/orm/mutation/index.js +30 -0
  21. package/esm/migrate/orm/query-builder.d.ts +91 -0
  22. package/esm/migrate/orm/query-builder.js +572 -0
  23. package/esm/migrate/orm/select-types.d.ts +103 -0
  24. package/esm/migrate/orm/select-types.js +1 -0
  25. package/esm/migrate/orm/types.d.ts +6 -0
  26. package/esm/migrate/orm/types.js +7 -0
  27. package/index.d.ts +1 -0
  28. package/index.js +17 -0
  29. package/migrate/index.d.ts +5 -0
  30. package/migrate/index.js +21 -0
  31. package/migrate/orm/client.d.ts +55 -0
  32. package/migrate/orm/client.js +105 -0
  33. package/migrate/orm/index.d.ts +48 -0
  34. package/migrate/orm/index.js +66 -0
  35. package/migrate/orm/input-types.d.ts +513 -0
  36. package/migrate/orm/input-types.js +5 -0
  37. package/migrate/orm/models/index.d.ts +7 -0
  38. package/migrate/orm/models/index.js +12 -0
  39. package/migrate/orm/models/migrateFile.d.ts +56 -0
  40. package/migrate/orm/models/migrateFile.js +98 -0
  41. package/migrate/orm/models/sqlAction.d.ts +56 -0
  42. package/migrate/orm/models/sqlAction.js +98 -0
  43. package/migrate/orm/mutation/index.d.ts +27 -0
  44. package/migrate/orm/mutation/index.js +33 -0
  45. package/migrate/orm/query-builder.d.ts +91 -0
  46. package/migrate/orm/query-builder.js +619 -0
  47. package/migrate/orm/select-types.d.ts +103 -0
  48. package/migrate/orm/select-types.js +2 -0
  49. package/migrate/orm/types.d.ts +6 -0
  50. package/migrate/orm/types.js +23 -0
  51. package/package.json +53 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Type utilities for select inference
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ export interface ConnectionResult<T> {
7
+ nodes: T[];
8
+ totalCount: number;
9
+ pageInfo: PageInfo;
10
+ }
11
+ export interface PageInfo {
12
+ hasNextPage: boolean;
13
+ hasPreviousPage: boolean;
14
+ startCursor?: string | null;
15
+ endCursor?: string | null;
16
+ }
17
+ export interface FindManyArgs<TSelect, TWhere, TCondition = never, TOrderBy = never> {
18
+ select?: TSelect;
19
+ where?: TWhere;
20
+ condition?: TCondition;
21
+ orderBy?: TOrderBy[];
22
+ first?: number;
23
+ last?: number;
24
+ after?: string;
25
+ before?: string;
26
+ offset?: number;
27
+ }
28
+ export interface FindFirstArgs<TSelect, TWhere, TCondition = never> {
29
+ select?: TSelect;
30
+ where?: TWhere;
31
+ condition?: TCondition;
32
+ }
33
+ export interface CreateArgs<TSelect, TData> {
34
+ data: TData;
35
+ select?: TSelect;
36
+ }
37
+ export interface UpdateArgs<TSelect, TWhere, TData> {
38
+ where: TWhere;
39
+ data: TData;
40
+ select?: TSelect;
41
+ }
42
+ export type FindOneArgs<TSelect, TIdName extends string = 'id', TId = string> = {
43
+ select?: TSelect;
44
+ } & Record<TIdName, TId>;
45
+ export interface DeleteArgs<TWhere, TSelect = undefined> {
46
+ where: TWhere;
47
+ select?: TSelect;
48
+ }
49
+ type DepthLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
50
+ type DecrementDepth = {
51
+ 0: 0;
52
+ 1: 0;
53
+ 2: 1;
54
+ 3: 2;
55
+ 4: 3;
56
+ 5: 4;
57
+ 6: 5;
58
+ 7: 6;
59
+ 8: 7;
60
+ 9: 8;
61
+ 10: 9;
62
+ };
63
+ /**
64
+ * Recursively validates select objects, rejecting unknown keys.
65
+ *
66
+ * NOTE: Depth is intentionally capped to avoid circular-instantiation issues
67
+ * in very large cyclic schemas.
68
+ */
69
+ export type DeepExact<T, Shape, Depth extends DepthLevel = 10> = Depth extends 0 ? T extends Shape ? T : never : T extends Shape ? Exclude<keyof T, keyof Shape> extends never ? {
70
+ [K in keyof T]: K extends keyof Shape ? T[K] extends {
71
+ select: infer NS;
72
+ } ? Extract<Shape[K], {
73
+ select?: unknown;
74
+ }> extends {
75
+ select?: infer ShapeNS;
76
+ } ? DeepExact<Omit<T[K], 'select'> & {
77
+ select: DeepExact<NS, NonNullable<ShapeNS>, DecrementDepth[Depth]>;
78
+ }, Extract<Shape[K], {
79
+ select?: unknown;
80
+ }>, DecrementDepth[Depth]> : never : T[K] : never;
81
+ } : never : never;
82
+ /**
83
+ * Enforces exact select shape while keeping contextual typing on `S extends XxxSelect`.
84
+ * Use this as an intersection in overloads:
85
+ * `{ select: S } & StrictSelect<S, XxxSelect>`.
86
+ */
87
+ export type StrictSelect<S, Shape> = S extends DeepExact<S, Shape> ? {} : never;
88
+ /**
89
+ * Hook-optimized strict select variant.
90
+ *
91
+ * Uses a shallower recursion depth to keep editor autocomplete responsive
92
+ * in large schemas while still validating common nested-select mistakes.
93
+ */
94
+ export type HookStrictSelect<S, Shape> = S extends DeepExact<S, Shape, 5> ? {} : never;
95
+ /**
96
+ * Infer result type from select configuration
97
+ */
98
+ export type InferSelectResult<TEntity, TSelect> = TSelect extends undefined ? TEntity : {
99
+ [K in keyof TSelect as TSelect[K] extends false | undefined ? never : K]: TSelect[K] extends true ? K extends keyof TEntity ? TEntity[K] : never : TSelect[K] extends {
100
+ select: infer NestedSelect;
101
+ } ? K extends keyof TEntity ? NonNullable<TEntity[K]> extends ConnectionResult<infer NodeType> ? ConnectionResult<InferSelectResult<NodeType, NestedSelect>> : InferSelectResult<NonNullable<TEntity[K]>, NestedSelect> | (null extends TEntity[K] ? null : never) : never : K extends keyof TEntity ? TEntity[K] : never;
102
+ };
103
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Types re-export
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ export * from './input-types';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * Types re-export
4
+ * @generated by @constructive-io/graphql-codegen
5
+ * DO NOT EDIT - changes will be overwritten
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ // Re-export all types from input-types
23
+ __exportStar(require("./input-types"), exports);
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@pgpmjs/migrate-client",
3
+ "version": "0.1.0",
4
+ "author": "Constructive <developers@constructive.io>",
5
+ "description": "Typed GraphQL ORM client for the Constructive Migrate API (db_migrate schema)",
6
+ "main": "index.js",
7
+ "module": "esm/index.js",
8
+ "types": "index.d.ts",
9
+ "homepage": "https://github.com/constructive-io/constructive",
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "directory": "dist"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/constructive-io/constructive"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/constructive-io/constructive/issues"
21
+ },
22
+ "scripts": {
23
+ "clean": "makage clean",
24
+ "prepack": "npm run build",
25
+ "build": "makage build",
26
+ "build:dev": "makage build --dev",
27
+ "generate": "pnpm --filter @constructive-io/sdk run generate:migrate-client",
28
+ "lint": "eslint . --fix",
29
+ "test": "jest --passWithNoTests",
30
+ "test:watch": "jest --watch"
31
+ },
32
+ "keywords": [
33
+ "graphql",
34
+ "sdk",
35
+ "orm",
36
+ "constructive",
37
+ "migrate",
38
+ "db_migrate",
39
+ "pgpm"
40
+ ],
41
+ "dependencies": {
42
+ "@0no-co/graphql.web": "^1.1.2",
43
+ "@constructive-io/graphql-types": "^3.3.4",
44
+ "gql-ast": "^3.3.3",
45
+ "graphql": "^16.13.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.19.11",
49
+ "makage": "^0.1.12",
50
+ "typescript": "^5.9.3"
51
+ },
52
+ "gitHead": "9f3837555601b15e693ae0b750124fb0a8df3176"
53
+ }