@kadoa/node-sdk 0.12.1 → 0.13.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.ts CHANGED
@@ -648,6 +648,36 @@ type ExtractionSchemaFieldDataTypeEnum = typeof ExtractionSchemaFieldDataTypeEnu
648
648
  */
649
649
  type SchemaResponseSchemaInner = ExtractionClassificationField | ExtractionMetadataField | ExtractionSchemaField;
650
650
 
651
+ /**
652
+ * Kadoa API
653
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
654
+ *
655
+ * The version of the OpenAPI document: 3.0.0
656
+ * Contact: support@kadoa.com
657
+ *
658
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
659
+ * https://openapi-generator.tech
660
+ * Do not edit the class manually.
661
+ */
662
+
663
+ /**
664
+ * Request body for creating a new schema
665
+ */
666
+ interface CreateSchemaBody {
667
+ /**
668
+ * Name of the schema
669
+ */
670
+ 'name': string;
671
+ /**
672
+ * Entity type for the schema
673
+ */
674
+ 'entity': string;
675
+ /**
676
+ * Array of field definitions
677
+ */
678
+ 'fields': Array<SchemaResponseSchemaInner>;
679
+ }
680
+
651
681
  /**
652
682
  * Kadoa API
653
683
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -1651,6 +1681,74 @@ interface ScheduleValidationResponse {
1651
1681
  'createdAt': string;
1652
1682
  }
1653
1683
 
1684
+ /**
1685
+ * Kadoa API
1686
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1687
+ *
1688
+ * The version of the OpenAPI document: 3.0.0
1689
+ * Contact: support@kadoa.com
1690
+ *
1691
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1692
+ * https://openapi-generator.tech
1693
+ * Do not edit the class manually.
1694
+ */
1695
+ /**
1696
+ * Schema description metadata
1697
+ */
1698
+ interface SchemaResponseDescription {
1699
+ /**
1700
+ * Hint text for the schema
1701
+ */
1702
+ 'hintText': string;
1703
+ }
1704
+
1705
+ /**
1706
+ * Kadoa API
1707
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1708
+ *
1709
+ * The version of the OpenAPI document: 3.0.0
1710
+ * Contact: support@kadoa.com
1711
+ *
1712
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1713
+ * https://openapi-generator.tech
1714
+ * Do not edit the class manually.
1715
+ */
1716
+
1717
+ /**
1718
+ * Schema object response
1719
+ */
1720
+ interface SchemaResponse {
1721
+ /**
1722
+ * Unique identifier for the schema
1723
+ */
1724
+ 'id': string;
1725
+ /**
1726
+ * Name of the schema
1727
+ */
1728
+ 'name': string;
1729
+ /**
1730
+ * Schema type (always NEO)
1731
+ */
1732
+ 'type': SchemaResponseTypeEnum;
1733
+ /**
1734
+ * Whether the schema is public
1735
+ */
1736
+ 'isPublic': boolean;
1737
+ /**
1738
+ * Array of field definitions
1739
+ */
1740
+ 'schema': Array<SchemaResponseSchemaInner>;
1741
+ /**
1742
+ * Entity type for the schema
1743
+ */
1744
+ 'entity': string | null;
1745
+ 'description': SchemaResponseDescription;
1746
+ }
1747
+ declare const SchemaResponseTypeEnum: {
1748
+ readonly Neo: "NEO";
1749
+ };
1750
+ type SchemaResponseTypeEnum = typeof SchemaResponseTypeEnum[keyof typeof SchemaResponseTypeEnum];
1751
+
1654
1752
  /**
1655
1753
  * Kadoa API
1656
1754
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -1710,6 +1808,36 @@ declare const UpdateRuleStatusEnum: {
1710
1808
  };
1711
1809
  type UpdateRuleStatusEnum = typeof UpdateRuleStatusEnum[keyof typeof UpdateRuleStatusEnum];
1712
1810
 
1811
+ /**
1812
+ * Kadoa API
1813
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
1814
+ *
1815
+ * The version of the OpenAPI document: 3.0.0
1816
+ * Contact: support@kadoa.com
1817
+ *
1818
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1819
+ * https://openapi-generator.tech
1820
+ * Do not edit the class manually.
1821
+ */
1822
+
1823
+ /**
1824
+ * Request body for updating a schema
1825
+ */
1826
+ interface UpdateSchemaBody {
1827
+ /**
1828
+ * Name of the schema
1829
+ */
1830
+ 'name'?: string;
1831
+ /**
1832
+ * Entity type for the schema
1833
+ */
1834
+ 'entity'?: string | null;
1835
+ /**
1836
+ * Array of field definitions
1837
+ */
1838
+ 'fields'?: Array<SchemaResponseSchemaInner>;
1839
+ }
1840
+
1713
1841
  /**
1714
1842
  * Kadoa API
1715
1843
  * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
@@ -5459,8 +5587,17 @@ declare class DataFetcherService {
5459
5587
  }
5460
5588
 
5461
5589
  type NavigationMode = (typeof CreateWorkflowWithSchemaBodyNavigationModeEnum)[keyof typeof CreateWorkflowWithSchemaBodyNavigationModeEnum];
5590
+ type DataTypeInternal = (typeof ExtractionSchemaFieldDataTypeEnum)[keyof typeof ExtractionSchemaFieldDataTypeEnum];
5591
+ type DataType = Exclude<DataTypeInternal, "CURRENCY" | "JOB_DESCRIPTION" | "CATEGORY_JOB_TYPES" | "CLASSIFICATION" | "CATEGORIZE" | "STATIC_SCRAPER_DATA" | "UNIQUE_ID" | "JOBBIRD_CUSTOM" | "PASS" | "ADDITIONAL_DATA">;
5592
+ type MetadataKey = (typeof ExtractionMetadataFieldMetadataKeyEnum)[keyof typeof ExtractionMetadataFieldMetadataKeyEnum];
5462
5593
  type WorkflowInterval = (typeof CreateWorkflowWithSchemaBodyIntervalEnum)[keyof typeof CreateWorkflowWithSchemaBodyIntervalEnum];
5594
+ type MonitoringOperator = (typeof V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInnerOperatorEnum)[keyof typeof V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInnerOperatorEnum];
5595
+ type MonitoringField = V4WorkflowsWorkflowIdMetadataPutRequestMonitoringFieldsInner & {
5596
+ isKeyField?: boolean;
5597
+ };
5463
5598
  type LocationConfig$1 = Location;
5599
+ type RawFormat = (typeof ExtractionMetadataFieldMetadataKeyEnum)[keyof typeof ExtractionMetadataFieldMetadataKeyEnum];
5600
+ type FieldType = ExtractionMetadataFieldFieldTypeEnum | ExtractionClassificationFieldFieldTypeEnum | ExtractionSchemaFieldFieldTypeEnum;
5464
5601
 
5465
5602
  type SchemaField = ExtractionSchemaField | ExtractionClassificationField | ExtractionMetadataField;
5466
5603
  interface EntityPrediction {
@@ -5479,7 +5616,7 @@ interface ResolvedEntity {
5479
5616
  fields: SchemaField[];
5480
5617
  }
5481
5618
  type EntityConfig = "ai-detection" | {
5482
- schemId: string;
5619
+ schemaId: string;
5483
5620
  } | {
5484
5621
  name: string;
5485
5622
  fields: SchemaField[];
@@ -5998,10 +6135,6 @@ declare class NotificationsModule {
5998
6135
  get settings(): NotificationSettingsService;
5999
6136
  }
6000
6137
 
6001
- interface Schema {
6002
- entity: string;
6003
- schema: SchemaField[];
6004
- }
6005
6138
  /**
6006
6139
  * Service for managing schemas
6007
6140
  */
