@z3rno/sdk 0.8.1 → 0.9.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.cts CHANGED
@@ -1772,6 +1772,16 @@ declare class Z3rnoClient {
1772
1772
  afterTurn?: number;
1773
1773
  limit?: number;
1774
1774
  }): Promise<TurnListResponse>;
1775
+ /**
1776
+ * Cross-tenant admin sub-namespace (v0.22.1, slice 21.3).
1777
+ *
1778
+ * Pairs with z3rno-server v0.22.1's `/v1/tenants/{orgId}/budgets`
1779
+ * surface. Requires `SUPERADMIN_ENABLED=true` on the server and
1780
+ * the client to be configured with the matching superadmin API
1781
+ * key. Methods raise `AuthenticationError` (401) or a generic
1782
+ * `Z3rnoError` (403) otherwise.
1783
+ */
1784
+ get admin(): AdminAPI;
1775
1785
  /**
1776
1786
  * Read this org's stored budget overrides + resolved effective caps.
1777
1787
  * Auth: any admin/write/read member of the calling org.
@@ -1786,6 +1796,31 @@ declare class Z3rnoClient {
1786
1796
  private sleep;
1787
1797
  private handleResponse;
1788
1798
  }
1799
+ /**
1800
+ * Cross-tenant admin sub-namespace exposed via `client.admin`.
1801
+ *
1802
+ * Construction captures the parent client's `request` method as a
1803
+ * bound closure — no privileged access to the class internals, just
1804
+ * a function reference. That's deliberate: the namespace is
1805
+ * dependency-injected the same way a stub would be, so test doubles
1806
+ * can swap it out without touching the parent client.
1807
+ */
1808
+ declare class AdminAPI {
1809
+ private readonly request;
1810
+ constructor(request: (method: string, path: string, body?: unknown) => Promise<unknown>);
1811
+ /**
1812
+ * Read another tenant's budget overrides + effective caps.
1813
+ *
1814
+ * Requires `SUPERADMIN_ENABLED=true` server-side and the client to
1815
+ * be configured with the superadmin API key.
1816
+ */
1817
+ getBudgets(orgId: string): Promise<TenantBudgetsView>;
1818
+ /**
1819
+ * Replace another tenant's budget overrides. Zero / missing fields
1820
+ * inherit the server default.
1821
+ */
1822
+ setBudgets(orgId: string, budgets: Partial<TenantBudgets>): Promise<TenantBudgetsView>;
1823
+ }
1789
1824
 
1790
1825
  /**
1791
1826
  * Z3rno SDK error hierarchy.
@@ -2089,4 +2124,4 @@ declare class Z3rnoMastraMemory {
2089
2124
  private normaliseRole;
2090
2125
  }
2091
2126
 
2092
- export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
2127
+ export { AdminAPI, AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
package/dist/index.d.ts CHANGED
@@ -1772,6 +1772,16 @@ declare class Z3rnoClient {
1772
1772
  afterTurn?: number;
1773
1773
  limit?: number;
1774
1774
  }): Promise<TurnListResponse>;
1775
+ /**
1776
+ * Cross-tenant admin sub-namespace (v0.22.1, slice 21.3).
1777
+ *
1778
+ * Pairs with z3rno-server v0.22.1's `/v1/tenants/{orgId}/budgets`
1779
+ * surface. Requires `SUPERADMIN_ENABLED=true` on the server and
1780
+ * the client to be configured with the matching superadmin API
1781
+ * key. Methods raise `AuthenticationError` (401) or a generic
1782
+ * `Z3rnoError` (403) otherwise.
1783
+ */
1784
+ get admin(): AdminAPI;
1775
1785
  /**
1776
1786
  * Read this org's stored budget overrides + resolved effective caps.
1777
1787
  * Auth: any admin/write/read member of the calling org.
@@ -1786,6 +1796,31 @@ declare class Z3rnoClient {
1786
1796
  private sleep;
1787
1797
  private handleResponse;
1788
1798
  }
1799
+ /**
1800
+ * Cross-tenant admin sub-namespace exposed via `client.admin`.
1801
+ *
1802
+ * Construction captures the parent client's `request` method as a
1803
+ * bound closure — no privileged access to the class internals, just
1804
+ * a function reference. That's deliberate: the namespace is
1805
+ * dependency-injected the same way a stub would be, so test doubles
1806
+ * can swap it out without touching the parent client.
1807
+ */
1808
+ declare class AdminAPI {
1809
+ private readonly request;
1810
+ constructor(request: (method: string, path: string, body?: unknown) => Promise<unknown>);
1811
+ /**
1812
+ * Read another tenant's budget overrides + effective caps.
1813
+ *
1814
+ * Requires `SUPERADMIN_ENABLED=true` server-side and the client to
1815
+ * be configured with the superadmin API key.
1816
+ */
1817
+ getBudgets(orgId: string): Promise<TenantBudgetsView>;
1818
+ /**
1819
+ * Replace another tenant's budget overrides. Zero / missing fields
1820
+ * inherit the server default.
1821
+ */
1822
+ setBudgets(orgId: string, budgets: Partial<TenantBudgets>): Promise<TenantBudgetsView>;
1823
+ }
1789
1824
 
