@jackchuka/gql-ingest 3.0.0 → 3.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.
- package/README.md +98 -51
- package/dist/cli/commands/add.d.ts +3 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/index.js +159 -108
- package/dist/cli/templates/index.d.ts +14 -0
- package/dist/cli/templates/index.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13937 -112
- package/dist/index.js.map +4 -4
- package/dist/lib/config-schema.d.ts +103 -0
- package/dist/lib/config-schema.d.ts.map +1 -0
- package/dist/lib/config.d.ts +7 -31
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/logger.d.ts +5 -3
- package/dist/lib/logger.d.ts.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -40,8 +40,102 @@ pnpm install
|
|
|
40
40
|
pnpm run build
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
Initialize a new configuration and start ingesting data in minutes:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Create a new configuration directory
|
|
49
|
+
gql-ingest init ./my-config
|
|
50
|
+
|
|
51
|
+
# Add a new entity
|
|
52
|
+
gql-ingest add users -p ./my-config -f json --fields "id,name,email"
|
|
53
|
+
|
|
54
|
+
# Run ingestion
|
|
55
|
+
gql-ingest -e https://your-api.com/graphql -c ./my-config
|
|
56
|
+
```
|
|
57
|
+
|
|
43
58
|
## Usage
|
|
44
59
|
|
|
60
|
+
### CLI Commands
|
|
61
|
+
|
|
62
|
+
#### Initialize Configuration
|
|
63
|
+
|
|
64
|
+
Create a new configuration directory with example files:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gql-ingest init [path] [options]
|
|
68
|
+
|
|
69
|
+
Options:
|
|
70
|
+
--no-example Skip creating example entity files
|
|
71
|
+
--no-config Skip creating config.yaml
|
|
72
|
+
-f, --force Overwrite existing files
|
|
73
|
+
-q, --quiet Suppress output
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This creates:
|
|
77
|
+
|
|
78
|
+
- `data/` - Data files directory
|
|
79
|
+
- `graphql/` - GraphQL mutation files
|
|
80
|
+
- `mappings/` - Mapping configuration files
|
|
81
|
+
- `config.yaml` - Processing configuration
|
|
82
|
+
- Example entity files (by default)
|
|
83
|
+
|
|
84
|
+
#### Add Entity
|
|
85
|
+
|
|
86
|
+
Add a new entity to an existing configuration:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
gql-ingest add <entity-name> [options]
|
|
90
|
+
|
|
91
|
+
Options:
|
|
92
|
+
-p, --path <path> Config directory path (default: current directory)
|
|
93
|
+
-f, --format <format> Data format (csv, json, yaml, jsonl)
|
|
94
|
+
--fields <fields> Comma-separated field names
|
|
95
|
+
--mutation <name> GraphQL mutation name
|
|
96
|
+
--no-interactive Skip prompts, use defaults only
|
|
97
|
+
-q, --quiet Suppress output
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Interactive mode prompts for format, fields, and mutation name. Use `--no-interactive` with flags for CI/CD.
|
|
101
|
+
|
|
102
|
+
#### Run Ingestion
|
|
103
|
+
|
|
104
|
+
Ingest data from configuration into GraphQL API:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
gql-ingest [options]
|
|
108
|
+
|
|
109
|
+
Options:
|
|
110
|
+
-e, --endpoint <url> GraphQL endpoint URL (required)
|
|
111
|
+
-c, --config <path> Path to configuration directory (required)
|
|
112
|
+
-n, --entities <list> Comma-separated list of entities to process
|
|
113
|
+
-h, --headers <headers> JSON string of headers
|
|
114
|
+
-f, --format <format> Override data format detection
|
|
115
|
+
-q, --quiet Suppress output
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### CLI Examples
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Basic usage
|
|
122
|
+
gql-ingest \
|
|
123
|
+
-e https://your-graphql-api.com/graphql \
|
|
124
|
+
-c ./examples/demo
|
|
125
|
+
|
|
126
|
+
# With authentication headers
|
|
127
|
+
gql-ingest \
|
|
128
|
+
-e https://your-graphql-api.com/graphql \
|
|
129
|
+
-c ./examples/demo \
|
|
130
|
+
-h '{"Authorization": "Bearer YOUR_TOKEN"}'
|
|
131
|
+
|
|
132
|
+
# Process specific entities only
|
|
133
|
+
gql-ingest \
|
|
134
|
+
-e https://your-graphql-api.com/graphql \
|
|
135
|
+
-c ./examples/demo \
|
|
136
|
+
-n users,products
|
|
137
|
+
```
|
|
138
|
+
|
|
45
139
|
### Programmatic API
|
|
46
140
|
|
|
47
141
|
GQL Ingest provides a full programmatic API for integration into your Node.js applications.
|
|
@@ -63,7 +157,7 @@ const client = new GQLIngest({
|
|
|
63
157
|
headers: {
|
|
64
158
|
Authorization: "Bearer YOUR_TOKEN",
|
|
65
159
|
},
|
|
66
|
-
logger: createConsoleLogger(), // Optional: enable
|
|
160
|
+
logger: createConsoleLogger({ prefix: "my-app" }), // Optional: enable logging with prefix
|
|
67
161
|
});
|
|
68
162
|
|
|
69
163
|
// Ingest all data from a configuration
|
|
@@ -152,7 +246,9 @@ const client = new GQLIngest({
|
|
|
152
246
|
client.on("started", (p) => console.log(`Starting ${p.totalEntities} entities`));
|
|
153
247
|
client.on("progress", (p) => console.log(`${p.progressPercent.toFixed(1)}% complete`));
|
|
154
248
|
client.on("entityStart", (p) => console.log(`Processing ${p.entityName}`));
|
|
155
|
-
client.on("entityComplete", (p) =>
|
|
249
|
+
client.on("entityComplete", (p) =>
|
|
250
|
+
console.log(`${p.entityName}: ${p.metrics.successfulRows} rows`),
|
|
251
|
+
);
|
|
156
252
|
client.on("rowSuccess", (p) => console.log(`Row ${p.rowIndex} OK`));
|
|
157
253
|
client.on("rowFailure", (p) => console.error(`Row ${p.rowIndex} failed: ${p.error.message}`));
|
|
158
254
|
client.on("finished", (p) => console.log(`Done in ${p.durationMs}ms`));
|
|
@@ -220,55 +316,6 @@ import type {
|
|
|
220
316
|
} from "@jackchuka/gql-ingest";
|
|
221
317
|
```
|
|
222
318
|
|
|
223
|
-
### CLI Options
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
gql-ingest [options]
|
|
227
|
-
|
|
228
|
-
Options:
|
|
229
|
-
-V, --version output the version number
|
|
230
|
-
-e, --endpoint <url> GraphQL endpoint URL (required)
|
|
231
|
-
-c, --config <path> Path to configuration directory (required)
|
|
232
|
-
-n, --entities <list> Comma-separated list of specific entities to process
|
|
233
|
-
-h, --headers <headers> JSON string of headers to include in requests
|
|
234
|
-
-f, --format <format> Override data format detection (csv, json, yaml, jsonl)
|
|
235
|
-
-v, --verbose Show detailed request results and responses
|
|
236
|
-
--help display help for command
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Examples
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
# Basic usage
|
|
243
|
-
npx @jackchuka/gql-ingest \
|
|
244
|
-
--endpoint https://your-graphql-api.com/graphql \
|
|
245
|
-
--config ./examples/demo
|
|
246
|
-
|
|
247
|
-
# With authentication headers
|
|
248
|
-
npx @jackchuka/gql-ingest \
|
|
249
|
-
--endpoint https://your-graphql-api.com/graphql \
|
|
250
|
-
--config ./examples/demo \
|
|
251
|
-
--headers '{"Authorization": "Bearer YOUR_TOKEN"}'
|
|
252
|
-
|
|
253
|
-
# With custom headers
|
|
254
|
-
npx @jackchuka/gql-ingest \
|
|
255
|
-
--endpoint https://api.example.com/graphql \
|
|
256
|
-
--config ./my-config \
|
|
257
|
-
--headers '{"X-API-Key": "your-api-key", "Content-Type": "application/json"}'
|
|
258
|
-
|
|
259
|
-
# Process specific entities only
|
|
260
|
-
npx @jackchuka/gql-ingest \
|
|
261
|
-
--endpoint https://your-graphql-api.com/graphql \
|
|
262
|
-
--config ./examples/demo \
|
|
263
|
-
--entities users,products
|
|
264
|
-
|
|
265
|
-
# Process a single entity
|
|
266
|
-
npx @jackchuka/gql-ingest \
|
|
267
|
-
--endpoint https://your-graphql-api.com/graphql \
|
|
268
|
-
--config ./examples/demo \
|
|
269
|
-
--entities items
|
|
270
|
-
```
|
|
271
|
-
|
|
272
319
|
## Parallel Processing 🚀
|
|
273
320
|
|
|
274
321
|
GQL Ingest supports advanced parallel processing with dependency management for high-performance data ingestion:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkGzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuC1D"}
|