@@ -6010,17 +6143,147 @@ declare class SchemasService {
6010
6143
  constructor(client: KadoaClient);
6011
6144
  /**
6012
6145
  * Get a schema by ID
6013
- * //todo: use proper schema type for response from generated client (when avaialble)
6014
6146
  */
6015
- getSchema(schemaId: string): Promise<Schema>;
6147
+ getSchema(schemaId: string): Promise<SchemaResponse>;
6148
+ /**
6149
+ * List all schemas
6150
+ */
6151
+ listSchemas(): Promise<SchemaResponse[]>;
6152
+ /**
6153
+ * Create a new schema
6154
+ */
6155
+ createSchema(body: CreateSchemaBody): Promise<SchemaResponse>;
6156
+ /**
6157
+ * Update an existing schema
6158
+ */
6159
+ updateSchema(schemaId: string, body: UpdateSchemaBody): Promise<SchemaResponse>;
6160
+ /**
6161
+ * Delete a schema
6162
+ */
6163
+ deleteSchema(schemaId: string): Promise<void>;
6016
6164
  }
6017
6165
 
6166
+ /**
6167
+ * Example value for a field (re-exported from generated types)
6168
+ */
6169
+ type FieldExample = ExtractionSchemaFieldExample;
6170
+ /**
6171
+ * Optional configuration for schema fields
6172
+ */
6173
+ interface FieldOptions {
6174
+ /**
6175
+ * Example value for the field (required for STRING, IMAGE, LINK, OBJECT, ARRAY)
6176
+ * Can be a string or an array of strings
6177
+ */
6178
+ example?: FieldExample;
6179
+ /**
6180
+ * Whether this field is a primary key
6181
+ */
6182
+ isKey?: boolean;
6183
+ }
6184
+ /**
6185
+ * Category definition for classification fields (re-exported from generated types)
6186
+ */
6187
+ type Category = ExtractionClassificationFieldCategoriesInner;
6188
+ /**
6189
+ * Builder for defining custom schemas with fields
6190
+ */
6191
+ declare class SchemaBuilder {
6192
+ private static readonly FIELD_NAME_PATTERN;
6193
+ private static readonly TYPES_REQUIRING_EXAMPLE;
6194
+ readonly fields: SchemaField[];
6195
+ entityName?: string;
6196
+ entity(entityName: string): this;
6197
+ /**
6198
+ * Add a structured field to the schema
6199
+ * @param name - Field name (alphanumeric only)
6200
+ * @param description - Field description
6201
+ * @param dataType - Data type (STRING, NUMBER, BOOLEAN, etc.)
6202
+ * @param options - Optional field configuration
6203
+ */
6204
+ field(name: string, description: string, dataType: DataType, options?: FieldOptions): this;
6205
+ /**
6206
+ * Add a classification field to categorize content
6207
+ * @param name - Field name (alphanumeric only)
6208
+ * @param description - Field description
6209
+ * @param categories - Array of category definitions
6210
+ */
6211
+ classify(name: string, description: string, categories: Category[]): this;
6212
+ /**
6213
+ * Add raw page content to extract
6214
+ * @param name - Raw content format(s): "html", "markdown", or "url"
6215
+ */
6216
+ raw(name: RawFormat | RawFormat[]): this;
6217
+ build(): {
6218
+ entityName: string;
6219
+ fields: SchemaField[];
6220
+ };
6221
+ private validateFieldName;
6222
+ }
6223
+
6224
+ /**
6225
+ * Schema builder with create capability
6226
+ * Extends SchemaBuilder to add direct schema creation
6227
+ */
6228
+ declare class SchemaBuilderWithCreate extends SchemaBuilder {
6229
+ private readonly service;
6230
+ constructor(entityName: string, service: SchemasService);
6231
+ /**
6232
+ * Create the schema directly in Kadoa
6233
+ * @param name - Optional schema name (defaults to entity name)
6234
+ * @returns Promise resolving to the created schema
6235
+ */
6236
+ create(name?: string): Promise<SchemaResponse>;
6237
+ }
6018
6238
  /**
6019
6239
  * Schemas module for managing schemas
6020
6240
  */
