@openbkn/bkn-sdk 0.1.0 → 0.1.1-alpha.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
@@ -1,3 +1,4 @@
1
+ import * as zod from 'zod';
1
2
  import { z } from 'zod';
2
3
 
3
4
  /** Shared types for the SDK surface. No runtime, no side effects. */
@@ -328,6 +329,9 @@ interface CreateFromCatalogOptions {
328
329
  tables?: string[];
329
330
  pkMap?: Record<string, string>;
330
331
  build?: boolean;
332
+ /** Per-table resource columns to vectorize (sets the build task's embedding_fields). */
333
+ embeddingFields?: Record<string, string[]>;
334
+ embeddingModel?: string;
331
335
  noRollback?: boolean;
332
336
  /** Pre-fetched row samples per table (e.g. from a CSV import) for PK detection. */
333
337
  sampleRows?: Record<string, Array<Record<string, string | null>>>;
@@ -342,6 +346,8 @@ interface CreateFromCsvOptions {
342
346
  tables?: string[];
343
347
  pkMap?: Record<string, string>;
344
348
  build?: boolean;
349
+ embeddingFields?: Record<string, string[]>;
350
+ embeddingModel?: string;
345
351
  noRollback?: boolean;
346
352
  onProgress?: (msg: string) => void;
347
353
  }
@@ -407,9 +413,15 @@ declare function kn(ctx: RequestContext): {
407
413
  bknResources: () => Promise<unknown>;
408
414
  createFromCatalog: (opts: CreateFromCatalogOptions) => Promise<unknown>;
409
415
  createFromCsv: (opts: CreateFromCsvOptions) => Promise<unknown>;
410
- /** Pack a local BKN directory and upload it as a knowledge network. */
416
+ /**
417
+ * Pack a local BKN directory and upload it as a knowledge network. With
418
+ * `build`, also submit one Vega BuildTask per object type that declares a
419
+ * `vector` index — the platform does not auto-build these on import.
420
+ */
411
421
  push: (dir: string, opts?: {
412
422
  branch?: string;
423
+ build?: boolean;
424
+ embeddingModel?: string;
413
425
  }) => Promise<unknown>;
414
426
  /** Download a knowledge network and extract it into a local directory. */
415
427
  pull: (knId: string, dir: string, opts?: {
@@ -739,35 +751,65 @@ declare const CreateBuildTaskRequest: z.ZodObject<{
739
751
  type CreateBuildTaskRequest = z.infer<typeof CreateBuildTaskRequest>;
740
752
  declare const BuildTask: z.ZodObject<{
741
753
  id: z.ZodString;
742
- resource_id: z.ZodString;
743
- mode: z.ZodEnum<["batch", "streaming"]>;
754
+ resource_id: z.ZodOptional<z.ZodString>;
755
+ mode: z.ZodOptional<z.ZodEnum<["batch", "streaming"]>>;
756
+ status: z.ZodOptional<z.ZodString>;
744
757
  state: z.ZodOptional<z.ZodString>;
758
+ total_count: z.ZodOptional<z.ZodNumber>;
745
759
  synced_count: z.ZodOptional<z.ZodNumber>;
746
760
  vectorized_count: z.ZodOptional<z.ZodNumber>;
747
- }, "strip", z.ZodTypeAny, {
748
- mode: "batch" | "streaming";
749
- id: string;
750
- resource_id: string;
751
- state?: string | undefined;
752
- synced_count?: number | undefined;
753
- vectorized_count?: number | undefined;
754
- }, {
755
- mode: "batch" | "streaming";
756
- id: string;
757
- resource_id: string;
758
- state?: string | undefined;
759
- synced_count?: number | undefined;
760
- vectorized_count?: number | undefined;
761
- }>;
761
+ embedding_fields: z.ZodOptional<z.ZodString>;
762
+ build_key_fields: z.ZodOptional<z.ZodString>;
763
+ embedding_model: z.ZodOptional<z.ZodString>;
764
+ model_dimensions: z.ZodOptional<z.ZodNumber>;
765
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
766
+ id: z.ZodString;
767
+ resource_id: z.ZodOptional<z.ZodString>;
768
+ mode: z.ZodOptional<z.ZodEnum<["batch", "streaming"]>>;
769
+ status: z.ZodOptional<z.ZodString>;
770
+ state: z.ZodOptional<z.ZodString>;
771
+ total_count: z.ZodOptional<z.ZodNumber>;
772
+ synced_count: z.ZodOptional<z.ZodNumber>;
773
+ vectorized_count: z.ZodOptional<z.ZodNumber>;
774
+ embedding_fields: z.ZodOptional<z.ZodString>;
775
+ build_key_fields: z.ZodOptional<z.ZodString>;
776
+ embedding_model: z.ZodOptional<z.ZodString>;
777
+ model_dimensions: z.ZodOptional<z.ZodNumber>;
778
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
779
+ id: z.ZodString;
780
+ resource_id: z.ZodOptional<z.ZodString>;
781
+ mode: z.ZodOptional<z.ZodEnum<["batch", "streaming"]>>;
782
+ status: z.ZodOptional<z.ZodString>;
783
+ state: z.ZodOptional<z.ZodString>;
784
+ total_count: z.ZodOptional<z.ZodNumber>;
785
+ synced_count: z.ZodOptional<z.ZodNumber>;
786
+ vectorized_count: z.ZodOptional<z.ZodNumber>;
787
+ embedding_fields: z.ZodOptional<z.ZodString>;
788
+ build_key_fields: z.ZodOptional<z.ZodString>;
789
+ embedding_model: z.ZodOptional<z.ZodString>;
790
+ model_dimensions: z.ZodOptional<z.ZodNumber>;
791
+ }, z.ZodTypeAny, "passthrough">>;
762
792
  type BuildTask = z.infer<typeof BuildTask>;
763
793
  interface ListCatalogsOptions {
764
794
  limit?: number;
765
795
  offset?: number;
766
796
  }
797
+ /** POST /catalogs body. `connector_config` shape varies by connector (raw passthrough). */
798
+ interface CreateCatalogRequest {
799
+ name: string;
800
+ connectorType: string;
801
+ connectorConfig: unknown;
802
+ tags?: string[];
803
+ description?: string;
804
+ enabled?: boolean;
805
+ }
767
806
 
768
807
  declare function vega(ctx: RequestContext): {
769
808
  catalogs: (opts?: ListCatalogsOptions) => Promise<unknown>;
770
809
  getCatalog: (id: string) => Promise<unknown>;
810
+ createCatalog: (req: CreateCatalogRequest) => Promise<unknown>;
811
+ enableCatalog: (id: string) => Promise<unknown>;
812
+ discoverCatalog: (id: string, wait?: boolean) => Promise<unknown>;
771
813
  catalogResources: (id: string, category?: string) => Promise<unknown>;
772
814
  catalogHealth: (ids: string[]) => Promise<unknown>;
773
815
  connectorTypes: () => Promise<unknown>;
@@ -778,14 +820,20 @@ declare function vega(ctx: RequestContext): {
778
820
  timeoutMs?: number;
779
821
  intervalMs?: number;
780
822
  }) => Promise<BuildTask>;
781
- buildStatus: (taskId: string) => Promise<{
782
- mode: "batch" | "streaming";
783
- id: string;
784
- resource_id: string;
785
- state?: string | undefined;
786
- synced_count?: number | undefined;
787
- vectorized_count?: number | undefined;
788
- }>;
823
+ buildStatus: (taskId: string) => Promise<zod.objectOutputType<{
824
+ id: zod.ZodString;
825
+ resource_id: zod.ZodOptional<zod.ZodString>;
826
+ mode: zod.ZodOptional<zod.ZodEnum<["batch", "streaming"]>>;
827
+ status: zod.ZodOptional<zod.ZodString>;
828
+ state: zod.ZodOptional<zod.ZodString>;
829
+ total_count: zod.ZodOptional<zod.ZodNumber>;
830
+ synced_count: zod.ZodOptional<zod.ZodNumber>;
831
+ vectorized_count: zod.ZodOptional<zod.ZodNumber>;
832
+ embedding_fields: zod.ZodOptional<zod.ZodString>;
833
+ build_key_fields: zod.ZodOptional<zod.ZodString>;
834
+ embedding_model: zod.ZodOptional<zod.ZodString>;
835
+ model_dimensions: zod.ZodOptional<zod.ZodNumber>;
836
+ }, zod.ZodTypeAny, "passthrough">>;
789
837
  };
790
838
 
791
839
  interface BknClient {
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  toolboxes,
20
20
  trace,
21
21
  vega
22
- } from "./chunk-4NXAIG4G.js";
22
+ } from "./chunk-DXA44XWY.js";
23
23
  export {
24
24
  DEFAULT_BUSINESS_DOMAIN,
25
25
  DEFAULT_LIST_LIMIT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openbkn/bkn-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-alpha.0",
4
4
  "description": "Unified TypeScript SDK + CLI for the BKN (Business Knowledge Network) platform.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",