@mymehq/sdk 5.2.0 → 5.3.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.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { MergeStrategy, ConflictSnapshot, MergePolicy, ItemState, Tier, CreateItemInput, Item, PaginatedResult, ItemWithMetadata, Version, Edge, Metadata, SearchResult, CreateEdgeInput, EdgeTypeSchema, TypeSchema, CreateKeyInput, ApiKey, UpdateKeyInput, CreateWebhookInput, Webhook, UpdateWebhookInput, WebhookDelivery, ConnectionInstallResult, ConnectionUninstallResult, PreviewEventRequest, PreviewEventResult, TenantConfig, TenantQuota, Profile, UpdateProfileInput } from '@mymehq/shared';
2
- export { ApiKey, ConflictSnapshot, CreateItemInput, CreateKeyInput, Item, ItemState, MergePolicy, MergeStrategy, Metadata, PaginatedResult, Profile, SearchResult, TypeSchema, UpdateKeyInput, UpdateProfileInput, Version } from '@mymehq/shared';
1
+ import { MergeStrategy, ConflictSnapshot, MergePolicy, ItemState, Tier, CreateItemInput, Item, PaginatedResult, ItemWithMetadata, Version, Edge, Metadata, SearchResult, CreateEdgeInput, EdgeTypeSchema, TypeSchema, CreateKeyInput, ApiKey, UpdateKeyInput, CreateWebhookInput, Webhook, UpdateWebhookInput, WebhookDelivery, ConnectionInstallResult, ConnectionUninstallResult, PreviewEventRequest, PreviewEventResult, TenantConfig, TenantQuota, Tenant, TenantActivityEntry, TenantMetrics, Profile, UpdateProfileInput } from '@mymehq/shared';
2
+ export { ApiKey, ConflictSnapshot, CreateItemInput, CreateKeyInput, Item, ItemState, MergePolicy, MergeStrategy, Metadata, PaginatedResult, Profile, SearchResult, Tenant, TenantActivityEntry, TenantMetrics, TenantQuota, TenantStatus, TypeSchema, UpdateKeyInput, UpdateProfileInput, Version } from '@mymehq/shared';
3
3
 
4
4
  /**
5
5
  * Conflict resolution strategy for item updates.
@@ -178,6 +178,21 @@ interface SearchFilters {
178
178
  interface MetadataInput {
179
179
  tags?: string[];
180
180
  }
181
+ /**
182
+ * Compact API-key summary returned by the admin keys-list route
183
+ * (T-117). The full `ApiKey` shape carries permission maps; the
184
+ * operator surface deliberately surfaces only the identifying fields +
185
+ * timestamps needed for emergency revocation.
186
+ */
187
+ interface TenantApiKeySummary {
188
+ id: string;
189
+ label: string;
190
+ source: string;
191
+ role: string;
192
+ is_platform: boolean;
193
+ created_at: string;
194
+ last_used_at: string | null;
195
+ }
181
196
  /** One item to create or upsert in a `POST /items/bulk` call. Shape is
182
197
  * `CreateItemInput` plus compact outbound-only inline `edges`. */
183
198
  interface BulkItemInput {
@@ -727,6 +742,54 @@ declare class MymeClient {
727
742
  }) => Promise<TenantQuota>;
728
743
  };
729
744
  };
