@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.mjs CHANGED
@@ -429,6 +429,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
429
429
  RequestType2["ArchetypeDelete"] = "archetype_delete";
430
430
  RequestType2["ArchetypePublish"] = "archetype_publish";
431
431
  RequestType2["ArchetypeUnpublish"] = "archetype_unpublish";
432
+ RequestType2["ArchetypeGetResolved"] = "archetype_get_resolved";
432
433
  RequestType2["ElementTypeCreate"] = "element_type_create";
433
434
  RequestType2["ElementTypeGet"] = "element_type_get";
434
435
  RequestType2["ElementTypeList"] = "element_type_list";
@@ -436,6 +437,7 @@ var RequestType = /* @__PURE__ */ ((RequestType2) => {
436
437
  RequestType2["ElementTypeDelete"] = "element_type_delete";
437
438
  RequestType2["ElementTypePublish"] = "element_type_publish";
438
439
  RequestType2["ElementTypeUnpublish"] = "element_type_unpublish";
440
+ RequestType2["ElementTypeGetResolved"] = "element_type_get_resolved";
439
441
  RequestType2["FullTextSearch"] = "full_text_search";
440
442
  RequestType2["VectorSearch"] = "vector_search";
441
443
  RequestType2["Subscribe"] = "subscribe";
@@ -2300,6 +2302,17 @@ var Archetypes = class {
2300
2302
  "archetype_unpublish" /* ArchetypeUnpublish */
2301
2303
  );
2302
2304
  }
2305
+ /**
2306
+ * Get resolved Archetype with full inheritance applied
2307
+ */
2308
+ async getResolved(name) {
2309
+ return this.sendRequest(
2310
+ {
2311
+ name
2312
+ },
2313
+ "archetype_get_resolved" /* ArchetypeGetResolved */
2314
+ );
2315
+ }
2303
2316
  };
2304
2317
 
2305
2318
  // src/element-types.ts
@@ -2387,6 +2400,17 @@ var ElementTypes = class {
2387
2400
  "element_type_unpublish" /* ElementTypeUnpublish */
2388
2401
  );
2389
2402
  }
2403
+ /**
2404
+ * Get resolved ElementType with full inheritance applied
2405
+ */
2406
+ async getResolved(name) {
2407
+ return this.sendRequest(
2408
+ {
2409
+ name
2410
+ },
2411
+ "element_type_get_resolved" /* ElementTypeGetResolved */
2412
+ );
2413
+ }
2390
2414
  };
2391
2415
 
2392
2416
  // src/branches.ts
@@ -5236,6 +5260,107 @@ var UploadManager = class {
5236
5260
  }
5237
5261
  };
5238
5262
 
5263
+ // src/http-schema.ts
5264
+ var HttpSchemaBase = class {
5265
+ constructor(repository, branch, client) {
5266
+ this.repository = repository;
5267
+ this.branch = branch;
5268
+ this.client = client;
5269
+ }
5270
+ /** Base management URL for this schema kind. */
5271
+ base() {
5272
+ return `/api/management/${this.repository}/${this.branch}/${this.kind}`;
5273
+ }
5274
+ /** List all schemas (or only published ones). */
5275
+ async list(publishedOnly = false) {
5276
+ const path = publishedOnly ? `${this.base()}/published` : this.base();
5277
+ const result = await this.client.managementRequest("GET", path);
5278
+ return Array.isArray(result) ? result : [];
5279
+ }
5280
+ /** Get a single schema by name. */
5281
+ async get(name) {
5282
+ return this.client.managementRequest("GET", `${this.base()}/${encodeURIComponent(name)}`);
5283
+ }
5284
+ /** Get the schema with full inheritance (`extends`) applied. */
5285
+ async getResolved(name) {
5286
+ return this.client.managementRequest(
5287
+ "GET",
5288
+ `${this.base()}/${encodeURIComponent(name)}/resolved`
5289
+ );
5290
+ }
5291
+ /** Create a schema. `name` is folded into the definition body if absent. */
5292
+ async create(name, definition, commit) {
5293
+ return this.client.managementRequest("POST", this.base(), {
5294
+ [this.defField]: { name, ...definition },
5295
+ commit
5296
+ });
5297
+ }
5298
+ /** Update an existing schema. */
5299
+ async update(name, definition, commit) {
5300
+ return this.client.managementRequest(
5301
+ "PUT",
5302
+ `${this.base()}/${encodeURIComponent(name)}`,
5303
+ { [this.defField]: { name, ...definition }, commit }
5304
+ );
5305
+ }
5306
+ /** Delete a schema. */
5307
+ async delete(name, commit) {
5308
+ return this.client.managementRequest(
5309
+ "DELETE",
5310
+ `${this.base()}/${encodeURIComponent(name)}`,
5311
+ commit
5312
+ );
5313
+ }
5314
+ /** Publish a schema. */
5315
+ async publish(name, commit) {
5316
+ return this.client.managementRequest(
5317
+ "POST",
5318
+ `${this.base()}/${encodeURIComponent(name)}/publish`,
5319
+ commit
5320
+ );
5321
+ }
5322
+ /** Unpublish a schema. */
5323
+ async unpublish(name, commit) {
5324
+ return this.client.managementRequest(
5325
+ "POST",
5326
+ `${this.base()}/${encodeURIComponent(name)}/unpublish`,
5327
+ commit
5328
+ );
5329
+ }
5330
+ };
5331
+ var HttpNodeTypes = class extends HttpSchemaBase {
5332
+ constructor() {
5333
+ super(...arguments);
5334
+ this.kind = "nodetypes";
5335
+ this.defField = "node_type";
5336
+ }
5337
+ /**
5338
+ * Get the resolved NodeType. Unlike archetypes/element types, NodeType
5339
+ * resolution can be workspace-aware (honors workspace NodeType pins).
5340
+ */
5341
+ async getResolved(name, opts) {
5342
+ const query = opts?.workspace ? `?workspace=${encodeURIComponent(opts.workspace)}` : "";
5343
+ return this.client.managementRequest(
5344
+ "GET",
5345
+ `${this.base()}/${encodeURIComponent(name)}/resolved${query}`
5346
+ );
5347
+ }
5348
+ };
5349
+ var HttpArchetypes = class extends HttpSchemaBase {
5350
+ constructor() {
5351
+ super(...arguments);
5352
+ this.kind = "archetypes";
5353
+ this.defField = "archetype";
5354
+ }
5355
+ };
5356
+ var HttpElementTypes = class extends HttpSchemaBase {
5357
+ constructor() {
5358
+ super(...arguments);
5359
+ this.kind = "elementtypes";
5360
+ this.defField = "element_type";
5361
+ }
5362
+ };
5363
+
5239
5364
  // src/http-client.ts