6021
6241
  declare class SchemasModule {
6022
6242
  private readonly service;
6023
6243
  constructor(service: SchemasService);
6244
+ /**
6245
+ * Create a new schema builder for fluent schema definition
6246
+ * @param entityName - The name of the entity this schema represents
6247
+ * @returns A new SchemaBuilder instance with the entity name already set
6248
+ * @example Build then create
6249
+ * ```typescript
6250
+ * const schema = kadoa.schema.builder("Product")
6251
+ * .field("title", "Product name", "STRING", { example: "iPhone 15" })
6252
+ * .field("price", "Product price", "NUMBER")
6253
+ * .build();
6254
+ *
6255
+ * await kadoa.schema.create(schema);
6256
+ * ```
6257
+ *
6258
+ * @example Fluent chain with create
6259
+ * ```typescript
6260
+ * const schema = await kadoa.schema.builder("Product")
6261
+ * .field("title", "Product name", "STRING", { example: "iPhone 15" })
6262
+ * .field("price", "Product price", "NUMBER")
6263
+ * .create("Product Schema");
6264
+ * ```
6265
+ */
6266
+ builder(entityName: string): SchemaBuilderWithCreate;
6267
+ /**
6268
+ * Get a schema by ID
6269
+ */
6270
+ get(schemaId: string): Promise<SchemaResponse>;
6271
+ /**
6272
+ * List all schemas
6273
+ */
6274
+ list(): Promise<SchemaResponse[]>;
6275
+ /**
6276
+ * Create a new schema from a body
6277
+ */
6278
+ create(body: CreateSchemaBody): Promise<SchemaResponse>;
6279
+ /**
6280
+ * Update an existing schema
6281
+ */
6282
+ update(schemaId: string, body: UpdateSchemaBody): Promise<SchemaResponse>;
6283
+ /**
6284
+ * Delete a schema
6285
+ */
6286
+ delete(schemaId: string): Promise<void>;
6024
6287
  }