745
+ /**
746
+ * Operator-level admin surface — the `my admin` CLI command tree's
747
+ * backing endpoints. Every method requires a platform-admin key
748
+ * (`is_platform: true`). Non-platform credentials get a `403
749
+ * forbidden`; render `"this command requires a platform-admin key"`
750
+ * in CLI / UI layers.
751
+ *
752
+ * Quota read/write is intentionally NOT duplicated here — it lives on
753
+ * `client.tenants.quotas.{getById, set}` and is already platform-
754
+ * admin-gated. The admin namespace mirrors what the CLI's `my admin`
755
+ * tree exposes; quotas are reached via the existing tenants surface.
756
+ */
757
+ readonly admin: {
758
+ tenants: {
759
+ /** List every tenant in the instance with current status. */
760
+ list: () => Promise<Tenant[]>;
761
+ /**
762
+ * Single tenant + per-tenant quota overrides + the most-recent
763
+ * `system.activity` items for the tenant (`null` quotas when no
764
+ * override is configured; quota fields then resolve to instance
765
+ * defaults).
766
+ */
767
+ show: (tenantId: string) => Promise<{
768
+ tenant: Tenant;
769
+ quotas: TenantQuota | null;
770
+ recent_activity: TenantActivityEntry[];
771
+ }>;
772
+ /**
773
+ * Flip the tenant's status to `'suspended'`. Future non-GET
774
+ * requests from credentials in the tenant return HTTP 403
775
+ * `tenant_suspended`. Reads pass through; platform-admin keys
776
+ * bypass. Idempotent.
777
+ */
778
+ suspend: (tenantId: string) => Promise<Tenant>;
779
+ /** Reverse of `suspend`. Idempotent. */
780
+ unsuspend: (tenantId: string) => Promise<Tenant>;
781
+ /**
782
+ * Per-tenant usage snapshot — item count by state, blob count
783
+ * and total bytes, custom-type count, plus recent activity.
784
+ */
785
+ metrics: (tenantId: string) => Promise<TenantMetrics>;
786
+ };
787
+ keys: {
788
+ /** Active (non-revoked) keys for the named tenant. Operator
789
+ * surface for emergency revocation — pair with `client.keys.revoke`. */
790
+ list: (tenantId: string) => Promise<TenantApiKeySummary[]>;
791
+ };
792
+ };
730
793
  /**
731
794
  * The calling user's profile. `system.profile` is a virtual type —
732
795
  * served by a dedicated endpoint over the `users` table joined to
@@ -894,4 +957,4 @@ interface VerifyWebhookSignatureInput {
894
957
  */
895
958
  declare function verifyWebhookSignature(input: VerifyWebhookSignatureInput): WebhookVerifyResult;
896
959
 
897
- export { type BulkActionErrorEntry, type BulkActionFilter, type BulkActionInput, type BulkActionResult, type BulkEdgeInput, type BulkEdgeInputItem, type BulkEdgeResult, type BulkEdgeResultEntry, type BulkInput, type BulkItemInput, type BulkMode, type BulkOutcome, type BulkResult, type BulkResultEntry, type ClientConfig, type ConflictAutoMergeListener, type ConflictAutoMergedEvent, type ConflictData, ConflictError, type ConflictResolver, type ConflictStrategy, type CreateWithAttachmentsAttachment, type CreateWithAttachmentsInput, type CreateWithAttachmentsResult, ForbiddenError, type ItemWithExtensions, type ListFilters, type MetadataInput, MymeClient, MymeError, NotFoundError, type SearchFilters, UnauthorizedError, type UpdateOptions, ValidationError, type VerifyWebhookSignatureInput, type WebhookVerifyReason, type WebhookVerifyResult, defineType, verifyWebhookSignature };
960
+ export { type BulkActionErrorEntry, type BulkActionFilter, type BulkActionInput, type BulkActionResult, type BulkEdgeInput, type BulkEdgeInputItem, type BulkEdgeResult, type BulkEdgeResultEntry, type BulkInput, type BulkItemInput, type BulkMode, type BulkOutcome, type BulkResult, type BulkResultEntry, type ClientConfig, type ConflictAutoMergeListener, type ConflictAutoMergedEvent, type ConflictData, ConflictError, type ConflictResolver, type ConflictStrategy, type CreateWithAttachmentsAttachment, type CreateWithAttachmentsInput, type CreateWithAttachmentsResult, ForbiddenError, type ItemWithExtensions, type ListFilters, type MetadataInput, MymeClient, MymeError, NotFoundError, type SearchFilters, type TenantApiKeySummary, UnauthorizedError, type UpdateOptions, ValidationError, type VerifyWebhookSignatureInput, type WebhookVerifyReason, type WebhookVerifyResult, defineType, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -1129,6 +1129,77 @@ var MymeClient = class {
1129
1129
  }
1130
1130
  }
