@jackchuka/gql-ingest 3.1.1 → 3.1.2
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/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/index.js +63 -63
- package/dist/cli/templates/index.d.ts +15 -0
- package/dist/cli/templates/index.d.ts.map +1 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +2 -2
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/events.d.ts +9 -9
- package/dist/lib/events.d.ts.map +1 -1
- package/dist/lib/gql-ingest.d.ts +2 -2
- package/dist/lib/gql-ingest.d.ts.map +1 -1
- package/dist/readers/jsonl.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { Logger } from "../../lib/logger";
|
|
2
2
|
export type DataFormat = "csv" | "json" | "yaml" | "jsonl";
|
|
3
|
+
export declare function isDataFormat(value: string): value is DataFormat;
|
|
4
|
+
export declare const DATA_FORMAT_CHOICES: readonly [{
|
|
5
|
+
readonly name: "CSV";
|
|
6
|
+
readonly value: "csv";
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "JSON";
|
|
9
|
+
readonly value: "json";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "YAML";
|
|
12
|
+
readonly value: "yaml";
|
|
13
|
+
}, {
|
|
14
|
+
readonly name: "JSONL";
|
|
15
|
+
readonly value: "jsonl";
|
|
16
|
+
}];
|
|
17
|
+
export declare const DEFAULT_DATA_FORMAT: DataFormat;
|
|
3
18
|
export interface EntityTemplateOptions {
|
|
4
19
|
format: DataFormat;
|
|
5
20
|
fields: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM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M,EAAE,MAAM,GAAG,IAAI,CASxE"}
|
package/dist/index.js
CHANGED
|
@@ -13885,6 +13885,10 @@ function loadConfig(configDir, logger = noopLogger) {
|
|
|
13885
13885
|
}
|
|
13886
13886
|
const fileContents = fs.readFileSync(configPath, "utf8");
|
|
13887
13887
|
const yamlConfig = yaml.load(fileContents);
|
|
13888
|
+
if (yamlConfig === null || typeof yamlConfig !== "object" || Array.isArray(yamlConfig)) {
|
|
13889
|
+
logger.warn("Warning: config.yaml is not a valid object. Using defaults.");
|
|
13890
|
+
return DEFAULT_CONFIG;
|
|
13891
|
+
}
|
|
13888
13892
|
return mergeWithDefaults(yamlConfig);
|
|
13889
13893
|
} catch (error48) {
|
|
13890
13894
|
const errorMessage = error48 instanceof Error ? error48.message : String(error48);
|
|
@@ -14035,7 +14039,7 @@ var GraphQLClientWrapper = class {
|
|
|
14035
14039
|
// src/lib/mapper.ts
|
|
14036
14040
|
import fs6 from "fs";
|
|
14037
14041
|
import path2 from "path";
|
|
14038
|
-
import { parse as parse3 } from "graphql";
|
|
14042
|
+
import { parse as parse3, Kind } from "graphql";
|
|
14039
14043
|
|
|
14040
14044
|
// src/readers/data-reader.ts
|
|
14041
14045
|
var DataReader = class {
|
|
@@ -14147,10 +14151,7 @@ var JsonlReader = class extends DataReader {
|
|
|
14147
14151
|
const data = JSON.parse(lines[i]);
|
|
14148
14152
|
results.push(data);
|
|
14149
14153
|
} catch (error48) {
|
|
14150
|
-
|
|
14151
|
-
throw new Error(
|
|
14152
|
-
`Invalid JSON at line ${i + 1} in file: ${filePath}. Error: ${errorMessage}`
|
|
14153
|
-
);
|
|
14154
|
+
throw error48 instanceof Error ? new Error(`Invalid JSON at line ${i + 1} in file: ${filePath}: ${error48.message}`) : error48;
|
|
14154
14155
|
}
|
|
14155
14156
|
}
|
|
14156
14157
|
return results;
|
|
@@ -14616,7 +14617,7 @@ var DataMapper = class {
|
|
|
14616
14617
|
try {
|
|
14617
14618
|
const document = parse3(mutation);
|
|
14618
14619
|
for (const definition of document.definitions) {
|
|
14619
|
-
if (definition.kind ===
|
|
14620
|
+
if (definition.kind === Kind.OPERATION_DEFINITION && definition.variableDefinitions) {
|
|
14620
14621
|
for (const variableDef of definition.variableDefinitions) {
|
|
14621
14622
|
const varName = variableDef.variable.name.value;
|
|
14622
14623
|
const typeName = this.extractTypeName(variableDef);
|
|
@@ -14634,11 +14635,11 @@ var DataMapper = class {
|
|
|
14634
14635
|
}
|
|
14635
14636
|
extractTypeName(variableDef) {
|
|
14636
14637
|
const type = variableDef.type;
|
|
14637
|
-
if (type.kind ===
|
|
14638
|
-
if (type.type.kind ===
|
|
14638
|
+
if (type.kind === Kind.NON_NULL_TYPE) {
|
|
14639
|
+
if (type.type.kind === Kind.NAMED_TYPE) {
|
|
14639
14640
|
return type.type.name.value;
|
|
14640
14641
|
}
|
|
14641
|
-
} else if (type.kind ===
|
|
14642
|
+
} else if (type.kind === Kind.NAMED_TYPE) {
|
|
14642
14643
|
return type.name.value;
|
|
14643
14644
|
}
|
|
14644
14645
|
return null;
|
|
@@ -14819,9 +14820,9 @@ var GQLIngest = class extends EventEmitter {
|
|
|
14819
14820
|
/**
|
|
14820
14821
|
* Safely emit an event, catching any errors from listeners
|
|
14821
14822
|
*/
|
|
14822
|
-
safeEmit(event, payload) {
|
|
14823
|
+
safeEmit(event, ...payload) {
|
|
14823
14824
|
try {
|
|
14824
|
-
return this.emit(event, payload);
|
|
14825
|
+
return this.emit(event, ...payload);
|
|
14825
14826
|
} catch (error48) {
|
|
14826
14827
|
this.logger.error(`Error in event listener for '${String(event)}':`, error48);
|
|
14827
14828
|
return false;
|