1790
1825
  /**
1791
1826
  * Z3rno SDK error hierarchy.
@@ -2089,4 +2124,4 @@ declare class Z3rnoMastraMemory {
2089
2124
  private normaliseRole;
2090
2125
  }
2091
2126
 
2092
- export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
2127
+ export { AdminAPI, AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, type CoreMessage, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, type MastraMessage, type MastraRole, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, StoreMemoryRequest, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, type Z3rnoClientConfig, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, type Z3rnoMastraMemoryOptions, type Z3rnoMessageRole, Z3rnoTimeoutError, Z3rnoVercelMemory, type Z3rnoVercelMemoryOptions };
package/dist/index.js CHANGED
@@ -974,6 +974,18 @@ var Z3rnoClient = class {
974
974
  return TurnListResponse.parse(resp);
975
975
  }
976
976
  // --- Tenant budgets (v0.20.3) ---
977
+ /**
978
+ * Cross-tenant admin sub-namespace (v0.22.1, slice 21.3).
979
+ *
980
+ * Pairs with z3rno-server v0.22.1's `/v1/tenants/{orgId}/budgets`
981
+ * surface. Requires `SUPERADMIN_ENABLED=true` on the server and
982
+ * the client to be configured with the matching superadmin API
983
+ * key. Methods raise `AuthenticationError` (401) or a generic
984
+ * `Z3rnoError` (403) otherwise.
985
+ */
986
+ get admin() {
987
+ return new AdminAPI(this.request.bind(this));
988
+ }
977
989
  /**
978
990
  * Read this org's stored budget overrides + resolved effective caps.
979
991
  * Auth: any admin/write/read member of the calling org.
@@ -1117,6 +1129,38 @@ var Z3rnoClient = class {
1117
1129
  }
1118
1130
  }
1119
1131
  };
1132
+ var AdminAPI = class {
1133
+ constructor(request) {
1134
+ this.request = request;
1135
+ }
1136
+ request;
1137
+ /**
1138
+ * Read another tenant's budget overrides + effective caps.
1139
+ *
1140
+ * Requires `SUPERADMIN_ENABLED=true` server-side and the client to
1141
+ * be configured with the superadmin API key.
1142
+ */
1143
+ async getBudgets(orgId) {
1144
+ const resp = await this.request("GET", `/v1/tenants/${orgId}/budgets`);
1145
+ return TenantBudgetsView.parse(resp);
1146
+ }
1147
+ /**
1148
+ * Replace another tenant's budget overrides. Zero / missing fields
1149
+ * inherit the server default.
1150
+ */
1151
+ async setBudgets(orgId, budgets) {
1152
+ const body = {
1153
+ daily_tokens: budgets.daily_tokens ?? 0,
1154
+ daily_llm_calls: budgets.daily_llm_calls ?? 0,
1155
+ daily_embeddings: budgets.daily_embeddings ?? 0,
1156
+ monthly_tokens: budgets.monthly_tokens ?? 0,
1157
+ monthly_llm_calls: budgets.monthly_llm_calls ?? 0,
1158
+ monthly_embeddings: budgets.monthly_embeddings ?? 0
1159
+ };
1160
+ const resp = await this.request("PUT", `/v1/tenants/${orgId}/budgets`, body);
1161
+ return TenantBudgetsView.parse(resp);
1162
+ }
1163
+ };
1120
1164
 
1121
1165
  // src/integrations/vercel-ai.ts
1122
1166
  var Z3rnoVercelMemory = class {
@@ -1267,6 +1311,6 @@ var Z3rnoMastraMemory = class {
1267
1311
  }
1268
1312
  };
1269
1313
 
1270
- export { AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, Z3rnoTimeoutError, Z3rnoVercelMemory };
1314
+ export { AdminAPI, AuditEntry, AuditPageResponse, AuthenticationError, BatchStoreResponse, ConversationResponse, DistillJobResponse, DistillJobStatusResponse, EndSessionResponse, ForgetResponse, IngestJobResponse, IngestJobStatusResponse, MemoryHistoryResponse, MemoryResponse, MemoryType, MemoryVersion, NotFoundError, RateLimitError, RecallResponse, RecallResultItem, RefineJobResponse, RefineJobStatusResponse, RelationshipType, RetrievalStrategy, ServerError, SessionResponse, TenantBudgets, TenantBudgetsView, TurnAddResponse, TurnListResponse, TurnResponse, ValidationError, Z3rnoClient, Z3rnoConnectionError, Z3rnoError, Z3rnoMastraMemory, Z3rnoTimeoutError, Z3rnoVercelMemory };
1271
1315
  //# sourceMappingURL=index.js.map
1272
1316
  //# sourceMappingURL=index.js.map