@ai2aim.ai/hivemind-sdk 1.0.3 → 1.0.5

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/client.js CHANGED
@@ -10,37 +10,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
15
  };
21
- var __importStar = (this && this.__importStar) || (function () {
22
- var ownKeys = function(o) {
23
- ownKeys = Object.getOwnPropertyNames || function (o) {
24
- var ar = [];
25
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
- return ar;
27
- };
28
- return ownKeys(o);
29
- };
30
- return function (mod) {
31
- if (mod && mod.__esModule) return mod;
32
- var result = {};
33
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
- __setModuleDefault(result, mod);
35
- return result;
36
- };
37
- })();
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
16
  Object.defineProperty(exports, "__esModule", { value: true });
42
17
  exports.HivemindClient = exports.HivemindError = void 0;
43
- const node_https_1 = __importDefault(require("node:https"));
44
18
  // Re-export all types for consumers
45
19
  __exportStar(require("./types"), exports);
46
20
  /**
@@ -74,52 +48,22 @@ function resolveClientConfig(input) {
74
48
  process.env.HIVEMIND_BASE_URL ??
75
49
  process.env.HIVEMIND_API_URL ??
76
50
  "").replace(/\/+$/, "");
77
- const iapClientId = input.iapClientId ?? process.env.IAP_CLIENT_ID ?? "";
78
51
  if (!baseUrl) {
79
52
  throw new HivemindError(0, null, "baseUrl is required. Set it in config or in env: HIVEMIND_BASE_URL (or HIVEMIND_API_URL).");
80
53
  }
81
54
  return {
82
55
  ...input,
83
56
  baseUrl,
84
- iapClientId,
85
57
  };
86
58
  }
87
59
  class HivemindClient {
88
60
  baseUrl;
89
61
  prefix;
90
62
  config;
91
- iapToken = null;
92
- iapTokenExpiry = 0;
93
- fetchAgent;
94
63
  constructor(config) {
95
64
  this.config = resolveClientConfig(config);
96
65
  this.baseUrl = this.config.baseUrl;
97
66
  this.prefix = this.config.apiPrefix ?? "/v1";
98
- if (this.config.insecure) {
99
- this.fetchAgent = new node_https_1.default.Agent({ rejectUnauthorized: false });
100
- }
101
- }
102
- // -----------------------------------------------------------------------
103
- // IAP token helper
104
- // -----------------------------------------------------------------------
105
- async getIapToken() {
106
- if (!this.config.iapClientId)
107
- return null;
108
- if (this.iapToken && Date.now() < this.iapTokenExpiry - 60_000) {
109
- return this.iapToken;
110
- }
111
- const { GoogleAuth } = await Promise.resolve().then(() => __importStar(require("google-auth-library")));
112
- const auth = new GoogleAuth({
113
- ...(this.config.iapServiceAccountKeyPath
114
- ? { keyFile: this.config.iapServiceAccountKeyPath }
115
- : {}),
116
- });
117
- const client = await auth.getIdTokenClient(this.config.iapClientId);
118
- const headers = await client.getRequestHeaders();
119
- const bearer = headers["Authorization"] ?? headers["authorization"] ?? "";
120
- this.iapToken = bearer.replace(/^Bearer\s+/i, "");
121
- this.iapTokenExpiry = Date.now() + 55 * 60_000;
122
- return this.iapToken;
123
67
  }
124
68
  // -----------------------------------------------------------------------
125
69
  // Generic HTTP helpers
@@ -134,14 +78,7 @@ class HivemindClient {
134
78
  }
135
79
  const headers = { ...opts.headers };
136
80
  const apiKey = opts.apiKey ?? this.config.apiKey;
137
- // IAP token (outermost Bearer); org API key as X-API-Key or Bearer when no IAP
138
- const iapToken = await this.getIapToken();
139
- if (iapToken) {
140
- headers["Authorization"] = `Bearer ${iapToken}`;
141
- if (apiKey)
142
- headers["X-API-Key"] = apiKey;
143
- }
144
- else if (apiKey) {
81
+ if (apiKey) {
145
82
  headers["Authorization"] = `Bearer ${apiKey}`;
146
83
  }
147
84
  if (this.config.adminKey) {
@@ -170,9 +107,6 @@ class HivemindClient {
170
107
  body: bodyPayload,
171
108
  signal: controller.signal,
172
109
  };
173
- if (this.fetchAgent) {
174
- fetchOpts.agent = this.fetchAgent;
175
- }
176
110
  const res = await fetch(url.toString(), fetchOpts);
177
111
  if (res.status === 204)
178
112
  return undefined;
@@ -202,6 +136,12 @@ class HivemindClient {
202
136
  del(path, options) {
203
137
  return this.request("DELETE", path, { apiKey: options?.apiKey });
204
138
  }
139
+ put(path, body, options) {
140
+ return this.request("PUT", path, { body, apiKey: options?.apiKey });
141
+ }
142
+ patch(path, body, options) {
143
+ return this.request("PATCH", path, { body, apiKey: options?.apiKey });
144
+ }
205
145
  // -----------------------------------------------------------------------
206
146
  // Health
207
147
  // -----------------------------------------------------------------------
@@ -866,6 +806,598 @@ class HivemindClient {
866
806
  sendDocumentProcessedWebhook(payload) {
867
807
  return this.post("/webhook/document-processed", payload);
868
808
  }
809
+ // -----------------------------------------------------------------------
810
+ // Admin — Configuration
811
+ // -----------------------------------------------------------------------
812
+ /**
813
+ * Get full service configuration overview.
814
+ *
815
+ * **Auth:** Requires `adminKey` in client config.
816
+ *
817
+ * **Endpoint:** `GET /v1/admin/config`
818
+ */
819
+ getAdminConfig() {
820
+ return this.get("/admin/config");
821
+ }
822
+ /**
823
+ * Get runtime setting overrides.
824
+ *
825
+ * **Auth:** Requires `adminKey` in client config.
826
+ *
827
+ * **Endpoint:** `GET /v1/admin/config/overrides`
828
+ */
829
+ getAdminConfigOverrides() {
830
+ return this.get("/admin/config/overrides");
831
+ }
832
+ /**
833
+ * Update a mutable runtime setting (e.g. log_level, debug, cors_allow_origins).
834
+ *
835
+ * **Auth:** Requires `adminKey` in client config.
836
+ *
837
+ * @param params - Setting key and new value.
838
+ *
839
+ * **Endpoint:** `PUT /v1/admin/settings`
840
+ */
841
+ updateAdminSetting(params) {
842
+ return this.put("/admin/settings", params);
843
+ }
844
+ // -----------------------------------------------------------------------
845
+ // Admin — Logging
846
+ // -----------------------------------------------------------------------
847
+ /**
848
+ * Get the current application log level.
849
+ *
850
+ * **Auth:** Requires `adminKey` in client config.
851
+ *
852
+ * **Endpoint:** `GET /v1/admin/logging/level`
853
+ */
854
+ getLogLevel() {
855
+ return this.get("/admin/logging/level");
856
+ }
857
+ /**
858
+ * Change the application log level.
859
+ *
860
+ * **Auth:** Requires `adminKey` in client config.
861
+ *
862
+ * @param params - The new log level (DEBUG, INFO, WARNING, ERROR, CRITICAL).
863
+ *
864
+ * **Endpoint:** `PUT /v1/admin/logging/level`
865
+ */
866
+ setLogLevel(params) {
867
+ return this.put("/admin/logging/level", params);
868
+ }
869
+ /**
870
+ * List all loggers with their levels and handlers.
871
+ *
872
+ * **Auth:** Requires `adminKey` in client config.
873
+ *
874
+ * **Endpoint:** `GET /v1/admin/logging/loggers`
875
+ */
876
+ getLoggers() {
877
+ return this.get("/admin/logging/loggers");
878
+ }
879
+ // -----------------------------------------------------------------------
880
+ // Admin — Traffic & Monitoring
881
+ // -----------------------------------------------------------------------
882
+ /**
883
+ * Get inbound traffic statistics.
884
+ *
885
+ * **Auth:** Requires `adminKey` in client config.
886
+ *
887
+ * **Endpoint:** `GET /v1/admin/traffic/inbound`
888
+ */
889
+ getInboundTraffic() {
890
+ return this.get("/admin/traffic/inbound");
891
+ }
892
+ /**
893
+ * Reset inbound traffic counters.
894
+ *
895
+ * **Auth:** Requires `adminKey` in client config.
896
+ *
897
+ * **Endpoint:** `POST /v1/admin/traffic/inbound/reset`
898
+ */
899
+ resetInboundTraffic() {
900
+ return this.post("/admin/traffic/inbound/reset");
901
+ }
902
+ /**
903
+ * Check health of outbound dependencies (GCP, Vertex, BigQuery, Redis).
904
+ *
905
+ * **Auth:** Requires `adminKey` in client config.
906
+ *
907
+ * **Endpoint:** `GET /v1/admin/traffic/outbound`
908
+ */
909
+ getOutboundStatus() {
910
+ return this.get("/admin/traffic/outbound");
911
+ }
912
+ // -----------------------------------------------------------------------
913
+ // Admin — CORS
914
+ // -----------------------------------------------------------------------
915
+ /**
916
+ * Get the current CORS allowed origins.
917
+ *
918
+ * **Auth:** Requires `adminKey` in client config.
919
+ *
920
+ * **Endpoint:** `GET /v1/admin/cors`
921
+ */
922
+ getCors() {
923
+ return this.get("/admin/cors");
924
+ }
925
+ /**
926
+ * Update the CORS allowed origins.
927
+ *
928
+ * **Auth:** Requires `adminKey` in client config.
929
+ *
930
+ * @param allowOrigins - Comma-separated origins or `"*"`.
931
+ *
932
+ * **Endpoint:** `PUT /v1/admin/cors`
933
+ */
934
+ setCors(allowOrigins) {
935
+ return this.put("/admin/cors", { allow_origins: allowOrigins });
936
+ }
937
+ // -----------------------------------------------------------------------
938
+ // Admin — Rate Limiting
939
+ // -----------------------------------------------------------------------
940
+ /**
941
+ * List all rate-limit entries.
942
+ *
943
+ * **Auth:** Requires `adminKey` in client config.
944
+ *
945
+ * **Endpoint:** `GET /v1/admin/rate-limits`
946
+ */
947
+ getRateLimits() {
948
+ return this.get("/admin/rate-limits");
949
+ }
950
+ /**
951
+ * Reset the rate-limit counter for an organization.
952
+ *
953
+ * **Auth:** Requires `adminKey` in client config.
954
+ *
955
+ * @param orgId - Organization identifier.
956
+ *
957
+ * **Endpoint:** `POST /v1/admin/rate-limits/reset/{orgId}`
958
+ */
959
+ resetRateLimit(orgId) {
960
+ return this.post(`/admin/rate-limits/reset/${orgId}`);
961
+ }
962
+ // -----------------------------------------------------------------------
963
+ // Admin — Organization & Job listing
964
+ // -----------------------------------------------------------------------
965
+ /**
966
+ * List all organizations (admin view).
967
+ *
968
+ * **Auth:** Requires `adminKey` in client config.
969
+ *
970
+ * @param limit - Maximum number of organizations to return (1–1000, default 100).
971
+ *
972
+ * **Endpoint:** `GET /v1/admin/organizations`
973
+ */
974
+ listOrganizations(limit) {
975
+ const query = limit !== undefined ? { limit: String(limit) } : undefined;
976
+ return this.get("/admin/organizations", query);
977
+ }
978
+ /**
979
+ * List recent jobs across all organizations (admin view).
980
+ *
981
+ * **Auth:** Requires `adminKey` in client config.
982
+ *
983
+ * @param limit - Maximum number of jobs to return (1–500, default 50).
984
+ *
985
+ * **Endpoint:** `GET /v1/admin/jobs`
986
+ */
987
+ listJobs(limit) {
988
+ const query = limit !== undefined ? { limit: String(limit) } : undefined;
989
+ return this.get("/admin/jobs", query);
990
+ }
991
+ // -----------------------------------------------------------------------
992
+ // Admin — Feature Flags
993
+ // -----------------------------------------------------------------------
994
+ /**
995
+ * Get all feature flags.
996
+ *
997
+ * **Auth:** Requires `adminKey` in client config.
998
+ *
999
+ * **Endpoint:** `GET /v1/admin/feature-flags`
1000
+ */
1001
+ getFeatureFlags() {
1002
+ return this.get("/admin/feature-flags");
1003
+ }
1004
+ /**
1005
+ * Get a single feature flag by key.
1006
+ *
1007
+ * **Auth:** Requires `adminKey` in client config.
1008
+ *
1009
+ * @param key - Feature flag key.
1010
+ *
1011
+ * **Endpoint:** `GET /v1/admin/feature-flags/{key}`
1012
+ */
1013
+ getFeatureFlag(key) {
1014
+ return this.get(`/admin/feature-flags/${key}`);
1015
+ }
1016
+ /**
1017
+ * Create or update a feature flag.
1018
+ *
1019
+ * **Auth:** Requires `adminKey` in client config.
1020
+ *
1021
+ * @param params - Flag key and enabled status.
1022
+ *
1023
+ * **Endpoint:** `PUT /v1/admin/feature-flags`
1024
+ */
1025
+ setFeatureFlag(params) {
1026
+ return this.put("/admin/feature-flags", params);
1027
+ }
1028
+ /**
1029
+ * Delete a feature flag.
1030
+ *
1031
+ * **Auth:** Requires `adminKey` in client config.
1032
+ *
1033
+ * @param key - Feature flag key to delete.
1034
+ *
1035
+ * **Endpoint:** `DELETE /v1/admin/feature-flags/{key}`
1036
+ */
1037
+ deleteFeatureFlag(key) {
1038
+ return this.del(`/admin/feature-flags/${key}`);
1039
+ }
1040
+ // -----------------------------------------------------------------------
1041
+ // Admin — Maintenance Mode
1042
+ // -----------------------------------------------------------------------
1043
+ /**
1044
+ * Get current maintenance mode state.
1045
+ *
1046
+ * **Auth:** Requires `adminKey` in client config.
1047
+ *
1048
+ * **Endpoint:** `GET /v1/admin/maintenance`
1049
+ */
1050
+ getMaintenanceMode() {
1051
+ return this.get("/admin/maintenance");
1052
+ }
1053
+ /**
1054
+ * Enable or disable maintenance mode.
1055
+ *
1056
+ * **Auth:** Requires `adminKey` in client config.
1057
+ *
1058
+ * @param params - Enabled flag and optional message.
1059
+ *
1060
+ * **Endpoint:** `PUT /v1/admin/maintenance`
1061
+ */
1062
+ setMaintenanceMode(params) {
1063
+ return this.put("/admin/maintenance", params);
1064
+ }
1065
+ // -----------------------------------------------------------------------
1066
+ // Admin — Cache
1067
+ // -----------------------------------------------------------------------
1068
+ /**
1069
+ * Get cache statistics.
1070
+ *
1071
+ * **Auth:** Requires `adminKey` in client config.
1072
+ *
1073
+ * **Endpoint:** `GET /v1/admin/cache`
1074
+ */
1075
+ getCacheStats() {
1076
+ return this.get("/admin/cache");
1077
+ }
1078
+ /**
1079
+ * Flush all caches.
1080
+ *
1081
+ * **Auth:** Requires `adminKey` in client config.
1082
+ *
1083
+ * **Endpoint:** `POST /v1/admin/cache/flush`
1084
+ */
1085
+ flushCache() {
1086
+ return this.post("/admin/cache/flush");
1087
+ }
1088
+ // -----------------------------------------------------------------------
1089
+ // Admin — Tiers & Pricing
1090
+ // -----------------------------------------------------------------------
1091
+ /**
1092
+ * Get all tier configurations.
1093
+ *
1094
+ * **Auth:** Requires `adminKey` in client config.
1095
+ *
1096
+ * **Endpoint:** `GET /v1/admin/tiers`
1097
+ */
1098
+ getTiers() {
1099
+ return this.get("/admin/tiers");
1100
+ }
1101
+ /**
1102
+ * Get current pricing configuration.
1103
+ *
1104
+ * **Auth:** Requires `adminKey` in client config.
1105
+ *
1106
+ * **Endpoint:** `GET /v1/admin/pricing`
1107
+ */
1108
+ getPricing() {
1109
+ return this.get("/admin/pricing");
1110
+ }
1111
+ // -----------------------------------------------------------------------
1112
+ // Admin — Audit & System
1113
+ // -----------------------------------------------------------------------
1114
+ /**
1115
+ * Get admin-level audit log entries.
1116
+ *
1117
+ * **Auth:** Requires `adminKey` in client config.
1118
+ *
1119
+ * @param limit - Maximum entries to return (1–1000, default 100).
1120
+ *
1121
+ * **Endpoint:** `GET /v1/admin/audit`
1122
+ */
1123
+ getAdminAudit(limit) {
1124
+ const query = limit !== undefined ? { limit: String(limit) } : undefined;
1125
+ return this.get("/admin/audit", query);
1126
+ }
1127
+ /**
1128
+ * Get system information (Python version, platform, architecture, PID, etc.).
1129
+ *
1130
+ * **Auth:** Requires `adminKey` in client config.
1131
+ *
1132
+ * **Endpoint:** `GET /v1/admin/system`
1133
+ */
1134
+ getSystemInfo() {
1135
+ return this.get("/admin/system");
1136
+ }
1137
+ // -----------------------------------------------------------------------
1138
+ // Jira Integration
1139
+ // -----------------------------------------------------------------------
1140
+ /**
1141
+ * Connect a Jira Cloud site using an API token.
1142
+ * Validates credentials, registers a webhook, and stores the encrypted token.
1143
+ *
1144
+ * **Auth:** Requires org-scoped API key.
1145
+ *
1146
+ * @param orgId - Organization identifier.
1147
+ * @param params - Jira connection details (site_url, email, api_token).
1148
+ * @param options - Optional per-request overrides.
1149
+ *
1150
+ * **Endpoint:** `POST /v1/organizations/{orgId}/integrations/jira/connect`
1151
+ */
1152
+ connectJira(orgId, params, options) {
1153
+ return this.post(`/organizations/${orgId}/integrations/jira/connect`, params, options);
1154
+ }
1155
+ /**
1156
+ * Get the current Jira integration status for an organization.
1157
+ *
1158
+ * **Auth:** Requires org-scoped API key.
1159
+ *
1160
+ * @param orgId - Organization identifier.
1161
+ * @param options - Optional per-request overrides.
1162
+ *
1163
+ * **Endpoint:** `GET /v1/organizations/{orgId}/integrations/jira/status`
1164
+ */
1165
+ getJiraStatus(orgId, options) {
1166
+ return this.get(`/organizations/${orgId}/integrations/jira/status`, undefined, options);
1167
+ }
1168
+ /**
1169
+ * Disconnect (unlink) an organization's Jira integration.
1170
+ * Deregisters the webhook and deletes stored credentials.
1171
+ *
1172
+ * **Auth:** Requires org-scoped API key.
1173
+ *
1174
+ * @param orgId - Organization identifier.
1175
+ * @param options - Optional per-request overrides.
1176
+ *
1177
+ * **Endpoint:** `DELETE /v1/organizations/{orgId}/integrations/jira`
1178
+ */
1179
+ disconnectJira(orgId, options) {
1180
+ return this.del(`/organizations/${orgId}/integrations/jira`, options);
1181
+ }
1182
+ /**
1183
+ * Trigger a bulk sync of Jira issues from specified projects into the
1184
+ * document store for RAG retrieval.
1185
+ *
1186
+ * **Auth:** Requires org-scoped API key.
1187
+ *
1188
+ * @param orgId - Organization identifier.
1189
+ * @param params - Object containing `project_keys` array.
1190
+ * @param options - Optional per-request overrides.
1191
+ *
1192
+ * **Endpoint:** `POST /v1/organizations/{orgId}/integrations/jira/sync`
1193
+ */
1194
+ syncJira(orgId, params, options) {
1195
+ return this.post(`/organizations/${orgId}/integrations/jira/sync`, params, options);
1196
+ }
1197
+ /**
1198
+ * Send a Jira webhook event manually.
1199
+ *
1200
+ * **Auth:** Requires `webhookSecret` in client config.
1201
+ *
1202
+ * @param payload - Jira webhook payload (issue, webhookEvent, etc.).
1203
+ *
1204
+ * **Endpoint:** `POST /v1/webhook/jira`
1205
+ */
1206
+ sendJiraWebhook(payload) {
1207
+ return this.post("/webhook/jira", payload);
1208
+ }
1209
+ // ---------------------------------------------------------------------------
1210
+ // Blueprint Management
1211
+ // ---------------------------------------------------------------------------
1212
+ /**
1213
+ * Create a new document blueprint (template).
1214
+ *
1215
+ * **Auth:** Requires org-scoped API key.
1216
+ *
1217
+ * @param orgId - Organization ID.
1218
+ * @param params - Blueprint details (name, sections, workflow_config, etc.).
1219
+ *
1220
+ * **Endpoint:** `POST /v1/organizations/{orgId}/blueprints`
1221
+ */
1222
+ createBlueprint(orgId, params, options) {
1223
+ return this.post(`/organizations/${orgId}/blueprints`, params, options);
1224
+ }
1225
+ /**
1226
+ * List all blueprints for an organization.
1227
+ *
1228
+ * **Auth:** Requires org-scoped API key.
1229
+ *
1230
+ * @param orgId - Organization ID.
1231
+ *
1232
+ * **Endpoint:** `GET /v1/organizations/{orgId}/blueprints`
1233
+ */
1234
+ listBlueprints(orgId, options) {
1235
+ return this.get(`/organizations/${orgId}/blueprints`, undefined, options);
1236
+ }
1237
+ /**
1238
+ * Get a single blueprint by ID.
1239
+ *
1240
+ * **Auth:** Requires org-scoped API key.
1241
+ *
1242
+ * @param orgId - Organization ID.
1243
+ * @param blueprintId - Blueprint ID.
1244
+ *
1245
+ * **Endpoint:** `GET /v1/organizations/{orgId}/blueprints/{blueprintId}`
1246
+ */
1247
+ getBlueprint(orgId, blueprintId, options) {
1248
+ return this.get(`/organizations/${orgId}/blueprints/${blueprintId}`, undefined, options);
1249
+ }
1250
+ /**
1251
+ * Update an existing blueprint. Only provided fields are changed.
1252
+ *
1253
+ * **Auth:** Requires org-scoped API key.
1254
+ *
1255
+ * @param orgId - Organization ID.
1256
+ * @param blueprintId - Blueprint ID.
1257
+ * @param params - Fields to update.
1258
+ *
1259
+ * **Endpoint:** `PUT /v1/organizations/{orgId}/blueprints/{blueprintId}`
1260
+ */
1261
+ updateBlueprint(orgId, blueprintId, params, options) {
1262
+ return this.put(`/organizations/${orgId}/blueprints/${blueprintId}`, params, options);
1263
+ }
1264
+ /**
1265
+ * Publish a blueprint, making it available for document creation.
1266
+ *
1267
+ * **Auth:** Requires org-scoped API key.
1268
+ *
1269
+ * @param orgId - Organization ID.
1270
+ * @param blueprintId - Blueprint ID.
1271
+ *
1272
+ * **Endpoint:** `POST /v1/organizations/{orgId}/blueprints/{blueprintId}/publish`
1273
+ */
1274
+ publishBlueprint(orgId, blueprintId, options) {
1275
+ return this.post(`/organizations/${orgId}/blueprints/${blueprintId}/publish`, {}, options);
1276
+ }
1277
+ /**
1278
+ * Archive a blueprint, preventing new documents from being created from it.
1279
+ *
1280
+ * **Auth:** Requires org-scoped API key.
1281
+ *
1282
+ * @param orgId - Organization ID.
1283
+ * @param blueprintId - Blueprint ID.
1284
+ *
1285
+ * **Endpoint:** `POST /v1/organizations/{orgId}/blueprints/{blueprintId}/archive`
1286
+ */
1287
+ archiveBlueprint(orgId, blueprintId, options) {
1288
+ return this.post(`/organizations/${orgId}/blueprints/${blueprintId}/archive`, {}, options);
1289
+ }
1290
+ /**
1291
+ * Permanently delete a blueprint.
1292
+ *
1293
+ * **Auth:** Requires org-scoped API key.
1294
+ *
1295
+ * @param orgId - Organization ID.
1296
+ * @param blueprintId - Blueprint ID.
1297
+ *
1298
+ * **Endpoint:** `DELETE /v1/organizations/{orgId}/blueprints/{blueprintId}`
1299
+ */
1300
+ deleteBlueprint(orgId, blueprintId, options) {
1301
+ return this.del(`/organizations/${orgId}/blueprints/${blueprintId}`, options);
1302
+ }
1303
+ // ---------------------------------------------------------------------------
1304
+ // Managed Documents
1305
+ // ---------------------------------------------------------------------------
1306
+ /**
1307
+ * Create a new managed document from a published blueprint.
1308
+ *
1309
+ * **Auth:** Requires org-scoped API key.
1310
+ *
1311
+ * @param orgId - Organization ID.
1312
+ * @param params - Document details (blueprint_id, title, sections, etc.).
1313
+ *
1314
+ * **Endpoint:** `POST /v1/organizations/{orgId}/documents/create`
1315
+ */
1316
+ createDocumentFromBlueprint(orgId, params, options) {
1317
+ return this.post(`/organizations/${orgId}/documents/create`, params, options);
1318
+ }
1319
+ /**
1320
+ * List all managed documents for an organization.
1321
+ *
1322
+ * **Auth:** Requires org-scoped API key.
1323
+ *
1324
+ * @param orgId - Organization ID.
1325
+ *
1326
+ * **Endpoint:** `GET /v1/organizations/{orgId}/documents/managed`
1327
+ */
1328
+ listManagedDocuments(orgId, options) {
1329
+ return this.get(`/organizations/${orgId}/documents/managed`, undefined, options);
1330
+ }
1331
+ /**
1332
+ * Get a single managed document by ID.
1333
+ *
1334
+ * **Auth:** Requires org-scoped API key.
1335
+ *
1336
+ * @param orgId - Organization ID.
1337
+ * @param documentId - Document ID.
1338
+ *
1339
+ * **Endpoint:** `GET /v1/organizations/{orgId}/documents/managed/{documentId}`
1340
+ */
1341
+ getManagedDocument(orgId, documentId, options) {
1342
+ return this.get(`/organizations/${orgId}/documents/managed/${documentId}`, undefined, options);
1343
+ }
1344
+ /**
1345
+ * Update the content of a document section. Only allowed in draft/revision status.
1346
+ *
1347
+ * **Auth:** Requires org-scoped API key.
1348
+ *
1349
+ * @param orgId - Organization ID.
1350
+ * @param documentId - Document ID.
1351
+ * @param params - Section ID and new content.
1352
+ *
1353
+ * **Endpoint:** `PATCH /v1/organizations/{orgId}/documents/managed/{documentId}/sections`
1354
+ */
1355
+ updateDocumentSection(orgId, documentId, params, options) {
1356
+ return this.patch(`/organizations/${orgId}/documents/managed/${documentId}/sections`, params, options);
1357
+ }
1358
+ /**
1359
+ * Perform a workflow action on a managed document.
1360
+ *
1361
+ * Actions: submit, approve, reject, request_changes, seal.
1362
+ *
1363
+ * **Auth:** Requires org-scoped API key.
1364
+ *
1365
+ * @param orgId - Organization ID.
1366
+ * @param documentId - Document ID.
1367
+ * @param params - Action type and optional comment.
1368
+ *
1369
+ * **Endpoint:** `POST /v1/organizations/{orgId}/documents/managed/{documentId}/workflow`
1370
+ */
1371
+ performDocumentWorkflow(orgId, documentId, params, options) {
1372
+ return this.post(`/organizations/${orgId}/documents/managed/${documentId}/workflow`, params, options);
1373
+ }
1374
+ /**
1375
+ * Permanently delete a managed document.
1376
+ *
1377
+ * **Auth:** Requires org-scoped API key.
1378
+ *
1379
+ * @param orgId - Organization ID.
1380
+ * @param documentId - Document ID.
1381
+ *
1382
+ * **Endpoint:** `DELETE /v1/organizations/{orgId}/documents/managed/{documentId}`
1383
+ */
1384
+ deleteManagedDocument(orgId, documentId, options) {
1385
+ return this.del(`/organizations/${orgId}/documents/managed/${documentId}`, options);
1386
+ }
1387
+ /**
1388
+ * AI-generate content for a document section using the blueprint's AI rules.
1389
+ *
1390
+ * **Auth:** Requires org-scoped API key.
1391
+ *
1392
+ * @param orgId - Organization ID.
1393
+ * @param documentId - Document ID.
1394
+ * @param params - Section ID and optional context for generation.
1395
+ *
1396
+ * **Endpoint:** `POST /v1/organizations/{orgId}/documents/managed/{documentId}/generate`
1397
+ */
1398
+ generateDocumentSection(orgId, documentId, params, options) {
1399
+ return this.post(`/organizations/${orgId}/documents/managed/${documentId}/generate`, params, options);
1400
+ }
869
1401
  }
870
1402
  exports.HivemindClient = HivemindClient;
871
1403
  //# sourceMappingURL=client.js.map