1131
1131
  };
1132
+ // ---- Admin (T-117) ----
1133
+ /**
1134
+ * Operator-level admin surface — the `my admin` CLI command tree's
1135
+ * backing endpoints. Every method requires a platform-admin key
1136
+ * (`is_platform: true`). Non-platform credentials get a `403
1137
+ * forbidden`; render `"this command requires a platform-admin key"`
1138
+ * in CLI / UI layers.
1139
+ *
1140
+ * Quota read/write is intentionally NOT duplicated here — it lives on
1141
+ * `client.tenants.quotas.{getById, set}` and is already platform-
1142
+ * admin-gated. The admin namespace mirrors what the CLI's `my admin`
1143
+ * tree exposes; quotas are reached via the existing tenants surface.
1144
+ */
1145
+ admin = {
1146
+ tenants: {
1147
+ /** List every tenant in the instance with current status. */
1148
+ list: async () => {
1149
+ const res = await this.transport.request(
1150
+ "GET",
1151
+ "/admin/tenants"
1152
+ );
1153
+ return res.data;
1154
+ },
1155
+ /**
1156
+ * Single tenant + per-tenant quota overrides + the most-recent
1157
+ * `system.activity` items for the tenant (`null` quotas when no
1158
+ * override is configured; quota fields then resolve to instance
1159
+ * defaults).
1160
+ */
1161
+ show: async (tenantId) => {
1162
+ return this.transport.request("GET", `/admin/tenants/${encodeURIComponent(tenantId)}`);
1163
+ },
1164
+ /**
1165
+ * Flip the tenant's status to `'suspended'`. Future non-GET
1166
+ * requests from credentials in the tenant return HTTP 403
1167
+ * `tenant_suspended`. Reads pass through; platform-admin keys
1168
+ * bypass. Idempotent.
1169
+ */
1170
+ suspend: async (tenantId) => {
1171
+ return this.transport.request(
1172
+ "POST",
1173
+ `/admin/tenants/${encodeURIComponent(tenantId)}/suspend`
1174
+ );
1175
+ },
1176
+ /** Reverse of `suspend`. Idempotent. */
1177
+ unsuspend: async (tenantId) => {
1178
+ return this.transport.request(
1179
+ "POST",
1180
+ `/admin/tenants/${encodeURIComponent(tenantId)}/unsuspend`
1181
+ );
1182
+ },
1183
+ /**
1184
+ * Per-tenant usage snapshot — item count by state, blob count
1185
+ * and total bytes, custom-type count, plus recent activity.
1186
+ */
1187
+ metrics: async (tenantId) => {
1188
+ return this.transport.request(
1189
+ "GET",
1190
+ `/admin/tenants/${encodeURIComponent(tenantId)}/metrics`
1191
+ );
1192
+ }
1193
+ },
1194
+ keys: {
1195
+ /** Active (non-revoked) keys for the named tenant. Operator
1196
+ * surface for emergency revocation — pair with `client.keys.revoke`. */
1197
+ list: async (tenantId) => {
1198
+ const res = await this.transport.request("GET", `/admin/tenants/${encodeURIComponent(tenantId)}/keys`);
1199
+ return res.data;
1200
+ }
1201
+ }
1202
+ };
1132
1203
  // ---- Profile (T-074) ----
1133
1204
  /**
1134
1205
  * The calling user's profile. `system.profile` is a virtual type —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mymehq/sdk",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@mymehq/shared": "5.1.0"
23
+ "@mymehq/shared": "5.3.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.0.0",