@agentuity/server 0.0.66 → 0.0.68
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/api/org/index.d.ts +2 -0
- package/dist/api/org/index.d.ts.map +1 -1
- package/dist/api/org/index.js +2 -0
- package/dist/api/org/index.js.map +1 -1
- package/dist/api/org/resources.d.ts +96 -0
- package/dist/api/org/resources.d.ts.map +1 -0
- package/dist/api/org/resources.js +64 -0
- package/dist/api/org/resources.js.map +1 -0
- package/dist/api/org/util.d.ts +22 -0
- package/dist/api/org/util.d.ts.map +1 -1
- package/dist/api/org/util.js +1 -0
- package/dist/api/org/util.js.map +1 -1
- package/dist/api/region/create.d.ts +1 -1
- package/dist/api/region/delete.d.ts +1 -1
- package/package.json +2 -2
- package/src/api/org/index.ts +2 -0
- package/src/api/org/resources.ts +85 -0
- package/src/api/org/util.ts +1 -0
package/dist/api/org/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
package/dist/api/org/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/org/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIClient } from '../api';
|
|
3
|
+
declare const OrgS3Resource: z.ZodObject<{
|
|
4
|
+
bucket_name: z.ZodString;
|
|
5
|
+
access_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
+
secret_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
endpoint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
cloud_region: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
declare const OrgDBResource: z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
logical_databases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
|
+
cloud_region: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
declare const OrgResourceListResponse: z.ZodObject<{
|
|
20
|
+
s3: z.ZodArray<z.ZodObject<{
|
|
21
|
+
bucket_name: z.ZodString;
|
|
22
|
+
access_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
secret_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
25
|
+
endpoint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
cloud_region: z.ZodString;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
db: z.ZodArray<z.ZodObject<{
|
|
29
|
+
name: z.ZodString;
|
|
30
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
logical_databases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
cloud_region: z.ZodString;
|
|
35
|
+
}, z.core.$strip>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
declare const OrgResourceListResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
38
|
+
success: z.ZodLiteral<false>;
|
|
39
|
+
message: z.ZodString;
|
|
40
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
+
success: z.ZodLiteral<true>;
|
|
42
|
+
data: z.ZodObject<{
|
|
43
|
+
s3: z.ZodArray<z.ZodObject<{
|
|
44
|
+
bucket_name: z.ZodString;
|
|
45
|
+
access_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
secret_key: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
|
+
region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
+
endpoint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
cloud_region: z.ZodString;
|
|
50
|
+
}, z.core.$strip>>;
|
|
51
|
+
db: z.ZodArray<z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
username: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
logical_databases: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
+
cloud_region: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>], "success">;
|
|
61
|
+
export type OrgResourceListResponse = z.infer<typeof OrgResourceListResponseSchema>;
|
|
62
|
+
export type OrgResourceList = z.infer<typeof OrgResourceListResponse>;
|
|
63
|
+
export type OrgS3Resource = z.infer<typeof OrgS3Resource>;
|
|
64
|
+
export type OrgDBResource = z.infer<typeof OrgDBResource>;
|
|
65
|
+
export interface ListOrgResourcesOptions {
|
|
66
|
+
/** Filter by resource type (default: "all") */
|
|
67
|
+
type?: 'all' | 's3' | 'db';
|
|
68
|
+
/** Include logical databases in DB resources (default: true) */
|
|
69
|
+
includeLogicalDbs?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* List all resources for the authenticated organization (across all regions)
|
|
73
|
+
* Extracts orgId from authentication context (API key, SDK, or CLI token)
|
|
74
|
+
*
|
|
75
|
+
* @param client - Catalyst API client (must be authenticated)
|
|
76
|
+
* @param options - Optional filters
|
|
77
|
+
* @returns List of S3 and DB resources with their cloud regions
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // Get all resources
|
|
81
|
+
* const all = await listOrgResources(client);
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* // Get only S3 buckets
|
|
85
|
+
* const s3Only = await listOrgResources(client, { type: 's3' });
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // Get only DBs without logical databases (faster)
|
|
89
|
+
* const dbsOnly = await listOrgResources(client, {
|
|
90
|
+
* type: 'db',
|
|
91
|
+
* includeLogicalDbs: false
|
|
92
|
+
* });
|
|
93
|
+
*/
|
|
94
|
+
export declare function listOrgResources(client: APIClient, options?: ListOrgResourcesOptions): Promise<OrgResourceList>;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/api/org/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAqB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGtD,QAAA,MAAM,aAAa;;;;;;;iBAOjB,CAAC;AAEH,QAAA,MAAM,aAAa;;;;;;;iBAOjB,CAAC;AAEH,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;iBAG3B,CAAC;AAEH,QAAA,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;8BAA6C,CAAC;AAEjF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,MAAM,WAAW,uBAAuB;IACvC,+CAA+C;IAC/C,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3B,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CACrC,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,eAAe,CAAC,CAiB1B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchema } from '../api';
|
|
3
|
+
import { OrgResourceResponseError } from './util';
|
|
4
|
+
const OrgS3Resource = z.object({
|
|
5
|
+
bucket_name: z.string().describe('the S3 bucket name'),
|
|
6
|
+
access_key: z.string().nullable().optional().describe('the S3 access key'),
|
|
7
|
+
secret_key: z.string().nullable().optional().describe('the S3 secret key'),
|
|
8
|
+
region: z.string().nullable().optional().describe('the S3 region'),
|
|
9
|
+
endpoint: z.string().nullable().optional().describe('the S3 endpoint'),
|
|
10
|
+
cloud_region: z.string().describe('the cloud region where this resource is provisioned'),
|
|
11
|
+
});
|
|
12
|
+
const OrgDBResource = z.object({
|
|
13
|
+
name: z.string().describe('the database name'),
|
|
14
|
+
username: z.string().nullable().optional().describe('the database username'),
|
|
15
|
+
password: z.string().nullable().optional().describe('the database password'),
|
|
16
|
+
url: z.string().nullable().optional().describe('the full database connection URL'),
|
|
17
|
+
logical_databases: z.array(z.string()).optional().describe('list of logical databases'),
|
|
18
|
+
cloud_region: z.string().describe('the cloud region where this resource is provisioned'),
|
|
19
|
+
});
|
|
20
|
+
const OrgResourceListResponse = z.object({
|
|
21
|
+
s3: z.array(OrgS3Resource),
|
|
22
|
+
db: z.array(OrgDBResource),
|
|
23
|
+
});
|
|
24
|
+
const OrgResourceListResponseSchema = APIResponseSchema(OrgResourceListResponse);
|
|
25
|
+
/**
|
|
26
|
+
* List all resources for the authenticated organization (across all regions)
|
|
27
|
+
* Extracts orgId from authentication context (API key, SDK, or CLI token)
|
|
28
|
+
*
|
|
29
|
+
* @param client - Catalyst API client (must be authenticated)
|
|
30
|
+
* @param options - Optional filters
|
|
31
|
+
* @returns List of S3 and DB resources with their cloud regions
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Get all resources
|
|
35
|
+
* const all = await listOrgResources(client);
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Get only S3 buckets
|
|
39
|
+
* const s3Only = await listOrgResources(client, { type: 's3' });
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Get only DBs without logical databases (faster)
|
|
43
|
+
* const dbsOnly = await listOrgResources(client, {
|
|
44
|
+
* type: 'db',
|
|
45
|
+
* includeLogicalDbs: false
|
|
46
|
+
* });
|
|
47
|
+
*/
|
|
48
|
+
export async function listOrgResources(client, options) {
|
|
49
|
+
const params = new URLSearchParams();
|
|
50
|
+
if (options?.type && options.type !== 'all') {
|
|
51
|
+
params.set('type', options.type);
|
|
52
|
+
}
|
|
53
|
+
if (options?.includeLogicalDbs === false) {
|
|
54
|
+
params.set('include_logical_dbs', 'false');
|
|
55
|
+
}
|
|
56
|
+
const query = params.toString();
|
|
57
|
+
const url = `/resource/2025-11-16${query ? `?${query}` : ''}`;
|
|
58
|
+
const resp = await client.request('GET', url, OrgResourceListResponseSchema);
|
|
59
|
+
if (resp.success) {
|
|
60
|
+
return resp.data;
|
|
61
|
+
}
|
|
62
|
+
throw new OrgResourceResponseError({ message: resp.message });
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/api/org/resources.ts"],"names":[],"mappings":"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"}
|
package/dist/api/org/util.d.ts
CHANGED
|
@@ -20,4 +20,26 @@ export declare const OrgResponseError: {
|
|
|
20
20
|
} & Readonly<Shape>;
|
|
21
21
|
readonly defaultMessage?: string;
|
|
22
22
|
});
|
|
23
|
+
export declare const OrgResourceResponseError: {
|
|
24
|
+
new (args?: {
|
|
25
|
+
message?: string;
|
|
26
|
+
cause?: unknown;
|
|
27
|
+
} | undefined): import("@agentuity/core").RichError & {
|
|
28
|
+
readonly _tag: "OrgResourceResponseError";
|
|
29
|
+
} & Readonly<Record<string, never>>;
|
|
30
|
+
readonly defaultMessage?: string;
|
|
31
|
+
} & (<Shape extends {
|
|
32
|
+
[x: string]: any;
|
|
33
|
+
} = Record<string, never>>() => {
|
|
34
|
+
new (args?: (Shape extends Record<string, never> ? {
|
|
35
|
+
message?: string;
|
|
36
|
+
cause?: unknown;
|
|
37
|
+
} : Shape & {
|
|
38
|
+
message?: string;
|
|
39
|
+
cause?: unknown;
|
|
40
|
+
}) | undefined): import("@agentuity/core").RichError & {
|
|
41
|
+
readonly _tag: "OrgResourceResponseError";
|
|
42
|
+
} & Readonly<Shape>;
|
|
43
|
+
readonly defaultMessage?: string;
|
|
44
|
+
});
|
|
23
45
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/api/org/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/api/org/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC;AACpE,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAA8C,CAAC"}
|
package/dist/api/org/util.js
CHANGED
package/dist/api/org/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/api/org/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/api/org/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepublishOnly": "bun run clean && bun run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agentuity/core": "0.0.
|
|
28
|
+
"@agentuity/core": "0.0.68",
|
|
29
29
|
"zod": "^4.1.12"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
package/src/api/org/index.ts
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { APIResponseSchema, APIClient } from '../api';
|
|
3
|
+
import { OrgResourceResponseError } from './util';
|
|
4
|
+
|
|
5
|
+
const OrgS3Resource = z.object({
|
|
6
|
+
bucket_name: z.string().describe('the S3 bucket name'),
|
|
7
|
+
access_key: z.string().nullable().optional().describe('the S3 access key'),
|
|
8
|
+
secret_key: z.string().nullable().optional().describe('the S3 secret key'),
|
|
9
|
+
region: z.string().nullable().optional().describe('the S3 region'),
|
|
10
|
+
endpoint: z.string().nullable().optional().describe('the S3 endpoint'),
|
|
11
|
+
cloud_region: z.string().describe('the cloud region where this resource is provisioned'),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const OrgDBResource = z.object({
|
|
15
|
+
name: z.string().describe('the database name'),
|
|
16
|
+
username: z.string().nullable().optional().describe('the database username'),
|
|
17
|
+
password: z.string().nullable().optional().describe('the database password'),
|
|
18
|
+
url: z.string().nullable().optional().describe('the full database connection URL'),
|
|
19
|
+
logical_databases: z.array(z.string()).optional().describe('list of logical databases'),
|
|
20
|
+
cloud_region: z.string().describe('the cloud region where this resource is provisioned'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const OrgResourceListResponse = z.object({
|
|
24
|
+
s3: z.array(OrgS3Resource),
|
|
25
|
+
db: z.array(OrgDBResource),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const OrgResourceListResponseSchema = APIResponseSchema(OrgResourceListResponse);
|
|
29
|
+
|
|
30
|
+
export type OrgResourceListResponse = z.infer<typeof OrgResourceListResponseSchema>;
|
|
31
|
+
export type OrgResourceList = z.infer<typeof OrgResourceListResponse>;
|
|
32
|
+
export type OrgS3Resource = z.infer<typeof OrgS3Resource>;
|
|
33
|
+
export type OrgDBResource = z.infer<typeof OrgDBResource>;
|
|
34
|
+
|
|
35
|
+
export interface ListOrgResourcesOptions {
|
|
36
|
+
/** Filter by resource type (default: "all") */
|
|
37
|
+
type?: 'all' | 's3' | 'db';
|
|
38
|
+
/** Include logical databases in DB resources (default: true) */
|
|
39
|
+
includeLogicalDbs?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* List all resources for the authenticated organization (across all regions)
|
|
44
|
+
* Extracts orgId from authentication context (API key, SDK, or CLI token)
|
|
45
|
+
*
|
|
46
|
+
* @param client - Catalyst API client (must be authenticated)
|
|
47
|
+
* @param options - Optional filters
|
|
48
|
+
* @returns List of S3 and DB resources with their cloud regions
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Get all resources
|
|
52
|
+
* const all = await listOrgResources(client);
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Get only S3 buckets
|
|
56
|
+
* const s3Only = await listOrgResources(client, { type: 's3' });
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Get only DBs without logical databases (faster)
|
|
60
|
+
* const dbsOnly = await listOrgResources(client, {
|
|
61
|
+
* type: 'db',
|
|
62
|
+
* includeLogicalDbs: false
|
|
63
|
+
* });
|
|
64
|
+
*/
|
|
65
|
+
export async function listOrgResources(
|
|
66
|
+
client: APIClient,
|
|
67
|
+
options?: ListOrgResourcesOptions
|
|
68
|
+
): Promise<OrgResourceList> {
|
|
69
|
+
const params = new URLSearchParams();
|
|
70
|
+
if (options?.type && options.type !== 'all') {
|
|
71
|
+
params.set('type', options.type);
|
|
72
|
+
}
|
|
73
|
+
if (options?.includeLogicalDbs === false) {
|
|
74
|
+
params.set('include_logical_dbs', 'false');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const query = params.toString();
|
|
78
|
+
const url = `/resource/2025-11-16${query ? `?${query}` : ''}`;
|
|
79
|
+
|
|
80
|
+
const resp = await client.request<OrgResourceListResponse>('GET', url, OrgResourceListResponseSchema);
|
|
81
|
+
if (resp.success) {
|
|
82
|
+
return resp.data;
|
|
83
|
+
}
|
|
84
|
+
throw new OrgResourceResponseError({ message: resp.message });
|
|
85
|
+
}
|
package/src/api/org/util.ts
CHANGED