@kadoa/node-sdk 0.14.1 → 0.15.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/dist/index.d.mts CHANGED
@@ -670,7 +670,7 @@ interface CreateSchemaBody {
670
670
  /**
671
671
  * Entity type for the schema
672
672
  */
673
- 'entity': string;
673
+ 'entity'?: string;
674
674
  /**
675
675
  * Array of field definitions
676
676
  */
@@ -996,7 +996,7 @@ interface CreateWorkflowWithCustomSchemaBody {
996
996
  /**
997
997
  * Entity name for extraction
998
998
  */
999
- 'entity': string;
999
+ 'entity'?: string;
1000
1000
  /**
1001
1001
  * Schema fields for extraction
1002
1002
  */
@@ -2183,59 +2183,6 @@ interface V4WorkflowsWorkflowIdGet200ResponseBrowserActionsInner {
2183
2183
  'url'?: string;
2184
2184
  }
2185
2185
 
2186
- /**
2187
- * Kadoa API
2188
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2189
- *
2190
- * The version of the OpenAPI document: 3.0.0
2191
- * Contact: support@kadoa.com
2192
- *
2193
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2194
- * https://openapi-generator.tech
2195
- * Do not edit the class manually.
2196
- */
2197
- interface V4WorkflowsWorkflowIdGet200ResponseLastJobErrorsInner {
2198
- /**
2199
- * Error code identifying the type of error
2200
- */
2201
- 'errorCode'?: string;
2202
- /**
2203
- * Human-readable error message
2204
- */
2205
- 'message'?: string;
2206
- /**
2207
- * When the error occurred
2208
- */
2209
- 'timestamp'?: string;
2210
- /**
2211
- * Optional screenshot URL
2212
- */
2213
- 'screenshot'?: string;
2214
- /**
2215
- * Additional context about the error
2216
- */
2217
- 'context'?: object;
2218
- }
2219
-
2220
- /**
2221
- * Kadoa API
2222
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2223
- *
2224
- * The version of the OpenAPI document: 3.0.0
2225
- * Contact: support@kadoa.com
2226
- *
2227
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2228
- * https://openapi-generator.tech
2229
- * Do not edit the class manually.
2230
- */
2231
-
2232
- interface V4WorkflowsWorkflowIdGet200ResponseLastJob {
2233
- /**
2234
- * Errors from the last job run
2235
- */
2236
- 'errors'?: Array<V4WorkflowsWorkflowIdGet200ResponseLastJobErrorsInner>;
2237
- }
2238
-
2239
2186
  /**
2240
2187
  * Kadoa API
2241
2188
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -2345,6 +2292,76 @@ declare const V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum: {
2345
2292
  };
2346
2293
  type V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum = typeof V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum[keyof typeof V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum];
2347
2294
 
2295
+ /**
2296
+ * Kadoa API
2297
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2298
+ *
2299
+ * The version of the OpenAPI document: 3.0.0
2300
+ * Contact: support@kadoa.com
2301
+ *
2302
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2303
+ * https://openapi-generator.tech
2304
+ * Do not edit the class manually.
2305
+ */
2306
+ /**
2307
+ * Additional context about the error
2308
+ */
2309
+ interface V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInnerContext {
2310
+ [key: string]: any;
2311
+ /**
2312
+ * The URL where the error occurred
2313
+ */
2314
+ 'url'?: string;
2315
+ /**
2316
+ * HTTP status code if applicable
2317
+ */
2318
+ 'httpStatus'?: number;
2319
+ /**
2320
+ * Number of retry attempts made
2321
+ */
2322
+ 'retryCount'?: number;
2323
+ /**
2324
+ * Additional error-specific details
2325
+ */
2326
+ 'details'?: string;
2327
+ /**
2328
+ * When the error context was captured
2329
+ */
2330
+ 'timestamp'?: string;
2331
+ }
2332
+
2333
+ /**
2334
+ * Kadoa API
2335
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2336
+ *
2337
+ * The version of the OpenAPI document: 3.0.0
2338
+ * Contact: support@kadoa.com
2339
+ *
2340
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2341
+ * https://openapi-generator.tech
2342
+ * Do not edit the class manually.
2343
+ */
2344
+
2345
+ interface V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInner {
2346
+ /**
2347
+ * Error code identifying the type of error
2348
+ */
2349
+ 'errorCode'?: string;
2350
+ /**
2351
+ * Human-readable error message
2352
+ */
2353
+ 'message'?: string;
2354
+ /**
2355
+ * When the error occurred
2356
+ */
2357
+ 'timestamp'?: string;
2358
+ /**
2359
+ * Optional screenshot URL
2360
+ */
2361
+ 'screenshot'?: string;
2362
+ 'context'?: V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInnerContext;
2363
+ }
2364
+
2348
2365
  /**
2349
2366
  * Kadoa API
2350
2367
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -2455,7 +2472,10 @@ interface V4WorkflowsGet200ResponseWorkflowsInner {
2455
2472
  * Whether the schema can be edited
2456
2473
  */
2457
2474
  'isSchemaEditable'?: boolean;
2458
- 'lastJob'?: V4WorkflowsWorkflowIdGet200ResponseLastJob;
2475
+ /**
2476
+ * Errors from the last job run
2477
+ */
2478
+ 'errors'?: Array<V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInner>;
2459
2479
  'dataValidation'?: V4WorkflowsGet200ResponseWorkflowsInnerDataValidation;
2460
2480
  'validationStatistics'?: V4WorkflowsGet200ResponseWorkflowsInnerValidationStatistics;
2461
2481
  /**
@@ -2796,6 +2816,40 @@ interface V4WorkflowsWorkflowIdGet200ResponseDataValidation {
2796
2816
  'ruleCounts'?: V4WorkflowsWorkflowIdGet200ResponseDataValidationRuleCounts;
2797
2817
  }
2798
2818
 
2819
+ /**
2820
+ * Kadoa API
2821
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2822
+ *
2823
+ * The version of the OpenAPI document: 3.0.0
2824
+ * Contact: support@kadoa.com
2825
+ *
2826
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2827
+ * https://openapi-generator.tech
2828
+ * Do not edit the class manually.
2829
+ */
2830
+ interface V4WorkflowsWorkflowIdGet200ResponseErrorsInner {
2831
+ /**
2832
+ * Error code identifying the type of error
2833
+ */
2834
+ 'errorCode'?: string;
2835
+ /**
2836
+ * Human-readable error message
2837
+ */
2838
+ 'message'?: string;
2839
+ /**
2840
+ * When the error occurred
2841
+ */
2842
+ 'timestamp'?: string;
2843
+ /**
2844
+ * Optional screenshot URL
2845
+ */
2846
+ 'screenshot'?: string;
2847
+ /**
2848
+ * Additional context about the error
2849
+ */
2850
+ 'context'?: object;
2851
+ }
2852
+
2799
2853
  /**
2800
2854
  * Kadoa API
2801
2855
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -2907,7 +2961,10 @@ interface V4WorkflowsWorkflowIdGet200Response {
2907
2961
  * Database key for the workflow data
2908
2962
  */
2909
2963
  'dataKey'?: string;
2910
- 'lastJob'?: V4WorkflowsWorkflowIdGet200ResponseLastJob;
2964
+ /**
2965
+ * Errors from the last job run
2966
+ */
2967
+ 'errors'?: Array<V4WorkflowsWorkflowIdGet200ResponseErrorsInner>;
2911
2968
  /**
2912
2969
  * Cost of the last job run in credits
2913
2970
  */
@@ -3037,7 +3094,7 @@ interface V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInner {
3037
3094
  /**
3038
3095
  * Errors that occurred during the workflow run
3039
3096
  */
3040
- 'errors'?: Array<V4WorkflowsWorkflowIdGet200ResponseLastJobErrorsInner>;
3097
+ 'errors'?: Array<V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInner>;
3041
3098
  /**
3042
3099
  * Number of credits used for this workflow run
3043
3100
  */
@@ -5984,7 +6041,7 @@ interface CreateWorkflowInput {
5984
6041
  name: string;
5985
6042
  description?: string;
5986
6043
  schemaId?: string;
5987
- entity: string;
6044
+ entity?: string;
5988
6045
  fields: Array<SchemaField$1>;
5989
6046
  tags?: string[];
5990
6047
  interval?: WorkflowInterval;
@@ -6184,6 +6241,7 @@ declare class SchemaBuilder {
6184
6241
  private static readonly TYPES_REQUIRING_EXAMPLE;
6185
6242
  readonly fields: SchemaField[];
6186
6243
  entityName?: string;
6244
+ private hasSchemaFields;
6187
6245
  entity(entityName: string): this;
6188
6246
  /**
6189
6247
  * Add a structured field to the schema
@@ -6206,7 +6264,7 @@ declare class SchemaBuilder {
6206
6264
  */
6207
6265
  raw(name: RawFormat | RawFormat[]): this;
6208
6266
  build(): {
6209
- entityName: string;
6267
+ entityName?: string;
6210
6268
  fields: SchemaField[];
6211
6269
  };
6212
6270
  private validateFieldName;
@@ -6351,7 +6409,7 @@ declare class SchemasService {
6351
6409
  /**
6352
6410
  * Create a schema builder with fluent API and inline create support.
6353
6411
  */
6354
- builder(entityName: string): SchemaBuilder & {
6412
+ builder(entityName?: string): SchemaBuilder & {
6355
6413
  create(name?: string): Promise<SchemaResponse>;
6356
6414
  };
6357
6415
  /**
@@ -6697,13 +6755,13 @@ interface EntityRequestOptions {
6697
6755
  navigationMode?: string;
6698
6756
  }
6699
6757
  interface ResolvedEntity {
6700
- entity: string;
6758
+ entity?: string;
6701
6759
  fields: SchemaField$1[];
6702
6760
  }
6703
6761
  type EntityConfig = "ai-detection" | {
6704
6762
  schemaId: string;
6705
6763
  } | {
6706
- name: string;
6764
+ name?: string;
6707
6765
  fields: SchemaField$1[];
6708
6766
  };
6709
6767
  /**
package/dist/index.d.ts CHANGED
@@ -670,7 +670,7 @@ interface CreateSchemaBody {
670
670
  /**
671
671
  * Entity type for the schema
672
672
  */
673
- 'entity': string;
673
+ 'entity'?: string;
674
674
  /**
675
675
  * Array of field definitions
676
676
  */
@@ -996,7 +996,7 @@ interface CreateWorkflowWithCustomSchemaBody {
996
996
  /**
997
997
  * Entity name for extraction
998
998
  */
999
- 'entity': string;
999
+ 'entity'?: string;
1000
1000
  /**
1001
1001
  * Schema fields for extraction
1002
1002
  */
@@ -2183,59 +2183,6 @@ interface V4WorkflowsWorkflowIdGet200ResponseBrowserActionsInner {
2183
2183
  'url'?: string;
2184
2184
  }
2185
2185
 
2186
- /**
2187
- * Kadoa API
2188
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2189
- *
2190
- * The version of the OpenAPI document: 3.0.0
2191
- * Contact: support@kadoa.com
2192
- *
2193
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2194
- * https://openapi-generator.tech
2195
- * Do not edit the class manually.
2196
- */
2197
- interface V4WorkflowsWorkflowIdGet200ResponseLastJobErrorsInner {
2198
- /**
2199
- * Error code identifying the type of error
2200
- */
2201
- 'errorCode'?: string;
2202
- /**
2203
- * Human-readable error message
2204
- */
2205
- 'message'?: string;
2206
- /**
2207
- * When the error occurred
2208
- */
2209
- 'timestamp'?: string;
2210
- /**
2211
- * Optional screenshot URL
2212
- */
2213
- 'screenshot'?: string;
2214
- /**
2215
- * Additional context about the error
2216
- */
2217
- 'context'?: object;
2218
- }
2219
-
2220
- /**
2221
- * Kadoa API
2222
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2223
- *
2224
- * The version of the OpenAPI document: 3.0.0
2225
- * Contact: support@kadoa.com
2226
- *
2227
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2228
- * https://openapi-generator.tech
2229
- * Do not edit the class manually.
2230
- */
2231
-
2232
- interface V4WorkflowsWorkflowIdGet200ResponseLastJob {
2233
- /**
2234
- * Errors from the last job run
2235
- */
2236
- 'errors'?: Array<V4WorkflowsWorkflowIdGet200ResponseLastJobErrorsInner>;
2237
- }
2238
-
2239
2186
  /**
2240
2187
  * Kadoa API
2241
2188
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -2345,6 +2292,76 @@ declare const V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum: {
2345
2292
  };
2346
2293
  type V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum = typeof V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum[keyof typeof V4WorkflowsWorkflowIdGet200ResponseSchemaInnerDataTypeEnum];
2347
2294
 
2295
+ /**
2296
+ * Kadoa API
2297
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2298
+ *
2299
+ * The version of the OpenAPI document: 3.0.0
2300
+ * Contact: support@kadoa.com
2301
+ *
2302
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2303
+ * https://openapi-generator.tech
2304
+ * Do not edit the class manually.
2305
+ */
2306
+ /**
2307
+ * Additional context about the error
2308
+ */
2309
+ interface V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInnerContext {
2310
+ [key: string]: any;
2311
+ /**
2312
+ * The URL where the error occurred
2313
+ */
2314
+ 'url'?: string;
2315
+ /**
2316
+ * HTTP status code if applicable
2317
+ */
2318
+ 'httpStatus'?: number;
2319
+ /**
2320
+ * Number of retry attempts made
2321
+ */
2322
+ 'retryCount'?: number;
2323
+ /**
2324
+ * Additional error-specific details
2325
+ */
2326
+ 'details'?: string;
2327
+ /**
2328
+ * When the error context was captured
2329
+ */
2330
+ 'timestamp'?: string;
2331
+ }
2332
+
2333
+ /**
2334
+ * Kadoa API
2335
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2336
+ *
2337
+ * The version of the OpenAPI document: 3.0.0
2338
+ * Contact: support@kadoa.com
2339
+ *
2340
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2341
+ * https://openapi-generator.tech
2342
+ * Do not edit the class manually.
2343
+ */
2344
+
2345
+ interface V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInner {
2346
+ /**
2347
+ * Error code identifying the type of error
2348
+ */
2349
+ 'errorCode'?: string;
2350
+ /**
2351
+ * Human-readable error message
2352
+ */
2353
+ 'message'?: string;
2354
+ /**
2355
+ * When the error occurred
2356
+ */
2357
+ 'timestamp'?: string;
2358
+ /**
2359
+ * Optional screenshot URL
2360
+ */
2361
+ 'screenshot'?: string;
2362
+ 'context'?: V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInnerContext;
2363
+ }
2364
+
2348
2365
  /**
2349
2366
  * Kadoa API
2350
2367
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -2455,7 +2472,10 @@ interface V4WorkflowsGet200ResponseWorkflowsInner {
2455
2472
  * Whether the schema can be edited
2456
2473
  */
2457
2474
  'isSchemaEditable'?: boolean;
2458
- 'lastJob'?: V4WorkflowsWorkflowIdGet200ResponseLastJob;
2475
+ /**
2476
+ * Errors from the last job run
2477
+ */
2478
+ 'errors'?: Array<V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInner>;
2459
2479
  'dataValidation'?: V4WorkflowsGet200ResponseWorkflowsInnerDataValidation;
2460
2480
  'validationStatistics'?: V4WorkflowsGet200ResponseWorkflowsInnerValidationStatistics;
2461
2481
  /**
@@ -2796,6 +2816,40 @@ interface V4WorkflowsWorkflowIdGet200ResponseDataValidation {
2796
2816
  'ruleCounts'?: V4WorkflowsWorkflowIdGet200ResponseDataValidationRuleCounts;
2797
2817
  }
2798
2818
 
2819
+ /**
2820
+ * Kadoa API
2821
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
2822
+ *
2823
+ * The version of the OpenAPI document: 3.0.0
2824
+ * Contact: support@kadoa.com
2825
+ *
2826
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2827
+ * https://openapi-generator.tech
2828
+ * Do not edit the class manually.
2829
+ */
2830
+ interface V4WorkflowsWorkflowIdGet200ResponseErrorsInner {
2831
+ /**
2832
+ * Error code identifying the type of error
2833
+ */
2834
+ 'errorCode'?: string;
2835
+ /**
2836
+ * Human-readable error message
2837
+ */
2838
+ 'message'?: string;
2839
+ /**
2840
+ * When the error occurred
2841
+ */
2842
+ 'timestamp'?: string;
2843
+ /**
2844
+ * Optional screenshot URL
2845
+ */
2846
+ 'screenshot'?: string;
2847
+ /**
2848
+ * Additional context about the error
2849
+ */
2850
+ 'context'?: object;
2851
+ }
2852
+
2799
2853
  /**
2800
2854
  * Kadoa API
2801
2855
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -2907,7 +2961,10 @@ interface V4WorkflowsWorkflowIdGet200Response {
2907
2961
  * Database key for the workflow data
2908
2962
  */
2909
2963
  'dataKey'?: string;
2910
- 'lastJob'?: V4WorkflowsWorkflowIdGet200ResponseLastJob;
2964
+ /**
2965
+ * Errors from the last job run
2966
+ */
2967
+ 'errors'?: Array<V4WorkflowsWorkflowIdGet200ResponseErrorsInner>;
2911
2968
  /**
2912
2969
  * Cost of the last job run in credits
2913
2970
  */
@@ -3037,7 +3094,7 @@ interface V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInner {
3037
3094
  /**
3038
3095
  * Errors that occurred during the workflow run
3039
3096
  */
3040
- 'errors'?: Array<V4WorkflowsWorkflowIdGet200ResponseLastJobErrorsInner>;
3097
+ 'errors'?: Array<V4WorkflowsWorkflowIdHistoryGet200ResponseWorkflowRunsInnerErrorsInner>;
3041
3098
  /**
3042
3099
  * Number of credits used for this workflow run
3043
3100
  */
@@ -5984,7 +6041,7 @@ interface CreateWorkflowInput {
5984
6041
  name: string;
5985
6042
  description?: string;
5986
6043
  schemaId?: string;
5987
- entity: string;
6044
+ entity?: string;
5988
6045
  fields: Array<SchemaField$1>;
5989
6046
  tags?: string[];
5990
6047
  interval?: WorkflowInterval;
@@ -6184,6 +6241,7 @@ declare class SchemaBuilder {
6184
6241
  private static readonly TYPES_REQUIRING_EXAMPLE;
6185
6242
  readonly fields: SchemaField[];
6186
6243
  entityName?: string;
6244
+ private hasSchemaFields;
6187
6245
  entity(entityName: string): this;
6188
6246
  /**
6189
6247
  * Add a structured field to the schema
@@ -6206,7 +6264,7 @@ declare class SchemaBuilder {
6206
6264
  */
6207
6265
  raw(name: RawFormat | RawFormat[]): this;
6208
6266
  build(): {
6209
- entityName: string;
6267
+ entityName?: string;
6210
6268
  fields: SchemaField[];
6211
6269
  };
6212
6270
  private validateFieldName;
@@ -6351,7 +6409,7 @@ declare class SchemasService {
6351
6409
  /**
6352
6410
  * Create a schema builder with fluent API and inline create support.
6353
6411
  */
6354
- builder(entityName: string): SchemaBuilder & {
6412
+ builder(entityName?: string): SchemaBuilder & {
6355
6413
  create(name?: string): Promise<SchemaResponse>;
6356
6414
  };
6357
6415
  /**
@@ -6697,13 +6755,13 @@ interface EntityRequestOptions {
6697
6755
  navigationMode?: string;
6698
6756
  }
6699
6757
  interface ResolvedEntity {
6700
- entity: string;
6758
+ entity?: string;
6701
6759
  fields: SchemaField$1[];
6702
6760
  }
6703
6761
  type EntityConfig = "ai-detection" | {
6704
6762
  schemaId: string;
6705
6763
  } | {
6706
- name: string;
6764
+ name?: string;
6707
6765
  fields: SchemaField$1[];
6708
6766
  };
6709
6767
  /**
package/dist/index.js CHANGED
@@ -333,6 +333,9 @@ var _SchemaBuilder = class _SchemaBuilder {
333
333
  constructor() {
334
334
  this.fields = [];
335
335
  }
336
+ hasSchemaFields() {
337
+ return this.fields.some((field) => field.fieldType === "SCHEMA");
338
+ }
336
339
  entity(entityName) {
337
340
  this.entityName = entityName;
338
341
  return this;
@@ -400,11 +403,14 @@ var _SchemaBuilder = class _SchemaBuilder {
400
403
  return this;
401
404
  }
402
405
  build() {
403
- if (!this.entityName) {
404
- throw new KadoaSdkException("Entity name is required", {
405
- code: "VALIDATION_ERROR",
406
- details: { entityName: this.entityName }
407
- });
406
+ if (this.hasSchemaFields() && !this.entityName) {
407
+ throw new KadoaSdkException(
408
+ "Entity name is required when schema fields are present",
409
+ {
410
+ code: "VALIDATION_ERROR",
411
+ details: { entityName: this.entityName }
412
+ }
413
+ );
408
414
  }
409
415
  return {
410
416
  entityName: this.entityName,
@@ -4307,15 +4313,30 @@ var SchemasService = class {
4307
4313
  return new class extends SchemaBuilder {
4308
4314
  constructor() {
4309
4315
  super();
4310
- this.entity(entityName);
4316
+ if (entityName) {
4317
+ this.entity(entityName);
4318
+ }
4311
4319
  }
4312
4320
  async create(name) {
4313
4321
  const built = this.build();
4314
- return service.createSchema({
4315
- name: name || built.entityName,
4316
- entity: built.entityName,
4317
- fields: built.fields
4318
- });
4322
+ const schemaName = name ?? built.entityName;
4323
+ if (!schemaName) {
4324
+ throw new KadoaSdkException(
4325
+ "Schema name is required when entity name is not provided",
4326
+ {
4327
+ code: "VALIDATION_ERROR",
4328
+ details: { name }
4329
+ }
4330
+ );
4331
+ }
4332
+ const createSchemaBody = {
4333
+ name: schemaName,
4334
+ fields: built.fields,
4335
+ ...built.entityName ? { entity: built.entityName } : {}
4336
+ };
4337
+ return service.createSchema(
4338
+ createSchemaBody
4339
+ );
4319
4340
  }
4320
4341
  }();
4321
4342
  }
@@ -4411,8 +4432,9 @@ var EntityResolverService = class {
4411
4432
  location: options.location,
4412
4433
  navigationMode: options.navigationMode
4413
4434
  });
4435
+ const entity = entityPrediction.entity;
4414
4436
  return {
4415
- entity: entityPrediction.entity,
4437
+ entity,
4416
4438
  fields: entityPrediction.fields
4417
4439
  };
4418
4440
  } else if (entityConfig) {
@@ -4421,10 +4443,10 @@ var EntityResolverService = class {
4421
4443
  entityConfig.schemaId
4422
4444
  );
4423
4445
  return {
4424
- entity: schema.entity ?? "",
4446
+ entity: schema.entity ?? void 0,
4425
4447
  fields: schema.schema
4426
4448
  };
4427
- } else if ("name" in entityConfig && "fields" in entityConfig) {
4449
+ } else if ("fields" in entityConfig) {
4428
4450
  return {
4429
4451
  entity: entityConfig.name,
4430
4452
  fields: entityConfig.fields
@@ -4580,11 +4602,12 @@ var ExtractionService = class {
4580
4602
  }
4581
4603
  );
4582
4604
  const hasNotifications = !!config.notifications;
4583
- const result = await this.workflowsCoreService.create({
4605
+ const workflowRequest = {
4584
4606
  ...config,
4585
- entity: resolvedEntity.entity,
4586
- fields: resolvedEntity.fields
4587
- });
4607
+ fields: resolvedEntity.fields,
4608
+ ...resolvedEntity.entity !== void 0 ? { entity: resolvedEntity.entity } : {}
4609
+ };
4610
+ const result = await this.workflowsCoreService.create(workflowRequest);
4588
4611
  workflowId = result.id;
4589
4612
  if (hasNotifications) {
4590
4613
  const result2 = await this.notificationSetupService.setup({
@@ -4726,7 +4749,7 @@ var ExtractionBuilderService = class {
4726
4749
  entity = { schemaId: result.schemaId };
4727
4750
  } else {
4728
4751
  const builtSchema = result.build();
4729
- entity = { name: builtSchema.entityName, fields: builtSchema.fields };
4752
+ entity = builtSchema.entityName ? { name: builtSchema.entityName, fields: builtSchema.fields } : { fields: builtSchema.fields };
4730
4753
  }
4731
4754
  }
4732
4755
  this._options = {
@@ -4770,17 +4793,14 @@ var ExtractionBuilderService = class {
4770
4793
  async create() {
4771
4794
  assert__default.default(this._options, "Options are not set");
4772
4795
  const { urls, name, description, navigationMode, entity } = this.options;
4773
- const resolvedEntity = typeof entity === "object" && "schemaId" in entity ? void 0 : await this.entityResolverService.resolveEntity(entity, {
4774
- link: urls[0],
4775
- location: this._options.location,
4776
- navigationMode
4777
- });
4778
- if (!resolvedEntity) {
4779
- throw new KadoaSdkException(ERROR_MESSAGES.ENTITY_FETCH_FAILED, {
4780
- code: "VALIDATION_ERROR",
4781
- details: { entity }
4782
- });
4783
- }
4796
+ const resolvedEntity = await this.entityResolverService.resolveEntity(
4797
+ entity,
4798
+ {
4799
+ link: urls[0],
4800
+ location: this._options.location,
4801
+ navigationMode
4802
+ }
4803
+ );
4784
4804
  const workflow = await this.workflowsCoreService.create({
4785
4805
  urls,
4786
4806
  name,
@@ -5278,7 +5298,7 @@ var WSS_API_URI = process.env.KADOA_WSS_API_URI ?? "wss://realtime.kadoa.com";
5278
5298
  var REALTIME_API_URI = process.env.KADOA_REALTIME_API_URI ?? "https://realtime.kadoa.com";
5279
5299
 
5280
5300
  // src/version.ts
5281
- var SDK_VERSION = "0.14.1";
5301
+ var SDK_VERSION = "0.15.0";
5282
5302
  var SDK_NAME = "kadoa-node-sdk";
5283
5303
  var SDK_LANGUAGE = "node";
5284
5304