@dbx-tools/dbx-model-catalog 0.2.0 → 0.3.1

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.
Files changed (54) hide show
  1. package/README.md +294 -57
  2. package/dist/_generated/channels.d.ts +4 -3
  3. package/dist/_generated/json-schema.d.ts +6527 -175
  4. package/dist/_generated/schemas.d.ts +154 -0
  5. package/dist/_generated/workspace-rules.d.ts +133 -0
  6. package/dist/browser.d.ts +34 -17
  7. package/dist/browser.js +1192 -149
  8. package/dist/catalog-index.d.ts +15 -2
  9. package/dist/chunk-engbh7tj.js +39 -0
  10. package/dist/chunk-gzjer0mc.js +1797 -0
  11. package/dist/chunk-pp7fw379.js +51 -0
  12. package/dist/chunk-pwssxaq0.js +39 -0
  13. package/dist/cli.js +9 -654
  14. package/dist/effective.d.ts +31 -0
  15. package/dist/index.d.ts +33 -16
  16. package/dist/index.js +60 -660
  17. package/dist/local-client.d.ts +16 -3
  18. package/dist/pynect.d.ts +6 -3
  19. package/dist/search.d.ts +7 -1
  20. package/dist/serving-endpoints.d.ts +15 -0
  21. package/dist/sources.d.ts +30 -0
  22. package/dist/types.d.ts +31 -3
  23. package/dist/validation.d.ts +15 -1
  24. package/dist/workspace-cache.d.ts +68 -0
  25. package/dist/workspace-client.d.ts +49 -0
  26. package/dist/workspace-connection.d.ts +67 -0
  27. package/dist/workspace-file-cache.d.ts +11 -0
  28. package/dist/workspace-identity.d.ts +27 -0
  29. package/dist/workspace-overlay.d.ts +71 -0
  30. package/package.json +5 -6
  31. package/src/_generated/channels.ts +5 -2
  32. package/src/_generated/json-schema.ts +4 -2
  33. package/src/_generated/schemas.ts +177 -0
  34. package/src/_generated/workspace-rules.ts +285 -0
  35. package/src/browser.ts +105 -54
  36. package/src/catalog-index.ts +46 -19
  37. package/src/cli.ts +8 -11
  38. package/src/effective.ts +200 -0
  39. package/src/identity.ts +3 -26
  40. package/src/index.ts +155 -82
  41. package/src/local-client.ts +94 -18
  42. package/src/pynect.ts +28 -65
  43. package/src/search.ts +48 -0
  44. package/src/serving-endpoints.ts +157 -0
  45. package/src/sources.ts +107 -0
  46. package/src/types.ts +32 -2
  47. package/src/validation.ts +33 -0
  48. package/src/workspace-cache.ts +234 -0
  49. package/src/workspace-client.ts +134 -0
  50. package/src/workspace-connection.ts +160 -0
  51. package/src/workspace-file-cache.ts +45 -0
  52. package/src/workspace-identity.ts +77 -0
  53. package/src/workspace-overlay.ts +200 -0
  54. package/dist/pynect.js +0 -557
@@ -9,13 +9,24 @@ export interface EnrichedLiveModel<T> {
9
9
  readonly live: T;
10
10
  readonly published?: CatalogIdentityMatch;
11
11
  }
12
+ /**
13
+ * Exact (case-insensitive) then normalized identity lookup; never fuzzy. A normalized key is
14
+ * ambiguous, and resolves to nothing, only when identities of two different records normalize
15
+ * to it; identities of one record that normalize alike keep the first identity's match.
16
+ */
17
+ export declare class CatalogIdentityIndex {
18
+ private readonly exact;
19
+ private readonly normalized;
20
+ constructor(records: Iterable<CatalogModelRecord>);
21
+ resolve(value: string): CatalogIdentityMatch | undefined;
22
+ matchAny(values: readonly string[]): CatalogIdentityMatch | undefined;
23
+ }
12
24
  /** Immutable identity and search index over one catalog snapshot. */
13
25
  export declare class ModelCatalogIndex {
14
26
  readonly catalog: ModelCatalog;
15
27
  readonly searchIndex: CatalogSearchIndexPayload;
16
28
  readonly records: readonly CatalogModelRecord[];
17
- private readonly exact;
18
- private readonly normalized;
29
+ private readonly identities;
19
30
  constructor(catalog: ModelCatalog, searchIndex: CatalogSearchIndexPayload);
20
31
  get(id: string): CatalogModelRecord | undefined;
21
32
  resolve(value: string): CatalogIdentityMatch | undefined;
@@ -23,6 +34,8 @@ export declare class ModelCatalogIndex {
23
34
  list(filters?: CatalogFilters): CatalogModelRecord[];
24
35
  search(query: string, limit?: number | null): CatalogSearchMatch[];
25
36
  }
37
+ /** Catalog records with their map keys as ids, in catalog order. */
38
+ export declare function catalogRecords(catalog: ModelCatalog): CatalogModelRecord[];
26
39
  export declare function createModelCatalogIndex(catalog: ModelCatalog, searchIndex: CatalogSearchIndexPayload): ModelCatalogIndex;
27
40
  /** Join live models to published facts without dropping undocumented live entries. */
28
41
  export declare function enrichLiveModels<T>(index: ModelCatalogIndex, models: readonly T[], identities: (model: T) => readonly string[]): EnrichedLiveModel<T>[];
@@ -0,0 +1,39 @@
1
+ import {
2
+ parseModelCatalog2,
3
+ parseCatalogSearchIndex2
4
+ } from "./chunk-pp7fw379.js";
5
+
6
+ // src/pynect.ts
7
+ import { createPynectClient } from "pynect";
8
+
9
+ // src/_generated/channels.ts
10
+ import { defineChannel } from "@chanx-js/client";
11
+ var modelsChannel = defineChannel()({
12
+ name: "models",
13
+ address: "/ws/models"
14
+ });
15
+ var models = Object.assign(modelsChannel, {
16
+ streamActions: ["stream_models"]
17
+ });
18
+
19
+ // src/pynect.ts
20
+ var READY_TIMEOUT_MS = 1e4;
21
+ async function downloadWebSocketCatalog(baseUrl) {
22
+ const connection = createPynectClient({ baseUrl }).connect(models);
23
+ try {
24
+ await connection.ready({ timeout: READY_TIMEOUT_MS });
25
+ const [catalog, searchIndex] = await Promise.all([
26
+ connection.request({ action: "get_catalog", payload: {} }),
27
+ connection.request({ action: "get_search_index", payload: {} })
28
+ ]);
29
+ return {
30
+ catalog: parseModelCatalog2(catalog.payload),
31
+ searchIndex: parseCatalogSearchIndex2(searchIndex.payload)
32
+ };
33
+ } finally {
34
+ connection.close();
35
+ }
36
+ }
37
+ export {
38
+ downloadWebSocketCatalog
39
+ };