5240
5365
  var RaisinHttpClient = class extends EventEmitter {
5241
5366
  constructor(baseUrl, options = {}) {
@@ -5935,6 +6060,17 @@ var RaisinHttpClient = class extends EventEmitter {
5935
6060
  });
5936
6061
  return response.data;
5937
6062
  }
6063
+ /**
6064
+ * Make a management REST request and return the parsed body.
6065
+ *
6066
+ * @internal Used by the HTTP schema-management helpers
6067
+ * ({@link HttpNodeTypes}/{@link HttpArchetypes}/{@link HttpElementTypes}) to
6068
+ * reuse the client's centralized auth, timeout, and base-URL handling.
6069
+ */
6070
+ async managementRequest(method, path, body) {
6071
+ const response = await this.request({ method, path, body });
6072
+ return response.data;
6073
+ }
5938
6074
  /**
5939
6075
  * Get a simplified database interface for SSR
5940
6076
  * This returns an HTTP-based database client
@@ -6022,6 +6158,22 @@ var HttpDatabase = class _HttpDatabase {
6022
6158
  (repo, name, input) => this.client.invokeFunctionSync(repo, name, input)
6023
6159
  );
6024
6160
  }
6161
+ /** Effective branch for management calls. */
6162
+ schemaBranch() {
6163
+ return this.branch ?? this.client.getBranch();
6164
+ }
6165
+ /** NodeType management (get/list/getResolved/create/update/delete/publish/unpublish). */
6166
+ nodeTypes() {
6167
+ return new HttpNodeTypes(this.repository, this.schemaBranch(), this.client);
6168
+ }
6169
+ /** Archetype management (get/list/getResolved/create/update/delete/publish/unpublish). */
6170
+ archetypes() {
6171
+ return new HttpArchetypes(this.repository, this.schemaBranch(), this.client);
6172
+ }
6173
+ /** ElementType management (get/list/getResolved/create/update/delete/publish/unpublish). */
6174
+ elementTypes() {
6175
+ return new HttpElementTypes(this.repository, this.schemaBranch(), this.client);
6176
+ }
6025
6177
  };
6026
6178
  var HttpWorkspaceClient = class {
6027
6179
  constructor(repository, workspace, client) {
@@ -8280,8 +8432,11 @@ export {
8280
8432
  FlowClient,
8281
8433
  FlowsApi,
8282
8434
  FunctionsApi,
8435
+ HttpArchetypes,
8283
8436
  HttpDatabase,
8437
+ HttpElementTypes,
8284
8438
  HttpFunctionsApi,
8439
+ HttpNodeTypes,
8285
8440
  HttpWorkspaceClient,
8286
8441
  InboxApi,
8287
8442
  LocalStorageTokenStorage,