@raisindb/client 0.1.17 → 0.1.37

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.js CHANGED
@@ -47,8 +47,11 @@ __export(src_exports, {
47
47
  FlowClient: () => FlowClient,
48
48
  FlowsApi: () => FlowsApi,
49
49
  FunctionsApi: () => FunctionsApi,
50
+ HttpArchetypes: () => HttpArchetypes,
50
51
  HttpDatabase: () => HttpDatabase,
52
+ HttpElementTypes: () => HttpElementTypes,
51
53
  HttpFunctionsApi: () => HttpFunctionsApi,
54
+ HttpNodeTypes: () => HttpNodeTypes,
52
55
  HttpWorkspaceClient: () => HttpWorkspaceClient,
53
56
  InboxApi: () => InboxApi,
54
57
  LocalStorageTokenStorage: () => LocalStorageTokenStorage,
@@ -880,6 +883,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
880
883
  RequestType2["ArchetypeDelete"] = "archetype_delete";
881
884
  RequestType2["ArchetypePublish"] = "archetype_publish";
882
885
  RequestType2["ArchetypeUnpublish"] = "archetype_unpublish";
886
+ RequestType2["ArchetypeGetResolved"] = "archetype_get_resolved";
883
887
  RequestType2["ElementTypeCreate"] = "element_type_create";
884
888
  RequestType2["ElementTypeGet"] = "element_type_get";
885
889
  RequestType2["ElementTypeList"] = "element_type_list";
@@ -887,6 +891,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
887
891
  RequestType2["ElementTypeDelete"] = "element_type_delete";
888
892
  RequestType2["ElementTypePublish"] = "element_type_publish";
889
893
  RequestType2["ElementTypeUnpublish"] = "element_type_unpublish";
894
+ RequestType2["ElementTypeGetResolved"] = "element_type_get_resolved";
890
895
  RequestType2["FullTextSearch"] = "full_text_search";
891
896
  RequestType2["VectorSearch"] = "vector_search";
892
897
  RequestType2["Subscribe"] = "subscribe";
@@ -2751,6 +2756,17 @@ var Archetypes = class {
2751
2756
  "archetype_unpublish" /* ArchetypeUnpublish */
2752
2757
  );
2753
2758
  }
2759
+ /**
2760
+ * Get resolved Archetype with full inheritance applied
2761
+ */
2762
+ async getResolved(name) {
2763
+ return this.sendRequest(
2764
+ {
2765
+ name
2766
+ },
2767
+ "archetype_get_resolved" /* ArchetypeGetResolved */
2768
+ );
2769
+ }
2754
2770
  };
2755
2771
 
2756
2772
  // src/element-types.ts
@@ -2838,6 +2854,17 @@ var ElementTypes = class {
2838
2854
  "element_type_unpublish" /* ElementTypeUnpublish */
2839
2855
  );
2840
2856
  }
2857
+ /**
2858
+ * Get resolved ElementType with full inheritance applied
2859
+ */
2860
+ async getResolved(name) {
2861
+ return this.sendRequest(
2862
+ {
2863
+ name
2864
+ },
2865
+ "element_type_get_resolved" /* ElementTypeGetResolved */
2866
+ );
2867
+ }
2841
2868
  };
2842
2869
 
2843
2870
  // src/branches.ts
@@ -6560,6 +6587,107 @@ var UploadManager = class {
6560
6587
  }
6561
6588
  };
6562
6589
 
