@elqnt/admin 2.1.0 → 2.2.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.
@@ -0,0 +1,168 @@
1
+ import { ApiClientOptions, ApiResponse } from '@elqnt/api-client';
2
+ import { OrgProductTS, OrgStatusTS, OrgTypeTS, Org, OrgResponse, OrgSchemaTypeTS, CreateOrgWithSchemasResponse, OrgInfoResponse, ListOrgsResponse, OrgArtifactTypeTS, CreateOrgRequest, CreateOrgResponse, RetryProvisioningRequest } from './models/index.cjs';
3
+
4
+ /**
5
+ * Organizations Admin API
6
+ *
7
+ * Browser-side API client for organization management.
8
+ * Uses @elqnt/api-client for HTTP requests with automatic token management.
9
+ */
10
+
11
+ /**
12
+ * Filter options for listing organizations
13
+ */
14
+ interface ListOrgsFilter {
15
+ product?: OrgProductTS;
16
+ status?: OrgStatusTS;
17
+ type?: OrgTypeTS;
18
+ }
19
+ /**
20
+ * List all organizations (admin scope required)
21
+ * @param filter - Optional filter criteria
22
+ * @param options - API client options
23
+ */
24
+ declare function listOrgsApi(filter: ListOrgsFilter | undefined, options: ApiClientOptions): Promise<ApiResponse<ListOrgsResponse>>;
25
+ /**
26
+ * Create a new organization
27
+ */
28
+ declare function createOrgApi(org: Partial<Org>, options: ApiClientOptions): Promise<ApiResponse<OrgResponse>>;
29
+ /**
30
+ * Get an organization by ID
31
+ */
32
+ declare function getOrgApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<OrgResponse>>;
33
+ /**
34
+ * Update an organization
35
+ */
36
+ declare function updateOrgApi(orgId: string, updates: Partial<Org>, options: ApiClientOptions): Promise<ApiResponse<OrgResponse>>;
37
+ /**
38
+ * Delete an organization
39
+ */
40
+ declare function deleteOrgApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
41
+ success: boolean;
42
+ }>>;
43
+ /**
44
+ * Get organization info (lightweight response)
45
+ */
46
+ declare function getOrgInfoApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<OrgInfoResponse>>;
47
+ /**
48
+ * Create an organization with specific database schemas.
49
+ * Only creates bare org_<uuid> schemas, no tables or default data.
50
+ * Use this when you want to create an org then bootstrap custom content
51
+ * using @elqnt/* hooks.
52
+ *
53
+ * @param org - Partial org data (title is required)
54
+ * @param schemas - Array of schema types to create: "entities", "agents", "org-config"
55
+ * @param options - API client options
56
+ */
57
+ declare function createOrgWithSchemasApi(org: Partial<Org>, schemas: OrgSchemaTypeTS[], options: ApiClientOptions): Promise<ApiResponse<CreateOrgWithSchemasResponse>>;
58
+
59
+ /**
60
+ * Organization Provisioning Admin API
61
+ *
62
+ * Browser-side API client for organization provisioning management.
63
+ * Uses @elqnt/api-client for HTTP requests with automatic token management.
64
+ */
65
+
66
+ interface ProvisioningProgress {
67
+ orgId: string;
68
+ status: string;
69
+ totalArtifacts: number;
70
+ completedArtifacts: number;
71
+ failedArtifacts: number;
72
+ currentArtifact?: {
73
+ type: OrgArtifactTypeTS;
74
+ status: string;
75
+ critical: boolean;
76
+ };
77
+ artifacts: Array<{
78
+ type: OrgArtifactTypeTS;
79
+ status: string;
80
+ critical: boolean;
81
+ error?: string;
82
+ duration?: number;
83
+ estimatedDuration?: number;
84
+ }>;
85
+ startedAt: number;
86
+ completedAt?: number;
87
+ error?: string;
88
+ }
89
+ interface ValidationResult {
90
+ valid: boolean;
91
+ artifacts: Array<{
92
+ type: string;
93
+ valid: boolean;
94
+ }>;
95
+ }
96
+ /**
97
+ * Create a new organization with provisioning
98
+ */
99
+ declare function createOrgWithProvisioningApi(request: CreateOrgRequest, options: ApiClientOptions): Promise<ApiResponse<CreateOrgResponse & {
100
+ provisioningStatus: string;
101
+ }>>;
102
+ /**
103
+ * Get provisioning status for an organization
104
+ */
105
+ declare function getProvisioningStatusApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
106
+ progress: ProvisioningProgress;
107
+ }>>;
108
+ /**
109
+ * Retry failed provisioning artifacts
110
+ */
111
+ declare function retryProvisioningApi(orgId: string, request: RetryProvisioningRequest | undefined, options: ApiClientOptions): Promise<ApiResponse<{
112
+ message: string;
113
+ status: string;
114
+ }>>;
115
+ /**
116
+ * Validate all provisioned artifacts
117
+ */
118
+ declare function validateProvisioningApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<ValidationResult>>;
119
+ /**
120
+ * Cancel active provisioning
121
+ */
122
+ declare function cancelProvisioningApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
123
+ message: string;
124
+ }>>;
125
+ /**
126
+ * Cleanup provisioned resources for an organization
127
+ */
128
+ declare function cleanupProvisioningApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
129
+ message: string;
130
+ }>>;
131
+ interface ProvisioningStreamCallbacks {
132
+ onProgress?: (progress: ProvisioningProgress) => void;
133
+ onConnected?: (orgId: string) => void;
134
+ onDone?: () => void;
135
+ onError?: (error: Error) => void;
136
+ onTimeout?: () => void;
137
+ }
138
+ /**
139
+ * Stream provisioning progress via Server-Sent Events
140
+ *
141
+ * Returns a function to close the connection
142
+ */
143
+ declare function streamProvisioningProgress(orgId: string, callbacks: ProvisioningStreamCallbacks, options: {
144
+ baseUrl: string;
145
+ token?: string;
146
+ }): () => void;
147
+ /**
148
+ * Calculate provisioning progress percentage
149
+ */
150
+ declare function calculateProgressPercentage(progress: ProvisioningProgress): number;
151
+ /**
152
+ * Check if provisioning is complete (success or failure)
153
+ */
154
+ declare function isProvisioningComplete(progress: ProvisioningProgress): boolean;
155
+ /**
156
+ * Check if provisioning was successful
157
+ */
158
+ declare function isProvisioningSuccessful(progress: ProvisioningProgress): boolean;
159
+ /**
160
+ * Get failed artifacts from progress
161
+ */
162
+ declare function getFailedArtifacts(progress: ProvisioningProgress): ProvisioningProgress["artifacts"];
163
+ /**
164
+ * Check if any critical artifacts failed
165
+ */
166
+ declare function hasCriticalFailures(progress: ProvisioningProgress): boolean;
167
+
168
+ export { type ListOrgsFilter as L, type ProvisioningProgress as P, type ValidationResult as V, type ProvisioningStreamCallbacks as a, cancelProvisioningApi as b, calculateProgressPercentage as c, cleanupProvisioningApi as d, createOrgApi as e, createOrgWithProvisioningApi as f, createOrgWithSchemasApi as g, deleteOrgApi as h, getFailedArtifacts as i, getOrgApi as j, getOrgInfoApi as k, getProvisioningStatusApi as l, hasCriticalFailures as m, isProvisioningComplete as n, isProvisioningSuccessful as o, listOrgsApi as p, retryProvisioningApi as r, streamProvisioningProgress as s, updateOrgApi as u, validateProvisioningApi as v };
@@ -0,0 +1,168 @@
1
+ import { ApiClientOptions, ApiResponse } from '@elqnt/api-client';
2
+ import { OrgProductTS, OrgStatusTS, OrgTypeTS, Org, OrgResponse, OrgSchemaTypeTS, CreateOrgWithSchemasResponse, OrgInfoResponse, ListOrgsResponse, OrgArtifactTypeTS, CreateOrgRequest, CreateOrgResponse, RetryProvisioningRequest } from './models/index.js';
3
+
4
+ /**
5
+ * Organizations Admin API
6
+ *
7
+ * Browser-side API client for organization management.
8
+ * Uses @elqnt/api-client for HTTP requests with automatic token management.
9
+ */
10
+
11
+ /**
12
+ * Filter options for listing organizations
13
+ */
14
+ interface ListOrgsFilter {
15
+ product?: OrgProductTS;
16
+ status?: OrgStatusTS;
17
+ type?: OrgTypeTS;
18
+ }
19
+ /**
20
+ * List all organizations (admin scope required)
21
+ * @param filter - Optional filter criteria
22
+ * @param options - API client options
23
+ */
24
+ declare function listOrgsApi(filter: ListOrgsFilter | undefined, options: ApiClientOptions): Promise<ApiResponse<ListOrgsResponse>>;
25
+ /**
26
+ * Create a new organization
27
+ */
28
+ declare function createOrgApi(org: Partial<Org>, options: ApiClientOptions): Promise<ApiResponse<OrgResponse>>;
29
+ /**
30
+ * Get an organization by ID
31
+ */
32
+ declare function getOrgApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<OrgResponse>>;
33
+ /**
34
+ * Update an organization
35
+ */
36
+ declare function updateOrgApi(orgId: string, updates: Partial<Org>, options: ApiClientOptions): Promise<ApiResponse<OrgResponse>>;
37
+ /**
38
+ * Delete an organization
39
+ */
40
+ declare function deleteOrgApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
41
+ success: boolean;
42
+ }>>;
43
+ /**
44
+ * Get organization info (lightweight response)
45
+ */
46
+ declare function getOrgInfoApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<OrgInfoResponse>>;
47
+ /**
48
+ * Create an organization with specific database schemas.
49
+ * Only creates bare org_<uuid> schemas, no tables or default data.
50
+ * Use this when you want to create an org then bootstrap custom content
51
+ * using @elqnt/* hooks.
52
+ *
53
+ * @param org - Partial org data (title is required)
54
+ * @param schemas - Array of schema types to create: "entities", "agents", "org-config"
55
+ * @param options - API client options
56
+ */
57
+ declare function createOrgWithSchemasApi(org: Partial<Org>, schemas: OrgSchemaTypeTS[], options: ApiClientOptions): Promise<ApiResponse<CreateOrgWithSchemasResponse>>;
58
+
59
+ /**
60
+ * Organization Provisioning Admin API
61
+ *
62
+ * Browser-side API client for organization provisioning management.
63
+ * Uses @elqnt/api-client for HTTP requests with automatic token management.
64
+ */
65
+
66
+ interface ProvisioningProgress {
67
+ orgId: string;
68
+ status: string;
69
+ totalArtifacts: number;
70
+ completedArtifacts: number;
71
+ failedArtifacts: number;
72
+ currentArtifact?: {
73
+ type: OrgArtifactTypeTS;
74
+ status: string;
75
+ critical: boolean;
76
+ };
77
+ artifacts: Array<{
78
+ type: OrgArtifactTypeTS;
79
+ status: string;
80
+ critical: boolean;
81
+ error?: string;
82
+ duration?: number;
83
+ estimatedDuration?: number;
84
+ }>;
85
+ startedAt: number;
86
+ completedAt?: number;
87
+ error?: string;
88
+ }
89
+ interface ValidationResult {
90
+ valid: boolean;
91
+ artifacts: Array<{
92
+ type: string;
93
+ valid: boolean;
94
+ }>;
95
+ }
96
+ /**
97
+ * Create a new organization with provisioning
98
+ */
99
+ declare function createOrgWithProvisioningApi(request: CreateOrgRequest, options: ApiClientOptions): Promise<ApiResponse<CreateOrgResponse & {
100
+ provisioningStatus: string;
101
+ }>>;
102
+ /**
103
+ * Get provisioning status for an organization
104
+ */
105
+ declare function getProvisioningStatusApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
106
+ progress: ProvisioningProgress;
107
+ }>>;
108
+ /**
109
+ * Retry failed provisioning artifacts
110
+ */
111
+ declare function retryProvisioningApi(orgId: string, request: RetryProvisioningRequest | undefined, options: ApiClientOptions): Promise<ApiResponse<{
112
+ message: string;
113
+ status: string;
114
+ }>>;
115
+ /**
116
+ * Validate all provisioned artifacts
117
+ */
118
+ declare function validateProvisioningApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<ValidationResult>>;
119
+ /**
120
+ * Cancel active provisioning
121
+ */
122
+ declare function cancelProvisioningApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
123
+ message: string;
124
+ }>>;
125
+ /**
126
+ * Cleanup provisioned resources for an organization
127
+ */
128
+ declare function cleanupProvisioningApi(orgId: string, options: ApiClientOptions): Promise<ApiResponse<{
129
+ message: string;
130
+ }>>;
131
+ interface ProvisioningStreamCallbacks {
132
+ onProgress?: (progress: ProvisioningProgress) => void;
133
+ onConnected?: (orgId: string) => void;
134
+ onDone?: () => void;
135
+ onError?: (error: Error) => void;
136
+ onTimeout?: () => void;
137
+ }
138
+ /**
139
+ * Stream provisioning progress via Server-Sent Events
140
+ *
141
+ * Returns a function to close the connection
142
+ */
143
+ declare function streamProvisioningProgress(orgId: string, callbacks: ProvisioningStreamCallbacks, options: {
144
+ baseUrl: string;
145
+ token?: string;
146
+ }): () => void;
147
+ /**
148
+ * Calculate provisioning progress percentage
149
+ */
150
+ declare function calculateProgressPercentage(progress: ProvisioningProgress): number;
151
+ /**
152
+ * Check if provisioning is complete (success or failure)
153
+ */
154
+ declare function isProvisioningComplete(progress: ProvisioningProgress): boolean;
155
+ /**
156
+ * Check if provisioning was successful
157
+ */
158
+ declare function isProvisioningSuccessful(progress: ProvisioningProgress): boolean;
159
+ /**
160
+ * Get failed artifacts from progress
161
+ */
162
+ declare function getFailedArtifacts(progress: ProvisioningProgress): ProvisioningProgress["artifacts"];
163
+ /**
164
+ * Check if any critical artifacts failed
165
+ */
166
+ declare function hasCriticalFailures(progress: ProvisioningProgress): boolean;
167
+
168
+ export { type ListOrgsFilter as L, type ProvisioningProgress as P, type ValidationResult as V, type ProvisioningStreamCallbacks as a, cancelProvisioningApi as b, calculateProgressPercentage as c, cleanupProvisioningApi as d, createOrgApi as e, createOrgWithProvisioningApi as f, createOrgWithSchemasApi as g, deleteOrgApi as h, getFailedArtifacts as i, getOrgApi as j, getOrgInfoApi as k, getProvisioningStatusApi as l, hasCriticalFailures as m, isProvisioningComplete as n, isProvisioningSuccessful as o, listOrgsApi as p, retryProvisioningApi as r, streamProvisioningProgress as s, updateOrgApi as u, validateProvisioningApi as v };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elqnt/admin",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Admin APIs for Eloquent platform (onboarding, org-settings, billing)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@elqnt/api-client": "1.0.4",
33
33
  "@elqnt/types": "2.0.13",
34
- "@elqnt/agents": "3.1.0"
34
+ "@elqnt/agents": "3.2.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/react": "^19.0.0",