6025
6288
 
6026
6289
  /**
@@ -6151,97 +6414,6 @@ declare class WorkflowsModule {
6151
6414
  waitForJobCompletion(workflowId: string, jobId: string, options?: JobWaitOptions): Promise<FinishedJob>;
6152
6415
  }
6153
6416
 
6154
- /**
6155
- * Raw content format options
6156
- */
6157
- type RawFormat = "html" | "markdown" | "url";
6158
- /**
6159
- * Data type for schema fields
6160
- */
6161
- type DataType = (typeof ExtractionSchemaFieldDataTypeEnum)[keyof typeof ExtractionSchemaFieldDataTypeEnum];
6162
- /**
6163
- * Optional configuration for schema fields
6164
- */
6165
- interface FieldOptions {
6166
- /**
6167
- * Example value for the field (required for STRING, IMAGE, LINK, OBJECT, ARRAY)
6168
- * Can be a string or an array of strings
6169
- */
6170
- example?: ExtractionSchemaFieldExample;
6171
- /**
6172
- * Whether this field is a primary key
6173
- */
6174
- isKey?: boolean;
6175
- }
6176
- /**
6177
- * Category definition for classification fields
6178
- */
6179
- type Category = ExtractionClassificationFieldCategoriesInner;
6180
-
6181
- /**
6182
- * Base builder for extraction configuration
6183
- */
6184
- declare class ExtractionBuilder {
6185
- protected fields: SchemaField[];
6186
- protected schemaName?: string;
6187
- protected schemaId?: string;
6188
- /**
6189
- * Start defining a custom schema with fields
6190
- * @param name - The entity name (e.g., "Product", "Article")
6191
- */
6192
- schema(name: string): SchemaBuilder;
6193
- /**
6194
- * Use an existing schema by ID
6195
- * @param schemaId - The schema ID to reference
6196
- */
6197
- useSchema(schemaId: string): this;
6198
- /**
6199
- * Extract raw page content without transformation
6200
- * @param format - Raw content format(s): "html", "markdown", or "url"
6201
- */
6202
- raw(format: RawFormat | RawFormat[]): this;
6203
- /**
6204
- * Get the fields array (internal use)
6205
- */
6206
- getFields(): SchemaField[];
6207
- /**
6208
- * Get the schema name (internal use)
6209
- */
6210
- getSchemaName(): string | undefined;
6211
- /**
6212
- * Get the schema ID (internal use)
6213
- */
6214
- getSchemaId(): string | undefined;
6215
- }
6216
- /**
6217
- * Builder for defining custom schemas with fields
6218
- */
6219
- declare class SchemaBuilder extends ExtractionBuilder {
6220
- private static readonly FIELD_NAME_PATTERN;
6221
- private static readonly TYPES_REQUIRING_EXAMPLE;
6222
- constructor(parentBuilder: ExtractionBuilder);
6223
- /**
6224
- * Add a structured field to the schema
6225
- * @param name - Field name (alphanumeric only)
6226
- * @param description - Field description
6227
- * @param dataType - Data type (STRING, NUMBER, BOOLEAN, etc.)
6228
- * @param options - Optional field configuration
6229
- */
6230
- field(name: string, description: string, dataType: DataType, options?: FieldOptions): this;
6231
- /**
6232
- * Add a classification field to categorize content
6233
- * @param name - Field name (alphanumeric only)
6234
- * @param description - Field description
6235
- * @param categories - Array of category definitions
6236
- */
6237
- classify(name: string, description: string, categories: Category[]): this;
6238
- /**
6239
- * Add raw page content alongside structured fields
6240
- * @param format - Raw content format(s): "html", "markdown", or "url"
6241
- */
6242
- raw(format: RawFormat | RawFormat[]): this;
6243
- }
6244
-
6245
6417
  interface ExtractOptionsInternal {
6246
6418
  urls: string[];
6247
6419
  name: string;
@@ -6265,7 +6437,9 @@ interface ExtractOptions extends Omit<ExtractOptionsInternal, "navigationMode" |
6265
6437
  * .field("price", "Product price", "CURRENCY")
6266
6438
  * ```
6267
6439
  */
6268
- extraction?: (builder: ExtractionBuilder) => ExtractionBuilder;
6440
+ extraction?: (builder: SchemaBuilder) => SchemaBuilder | {
6441
+ schemaId: string;
6442
+ };
6269
6443
  }
6270
6444
  interface PreparedExtraction {
6271
6445
  options: ExtractOptionsInternal;
@@ -6520,6 +6694,9 @@ declare class KadoaSdkException extends Error {
6520
6694
  readonly SCHEMA_NOT_FOUND: "Schema not found";
6521
6695
  readonly SCHEMA_FETCH_ERROR: "Failed to fetch schema";
6522
6696
  readonly SCHEMAS_FETCH_ERROR: "Failed to fetch schemas";
6697
+ readonly SCHEMA_CREATE_FAILED: "Failed to create schema";
6698
+ readonly SCHEMA_UPDATE_FAILED: "Failed to update schema";
6699
+ readonly SCHEMA_DELETE_FAILED: "Failed to delete schema";
6523
6700
  };
6524
6701
  constructor(message: string, options?: KadoaSdkExceptionOptions);
6525
6702
  static from(error: unknown, details?: Record<string, unknown>): KadoaSdkException;
@@ -6558,6 +6735,9 @@ declare const ERROR_MESSAGES: {
6558
6735
  readonly SCHEMA_NOT_FOUND: "Schema not found";
6559
6736
  readonly SCHEMA_FETCH_ERROR: "Failed to fetch schema";
6560
6737
  readonly SCHEMAS_FETCH_ERROR: "Failed to fetch schemas";
6738
+ readonly SCHEMA_CREATE_FAILED: "Failed to create schema";
6739
+ readonly SCHEMA_UPDATE_FAILED: "Failed to update schema";
6740
+ readonly SCHEMA_DELETE_FAILED: "Failed to delete schema";
6561
6741
  };
6562
6742
 
6563
6743
  type KadoaHttpExceptionOptions = {
@@ -6590,4 +6770,4 @@ declare class KadoaHttpException extends KadoaSdkException {
6590
6770
  static mapStatusToCode(errorOrStatus: AxiosError | number): KadoaErrorCode;
6591
6771
  }
6592
6772
 
6593
- export { ERROR_MESSAGES, type FinishedJob, KadoaClient, type KadoaClientConfig, KadoaErrorCode, KadoaHttpException, KadoaSdkException, type KadoaUser, type ListRulesOptions, type LocationConfig, type PollingOptions, type RunWorkflowInput, type Schema, type SchemaField, SchemasModule, type StartedJob, ValidationModule, pollUntil };
6773
+ export { type Category, type CreateSchemaBody, type DataType, ERROR_MESSAGES, type FieldExample, type FieldOptions, type FieldType, type FinishedJob, KadoaClient, type KadoaClientConfig, KadoaErrorCode, KadoaHttpException, KadoaSdkException, type KadoaUser, type ListRulesOptions, type LocationConfig, type MetadataKey, type MonitoringField, type MonitoringOperator, type NavigationMode, type PollingOptions, type RawFormat, type RunWorkflowInput, SchemaBuilder, type SchemaField, type SchemaResponse, SchemasModule, type StartedJob, type UpdateSchemaBody, ValidationModule, type WorkflowInterval, pollUntil };