6590
+ // src/http-schema.ts
6591
+ var HttpSchemaBase = class {
6592
+ constructor(repository, branch, client) {
6593
+ this.repository = repository;
6594
+ this.branch = branch;
6595
+ this.client = client;
6596
+ }
6597
+ /** Base management URL for this schema kind. */
6598
+ base() {
6599
+ return `/api/management/${this.repository}/${this.branch}/${this.kind}`;
6600
+ }
6601
+ /** List all schemas (or only published ones). */
6602
+ async list(publishedOnly = false) {
6603
+ const path = publishedOnly ? `${this.base()}/published` : this.base();
6604
+ const result = await this.client.managementRequest("GET", path);
6605
+ return Array.isArray(result) ? result : [];
6606
+ }
6607
+ /** Get a single schema by name. */
6608
+ async get(name) {
6609
+ return this.client.managementRequest("GET", `${this.base()}/${encodeURIComponent(name)}`);
6610
+ }
6611
+ /** Get the schema with full inheritance (`extends`) applied. */
6612
+ async getResolved(name) {
6613
+ return this.client.managementRequest(
6614
+ "GET",
6615
+ `${this.base()}/${encodeURIComponent(name)}/resolved`
6616
+ );
6617
+ }
6618
+ /** Create a schema. `name` is folded into the definition body if absent. */
6619
+ async create(name, definition, commit) {
6620
+ return this.client.managementRequest("POST", this.base(), {
6621
+ [this.defField]: { name, ...definition },
6622
+ commit
6623
+ });
6624
+ }
6625
+ /** Update an existing schema. */
6626
+ async update(name, definition, commit) {
6627
+ return this.client.managementRequest(
6628
+ "PUT",
6629
+ `${this.base()}/${encodeURIComponent(name)}`,
6630
+ { [this.defField]: { name, ...definition }, commit }
6631
+ );
6632
+ }
6633
+ /** Delete a schema. */
6634
+ async delete(name, commit) {
6635
+ return this.client.managementRequest(
6636
+ "DELETE",
6637
+ `${this.base()}/${encodeURIComponent(name)}`,
6638
+ commit
6639
+ );
6640
+ }
6641
+ /** Publish a schema. */
6642
+ async publish(name, commit) {
6643
+ return this.client.managementRequest(
6644
+ "POST",
6645
+ `${this.base()}/${encodeURIComponent(name)}/publish`,
6646
+ commit
6647
+ );
6648
+ }
6649
+ /** Unpublish a schema. */
6650
+ async unpublish(name, commit) {
6651
+ return this.client.managementRequest(
6652
+ "POST",
6653
+ `${this.base()}/${encodeURIComponent(name)}/unpublish`,
6654
+ commit
6655
+ );
6656
+ }
6657
+ };
6658
+ var HttpNodeTypes = class extends HttpSchemaBase {
6659
+ constructor() {
6660
+ super(...arguments);
6661
+ this.kind = "nodetypes";
6662
+ this.defField = "node_type";
6663
+ }
6664
+ /**
6665
+ * Get the resolved NodeType. Unlike archetypes/element types, NodeType
6666
+ * resolution can be workspace-aware (honors workspace NodeType pins).
6667
+ */
6668
+ async getResolved(name, opts) {
6669
+ const query = opts?.workspace ? `?workspace=${encodeURIComponent(opts.workspace)}` : "";
6670
+ return this.client.managementRequest(
6671
+ "GET",
6672
+ `${this.base()}/${encodeURIComponent(name)}/resolved${query}`
6673
+ );
6674
+ }
6675
+ };
6676
+ var HttpArchetypes = class extends HttpSchemaBase {
6677
+ constructor() {
6678
+ super(...arguments);
6679
+ this.kind = "archetypes";
6680
+ this.defField = "archetype";
6681
+ }
6682
+ };
6683
+ var HttpElementTypes = class extends HttpSchemaBase {
6684
+ constructor() {
6685
+ super(...arguments);
6686
+ this.kind = "elementtypes";
6687
+ this.defField = "element_type";
6688
+ }
6689
+ };
6690
+
6563
6691
  // src/http-client.ts
6564
6692
  var RaisinHttpClient = class extends import_events3.EventEmitter {
6565
6693
  constructor(baseUrl, options = {}) {
@@ -7259,6 +7387,17 @@ var RaisinHttpClient = class extends import_events3.EventEmitter {
7259
7387
  });
7260
7388
  return response.data;
7261
7389
  }
7390
+ /**
7391
+ * Make a management REST request and return the parsed body.
7392
+ *
7393
+ * @internal Used by the HTTP schema-management helpers
7394
+ * ({@link HttpNodeTypes}/{@link HttpArchetypes}/{@link HttpElementTypes}) to
7395
+ * reuse the client's centralized auth, timeout, and base-URL handling.
7396
+ */
7397
+ async managementRequest(method, path, body) {
7398
+ const response = await this.request({ method, path, body });
7399
+ return response.data;
7400
+ }
7262
7401
  /**
7263
7402
  * Get a simplified database interface for SSR
7264
7403
  * This returns an HTTP-based database client
@@ -7346,6 +7485,22 @@ var HttpDatabase = class _HttpDatabase {
7346
7485
  (repo, name, input) => this.client.invokeFunctionSync(repo, name, input)
7347
7486
  );
7348
7487
  }
7488
+ /** Effective branch for management calls. */
7489
+ schemaBranch() {
7490
+ return this.branch ?? this.client.getBranch();
7491
+ }
7492
+ /** NodeType management (get/list/getResolved/create/update/delete/publish/unpublish). */
7493
+ nodeTypes() {
7494
+ return new HttpNodeTypes(this.repository, this.schemaBranch(), this.client);
7495
+ }
7496
+ /** Archetype management (get/list/getResolved/create/update/delete/publish/unpublish). */
7497
+ archetypes() {
7498
+ return new HttpArchetypes(this.repository, this.schemaBranch(), this.client);
7499
+ }
7500
+ /** ElementType management (get/list/getResolved/create/update/delete/publish/unpublish). */
7501
+ elementTypes() {
7502
+ return new HttpElementTypes(this.repository, this.schemaBranch(), this.client);
7503
+ }
7349
7504
  };
7350
7505
  var HttpWorkspaceClient = class {
7351
7506
  constructor(repository, workspace, client) {
@@ -11629,8 +11784,11 @@ function createRaisinVue(vue) {
11629
11784
  FlowClient,
11630
11785
  FlowsApi,
11631
11786
  FunctionsApi,
11787
+ HttpArchetypes,
11632
11788
  HttpDatabase,
11789
+ HttpElementTypes,
11633
11790
  HttpFunctionsApi,
11791
+ HttpNodeTypes,
11634
11792
  HttpWorkspaceClient,
11635
11793
  InboxApi,
11636
11794
  LocalStorageTokenStorage,