@eide/foir-cli 0.1.15 → 0.1.17
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/codegen/field-mapping.d.ts +1 -0
- package/dist/codegen/field-mapping.d.ts.map +1 -1
- package/dist/codegen/field-mapping.js +8 -0
- package/dist/codegen/generators/customer-profile-hooks.d.ts +5 -0
- package/dist/codegen/generators/customer-profile-hooks.d.ts.map +1 -0
- package/dist/codegen/generators/customer-profile-hooks.js +78 -0
- package/dist/codegen/generators/customer-profile-loaders.d.ts +5 -0
- package/dist/codegen/generators/customer-profile-loaders.d.ts.map +1 -0
- package/dist/codegen/generators/customer-profile-loaders.js +67 -0
- package/dist/codegen/generators/customer-profile-operations.d.ts +5 -0
- package/dist/codegen/generators/customer-profile-operations.d.ts.map +1 -0
- package/dist/codegen/generators/customer-profile-operations.js +126 -0
- package/dist/codegen/generators/public-schema-content.d.ts +14 -0
- package/dist/codegen/generators/public-schema-content.d.ts.map +1 -0
- package/dist/codegen/generators/public-schema-content.js +22 -0
- package/dist/codegen/generators/react-hooks-index.d.ts +6 -0
- package/dist/codegen/generators/react-hooks-index.d.ts.map +1 -0
- package/dist/codegen/generators/react-hooks-index.js +20 -0
- package/dist/codegen/generators/react-hooks.d.ts +7 -0
- package/dist/codegen/generators/react-hooks.d.ts.map +1 -0
- package/dist/codegen/generators/react-hooks.js +139 -0
- package/dist/codegen/generators/remix-loaders-index.d.ts +6 -0
- package/dist/codegen/generators/remix-loaders-index.d.ts.map +1 -0
- package/dist/codegen/generators/remix-loaders-index.js +20 -0
- package/dist/codegen/generators/remix-loaders.d.ts +7 -0
- package/dist/codegen/generators/remix-loaders.d.ts.map +1 -0
- package/dist/codegen/generators/remix-loaders.js +107 -0
- package/dist/codegen/generators/static-documents.d.ts +14 -0
- package/dist/codegen/generators/static-documents.d.ts.map +1 -0
- package/dist/codegen/generators/static-documents.js +728 -0
- package/dist/codegen/generators/swift-field-types.d.ts.map +1 -1
- package/dist/codegen/generators/swift-field-types.js +22 -16
- package/dist/codegen/generators/typed-operations-common.d.ts +6 -0
- package/dist/codegen/generators/typed-operations-common.d.ts.map +1 -0
- package/dist/codegen/generators/typed-operations-common.js +74 -0
- package/dist/codegen/generators/typed-operations-index.d.ts +6 -0
- package/dist/codegen/generators/typed-operations-index.d.ts.map +1 -0
- package/dist/codegen/generators/typed-operations-index.js +22 -0
- package/dist/codegen/generators/typed-operations.d.ts +11 -0
- package/dist/codegen/generators/typed-operations.d.ts.map +1 -0
- package/dist/codegen/generators/typed-operations.js +251 -0
- package/dist/codegen/swift-field-mapping.js +1 -1
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +135 -25
- package/dist/config/pull-config.d.ts +6 -0
- package/dist/config/pull-config.d.ts.map +1 -1
- package/dist/config/pull-config.js +50 -1
- package/dist/config/types.d.ts +23 -0
- package/dist/config/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates per-model Remix loader functions.
|
|
3
|
+
* Each function is a typed async wrapper over a generic GraphQL client.
|
|
4
|
+
*/
|
|
5
|
+
import { toPascalCase, toUpperSnakeCase } from '../field-mapping.js';
|
|
6
|
+
export function generateRemixLoaders(model) {
|
|
7
|
+
const typeName = toPascalCase(model.key);
|
|
8
|
+
const upperSnake = toUpperSnakeCase(model.key);
|
|
9
|
+
const pluralName = model.pluralName
|
|
10
|
+
? toPascalCase(model.pluralName.replace(/\s+/g, ''))
|
|
11
|
+
: `${typeName}s`;
|
|
12
|
+
const pluralUpperSnake = model.pluralName
|
|
13
|
+
? toUpperSnakeCase(model.pluralName.replace(/\s+/g, ''))
|
|
14
|
+
: `${upperSnake}S`;
|
|
15
|
+
return `/**
|
|
16
|
+
* Remix / server-side loader functions for ${model.name ?? model.key}
|
|
17
|
+
*
|
|
18
|
+
* @generated by foir — DO NOT EDIT MANUALLY
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
GET_${upperSnake},
|
|
23
|
+
GET_${upperSnake}_BY_KEY,
|
|
24
|
+
LIST_${pluralUpperSnake},
|
|
25
|
+
CREATE_${upperSnake},
|
|
26
|
+
UPDATE_${upperSnake},
|
|
27
|
+
DELETE_${upperSnake},
|
|
28
|
+
PUBLISH_${upperSnake}_VERSION,
|
|
29
|
+
UNPUBLISH_${upperSnake},
|
|
30
|
+
} from '../operations/${model.key}.js';
|
|
31
|
+
import type {
|
|
32
|
+
Get${typeName}Variables,
|
|
33
|
+
Get${typeName}Result,
|
|
34
|
+
Get${typeName}ByKeyVariables,
|
|
35
|
+
Get${typeName}ByKeyResult,
|
|
36
|
+
List${pluralName}Variables,
|
|
37
|
+
List${pluralName}Result,
|
|
38
|
+
Create${typeName}Variables,
|
|
39
|
+
Create${typeName}Result,
|
|
40
|
+
Update${typeName}Variables,
|
|
41
|
+
Update${typeName}Result,
|
|
42
|
+
Delete${typeName}Variables,
|
|
43
|
+
Delete${typeName}Result,
|
|
44
|
+
} from '../operations/${model.key}.js';
|
|
45
|
+
|
|
46
|
+
/** A minimal GraphQL client interface (works with graphql-request, urql, or custom). */
|
|
47
|
+
export interface GraphQLClient {
|
|
48
|
+
request<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function get${typeName}(
|
|
52
|
+
client: GraphQLClient,
|
|
53
|
+
variables: Get${typeName}Variables
|
|
54
|
+
): Promise<Get${typeName}Result> {
|
|
55
|
+
return client.request<Get${typeName}Result>(GET_${upperSnake}, variables as Record<string, unknown>);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function get${typeName}ByKey(
|
|
59
|
+
client: GraphQLClient,
|
|
60
|
+
variables: Get${typeName}ByKeyVariables
|
|
61
|
+
): Promise<Get${typeName}ByKeyResult> {
|
|
62
|
+
return client.request<Get${typeName}ByKeyResult>(GET_${upperSnake}_BY_KEY, variables as Record<string, unknown>);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export async function list${pluralName}(
|
|
66
|
+
client: GraphQLClient,
|
|
67
|
+
variables?: List${pluralName}Variables
|
|
68
|
+
): Promise<List${pluralName}Result> {
|
|
69
|
+
return client.request<List${pluralName}Result>(LIST_${pluralUpperSnake}, variables as Record<string, unknown>);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export async function create${typeName}(
|
|
73
|
+
client: GraphQLClient,
|
|
74
|
+
variables: Create${typeName}Variables
|
|
75
|
+
): Promise<Create${typeName}Result> {
|
|
76
|
+
return client.request<Create${typeName}Result>(CREATE_${upperSnake}, variables as Record<string, unknown>);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function update${typeName}(
|
|
80
|
+
client: GraphQLClient,
|
|
81
|
+
variables: Update${typeName}Variables
|
|
82
|
+
): Promise<Update${typeName}Result> {
|
|
83
|
+
return client.request<Update${typeName}Result>(UPDATE_${upperSnake}, variables as Record<string, unknown>);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function delete${typeName}(
|
|
87
|
+
client: GraphQLClient,
|
|
88
|
+
variables: Delete${typeName}Variables
|
|
89
|
+
): Promise<Delete${typeName}Result> {
|
|
90
|
+
return client.request<Delete${typeName}Result>(DELETE_${upperSnake}, variables as Record<string, unknown>);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export async function publish${typeName}Version(
|
|
94
|
+
client: GraphQLClient,
|
|
95
|
+
versionId: string
|
|
96
|
+
): Promise<{ publishVersion: boolean }> {
|
|
97
|
+
return client.request<{ publishVersion: boolean }>(PUBLISH_${upperSnake}_VERSION, { versionId });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function unpublish${typeName}(
|
|
101
|
+
client: GraphQLClient,
|
|
102
|
+
id: string
|
|
103
|
+
): Promise<{ unpublishRecord: boolean }> {
|
|
104
|
+
return client.request<{ unpublishRecord: boolean }>(UNPUBLISH_${upperSnake}, { id });
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates static .graphql files for non-model API domains.
|
|
3
|
+
* These cover ~80% of the public API that has no model-specific typing.
|
|
4
|
+
*/
|
|
5
|
+
import type { DomainConfig } from '../../config/types.js';
|
|
6
|
+
export interface StaticDocumentFile {
|
|
7
|
+
filename: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generate static domain .graphql files based on enabled domains.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateStaticDocuments(domains: Required<DomainConfig>): StaticDocumentFile[];
|
|
14
|
+
//# sourceMappingURL=static-documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"static-documents.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/static-documents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAssB1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,GAC9B,kBAAkB,EAAE,CAetB"}
|