@foxnose/sdk 0.1.1 → 0.2.2
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/README.md +29 -4
- package/dist/index.cjs +111 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +111 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -93,8 +93,8 @@ interface RetryConfig {
|
|
|
93
93
|
methods: readonly string[];
|
|
94
94
|
}
|
|
95
95
|
declare const DEFAULT_RETRY_CONFIG: Readonly<RetryConfig>;
|
|
96
|
-
declare const SDK_VERSION = "0.
|
|
97
|
-
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.
|
|
96
|
+
declare const SDK_VERSION = "0.2.1";
|
|
97
|
+
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.2.1";
|
|
98
98
|
/**
|
|
99
99
|
* General transport-level configuration shared by all clients.
|
|
100
100
|
*/
|
|
@@ -385,6 +385,10 @@ interface APIFolderSummary {
|
|
|
385
385
|
api?: string | null;
|
|
386
386
|
path?: string | null;
|
|
387
387
|
allowed_methods?: string[] | null;
|
|
388
|
+
description_get_one?: string | null;
|
|
389
|
+
description_get_many?: string | null;
|
|
390
|
+
description_search?: string | null;
|
|
391
|
+
description_schema?: string | null;
|
|
388
392
|
created_at?: string | null;
|
|
389
393
|
}
|
|
390
394
|
type APIFolderList = PaginatedResponse<APIFolderSummary>;
|
|
@@ -519,6 +523,15 @@ interface ManagementClientOptions {
|
|
|
519
523
|
retryConfig?: RetryConfig;
|
|
520
524
|
defaultHeaders?: Record<string, string>;
|
|
521
525
|
}
|
|
526
|
+
interface ApiFolderRouteDescriptionOptions {
|
|
527
|
+
descriptionGetOne?: string;
|
|
528
|
+
descriptionGetMany?: string;
|
|
529
|
+
descriptionSearch?: string;
|
|
530
|
+
descriptionSchema?: string;
|
|
531
|
+
}
|
|
532
|
+
interface ApiFolderOptions extends ApiFolderRouteDescriptionOptions {
|
|
533
|
+
allowedMethods?: string[];
|
|
534
|
+
}
|
|
522
535
|
/**
|
|
523
536
|
* Client for the FoxNose Management API.
|
|
524
537
|
*
|
|
@@ -539,6 +552,9 @@ declare class ManagementClient {
|
|
|
539
552
|
parseJson?: boolean;
|
|
540
553
|
}): Promise<any>;
|
|
541
554
|
close(): void;
|
|
555
|
+
private normalizeListPayload;
|
|
556
|
+
private normalizePermissionObjectPayload;
|
|
557
|
+
private normalizePermissionObjectListPayload;
|
|
542
558
|
listOrganizations(): Promise<OrganizationList>;
|
|
543
559
|
getOrganization(orgKey: OrgRef): Promise<OrganizationSummary>;
|
|
544
560
|
updateOrganization(orgKey: OrgRef, payload: Record<string, any>): Promise<OrganizationSummary>;
|
|
@@ -563,13 +579,9 @@ declare class ManagementClient {
|
|
|
563
579
|
updateApi(apiKey: APIRef, payload: Record<string, any>): Promise<APIInfo>;
|
|
564
580
|
deleteApi(apiKey: APIRef): Promise<void>;
|
|
565
581
|
listApiFolders(apiKey: APIRef, params?: Record<string, any>): Promise<APIFolderList>;
|
|
566
|
-
addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?:
|
|
567
|
-
allowedMethods?: string[];
|
|
568
|
-
}): Promise<APIFolderSummary>;
|
|
582
|
+
addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
|
|
569
583
|
getApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<APIFolderSummary>;
|
|
570
|
-
updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?:
|
|
571
|
-
allowedMethods?: string[];
|
|
572
|
-
}): Promise<APIFolderSummary>;
|
|
584
|
+
updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
|
|
573
585
|
removeApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<void>;
|
|
574
586
|
listManagementRoles(params?: Record<string, any>): Promise<ManagementRoleList>;
|
|
575
587
|
createManagementRole(payload: Record<string, any>): Promise<ManagementRoleSummary>;
|
|
@@ -710,7 +722,9 @@ declare class FluxClient {
|
|
|
710
722
|
listResources<T = any>(folderPath: string, params?: Record<string, any>): Promise<T>;
|
|
711
723
|
getResource<T = any>(folderPath: string, resourceKey: string, params?: Record<string, any>): Promise<T>;
|
|
712
724
|
search<T = any>(folderPath: string, body: Record<string, any>): Promise<T>;
|
|
725
|
+
getRouter<T = any>(): Promise<T>;
|
|
726
|
+
getSchema<T = any>(folderPath: string): Promise<T>;
|
|
713
727
|
close(): void;
|
|
714
728
|
}
|
|
715
729
|
|
|
716
|
-
export { type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type ComponentList, type ComponentRef, type ComponentSummary, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, type FieldList, type FieldSummary, type FluxAPIKeyList, type FluxAPIKeyRef, type FluxAPIKeySummary, FluxClient, type FluxClientOptions, type FluxRoleList, type FluxRoleRef, type FluxRoleSummary, type FolderList, type FolderRef, type FolderSummary, FoxnoseAPIError, FoxnoseAuthError, type FoxnoseConfig, FoxnoseError, FoxnoseTransportError, HttpTransport, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, type RegionInfo, type RequestData, type ResourceList, type ResourceRef, type ResourceSummary, type RetryConfig, type RevisionList, type RevisionRef, type RevisionSummary, type RolePermission, type RolePermissionObject, SDK_VERSION, type SchemaVersionList, type SchemaVersionRef, type SchemaVersionSummary, SecureKeyAuth, SimpleKeyAuth, StaticTokenProvider, type StorageUsage, type TokenProvider, type UnitsUsage, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, createConfig, resolveKey };
|
|
730
|
+
export { type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type ApiFolderOptions, type ApiFolderRouteDescriptionOptions, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type ComponentList, type ComponentRef, type ComponentSummary, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, type FieldList, type FieldSummary, type FluxAPIKeyList, type FluxAPIKeyRef, type FluxAPIKeySummary, FluxClient, type FluxClientOptions, type FluxRoleList, type FluxRoleRef, type FluxRoleSummary, type FolderList, type FolderRef, type FolderSummary, FoxnoseAPIError, FoxnoseAuthError, type FoxnoseConfig, FoxnoseError, FoxnoseTransportError, HttpTransport, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, type RegionInfo, type RequestData, type ResourceList, type ResourceRef, type ResourceSummary, type RetryConfig, type RevisionList, type RevisionRef, type RevisionSummary, type RolePermission, type RolePermissionObject, SDK_VERSION, type SchemaVersionList, type SchemaVersionRef, type SchemaVersionSummary, SecureKeyAuth, SimpleKeyAuth, StaticTokenProvider, type StorageUsage, type TokenProvider, type UnitsUsage, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, createConfig, resolveKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -93,8 +93,8 @@ interface RetryConfig {
|
|
|
93
93
|
methods: readonly string[];
|
|
94
94
|
}
|
|
95
95
|
declare const DEFAULT_RETRY_CONFIG: Readonly<RetryConfig>;
|
|
96
|
-
declare const SDK_VERSION = "0.
|
|
97
|
-
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.
|
|
96
|
+
declare const SDK_VERSION = "0.2.1";
|
|
97
|
+
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.2.1";
|
|
98
98
|
/**
|
|
99
99
|
* General transport-level configuration shared by all clients.
|
|
100
100
|
*/
|
|
@@ -385,6 +385,10 @@ interface APIFolderSummary {
|
|
|
385
385
|
api?: string | null;
|
|
386
386
|
path?: string | null;
|
|
387
387
|
allowed_methods?: string[] | null;
|
|
388
|
+
description_get_one?: string | null;
|
|
389
|
+
description_get_many?: string | null;
|
|
390
|
+
description_search?: string | null;
|
|
391
|
+
description_schema?: string | null;
|
|
388
392
|
created_at?: string | null;
|
|
389
393
|
}
|
|
390
394
|
type APIFolderList = PaginatedResponse<APIFolderSummary>;
|
|
@@ -519,6 +523,15 @@ interface ManagementClientOptions {
|
|
|
519
523
|
retryConfig?: RetryConfig;
|
|
520
524
|
defaultHeaders?: Record<string, string>;
|
|
521
525
|
}
|
|
526
|
+
interface ApiFolderRouteDescriptionOptions {
|
|
527
|
+
descriptionGetOne?: string;
|
|
528
|
+
descriptionGetMany?: string;
|
|
529
|
+
descriptionSearch?: string;
|
|
530
|
+
descriptionSchema?: string;
|
|
531
|
+
}
|
|
532
|
+
interface ApiFolderOptions extends ApiFolderRouteDescriptionOptions {
|
|
533
|
+
allowedMethods?: string[];
|
|
534
|
+
}
|
|
522
535
|
/**
|
|
523
536
|
* Client for the FoxNose Management API.
|
|
524
537
|
*
|
|
@@ -539,6 +552,9 @@ declare class ManagementClient {
|
|
|
539
552
|
parseJson?: boolean;
|
|
540
553
|
}): Promise<any>;
|
|
541
554
|
close(): void;
|
|
555
|
+
private normalizeListPayload;
|
|
556
|
+
private normalizePermissionObjectPayload;
|
|
557
|
+
private normalizePermissionObjectListPayload;
|
|
542
558
|
listOrganizations(): Promise<OrganizationList>;
|
|
543
559
|
getOrganization(orgKey: OrgRef): Promise<OrganizationSummary>;
|
|
544
560
|
updateOrganization(orgKey: OrgRef, payload: Record<string, any>): Promise<OrganizationSummary>;
|
|
@@ -563,13 +579,9 @@ declare class ManagementClient {
|
|
|
563
579
|
updateApi(apiKey: APIRef, payload: Record<string, any>): Promise<APIInfo>;
|
|
564
580
|
deleteApi(apiKey: APIRef): Promise<void>;
|
|
565
581
|
listApiFolders(apiKey: APIRef, params?: Record<string, any>): Promise<APIFolderList>;
|
|
566
|
-
addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?:
|
|
567
|
-
allowedMethods?: string[];
|
|
568
|
-
}): Promise<APIFolderSummary>;
|
|
582
|
+
addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
|
|
569
583
|
getApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<APIFolderSummary>;
|
|
570
|
-
updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?:
|
|
571
|
-
allowedMethods?: string[];
|
|
572
|
-
}): Promise<APIFolderSummary>;
|
|
584
|
+
updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
|
|
573
585
|
removeApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<void>;
|
|
574
586
|
listManagementRoles(params?: Record<string, any>): Promise<ManagementRoleList>;
|
|
575
587
|
createManagementRole(payload: Record<string, any>): Promise<ManagementRoleSummary>;
|
|
@@ -710,7 +722,9 @@ declare class FluxClient {
|
|
|
710
722
|
listResources<T = any>(folderPath: string, params?: Record<string, any>): Promise<T>;
|
|
711
723
|
getResource<T = any>(folderPath: string, resourceKey: string, params?: Record<string, any>): Promise<T>;
|
|
712
724
|
search<T = any>(folderPath: string, body: Record<string, any>): Promise<T>;
|
|
725
|
+
getRouter<T = any>(): Promise<T>;
|
|
726
|
+
getSchema<T = any>(folderPath: string): Promise<T>;
|
|
713
727
|
close(): void;
|
|
714
728
|
}
|
|
715
729
|
|
|
716
|
-
export { type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type ComponentList, type ComponentRef, type ComponentSummary, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, type FieldList, type FieldSummary, type FluxAPIKeyList, type FluxAPIKeyRef, type FluxAPIKeySummary, FluxClient, type FluxClientOptions, type FluxRoleList, type FluxRoleRef, type FluxRoleSummary, type FolderList, type FolderRef, type FolderSummary, FoxnoseAPIError, FoxnoseAuthError, type FoxnoseConfig, FoxnoseError, FoxnoseTransportError, HttpTransport, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, type RegionInfo, type RequestData, type ResourceList, type ResourceRef, type ResourceSummary, type RetryConfig, type RevisionList, type RevisionRef, type RevisionSummary, type RolePermission, type RolePermissionObject, SDK_VERSION, type SchemaVersionList, type SchemaVersionRef, type SchemaVersionSummary, SecureKeyAuth, SimpleKeyAuth, StaticTokenProvider, type StorageUsage, type TokenProvider, type UnitsUsage, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, createConfig, resolveKey };
|
|
730
|
+
export { type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type ApiFolderOptions, type ApiFolderRouteDescriptionOptions, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type ComponentList, type ComponentRef, type ComponentSummary, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, type FieldList, type FieldSummary, type FluxAPIKeyList, type FluxAPIKeyRef, type FluxAPIKeySummary, FluxClient, type FluxClientOptions, type FluxRoleList, type FluxRoleRef, type FluxRoleSummary, type FolderList, type FolderRef, type FolderSummary, FoxnoseAPIError, FoxnoseAuthError, type FoxnoseConfig, FoxnoseError, FoxnoseTransportError, HttpTransport, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, type RegionInfo, type RequestData, type ResourceList, type ResourceRef, type ResourceSummary, type RetryConfig, type RevisionList, type RevisionRef, type RevisionSummary, type RolePermission, type RolePermissionObject, SDK_VERSION, type SchemaVersionList, type SchemaVersionRef, type SchemaVersionSummary, SecureKeyAuth, SimpleKeyAuth, StaticTokenProvider, type StorageUsage, type TokenProvider, type UnitsUsage, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, createConfig, resolveKey };
|
package/dist/index.js
CHANGED
|
@@ -150,7 +150,7 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
150
150
|
statusCodes: [408, 425, 429, 500, 502, 503, 504],
|
|
151
151
|
methods: ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"]
|
|
152
152
|
};
|
|
153
|
-
var SDK_VERSION = "0.
|
|
153
|
+
var SDK_VERSION = "0.2.1";
|
|
154
154
|
var DEFAULT_USER_AGENT = `foxnose-sdk-js/${SDK_VERSION}`;
|
|
155
155
|
function createConfig(options) {
|
|
156
156
|
if (!options.baseUrl) {
|
|
@@ -366,9 +366,7 @@ function resolveKey(value) {
|
|
|
366
366
|
if (value && typeof value === "object" && "key" in value && typeof value.key === "string") {
|
|
367
367
|
return value.key;
|
|
368
368
|
}
|
|
369
|
-
throw new TypeError(
|
|
370
|
-
`Expected a string or an object with a 'key' attribute, got ${typeof value}`
|
|
371
|
-
);
|
|
369
|
+
throw new TypeError(`Expected a string or an object with a 'key' attribute, got ${typeof value}`);
|
|
372
370
|
}
|
|
373
371
|
|
|
374
372
|
// src/management/paths.ts
|
|
@@ -452,6 +450,38 @@ var ManagementClient = class {
|
|
|
452
450
|
close() {
|
|
453
451
|
this.transport.close();
|
|
454
452
|
}
|
|
453
|
+
normalizeListPayload(payload) {
|
|
454
|
+
if (Array.isArray(payload)) {
|
|
455
|
+
return payload;
|
|
456
|
+
}
|
|
457
|
+
if (payload && typeof payload === "object") {
|
|
458
|
+
const results = payload.results;
|
|
459
|
+
if (Array.isArray(results)) {
|
|
460
|
+
return results;
|
|
461
|
+
}
|
|
462
|
+
return [payload];
|
|
463
|
+
}
|
|
464
|
+
return [];
|
|
465
|
+
}
|
|
466
|
+
normalizePermissionObjectPayload(payload, requestPayload) {
|
|
467
|
+
if (payload && typeof payload === "object" && !Array.isArray(payload)) {
|
|
468
|
+
const data = { ...payload };
|
|
469
|
+
if (!("object_key" in data) && "object" in data) {
|
|
470
|
+
data.object_key = data.object;
|
|
471
|
+
delete data.object;
|
|
472
|
+
}
|
|
473
|
+
return data;
|
|
474
|
+
}
|
|
475
|
+
return {
|
|
476
|
+
content_type: requestPayload.content_type,
|
|
477
|
+
object_key: requestPayload.object_key ?? requestPayload.object
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
normalizePermissionObjectListPayload(payload) {
|
|
481
|
+
return this.normalizeListPayload(payload).map(
|
|
482
|
+
(item) => this.normalizePermissionObjectPayload(item, item)
|
|
483
|
+
);
|
|
484
|
+
}
|
|
455
485
|
// ------------------------------------------------------------------ //
|
|
456
486
|
// Organization operations
|
|
457
487
|
// ------------------------------------------------------------------ //
|
|
@@ -566,9 +596,21 @@ var ManagementClient = class {
|
|
|
566
596
|
const aKey = resolveKey(apiKey);
|
|
567
597
|
const fKey = resolveKey(folderKey);
|
|
568
598
|
const body = { folder: fKey };
|
|
569
|
-
if (options?.allowedMethods) {
|
|
599
|
+
if (options?.allowedMethods !== void 0) {
|
|
570
600
|
body.allowed_methods = options.allowedMethods;
|
|
571
601
|
}
|
|
602
|
+
if (options?.descriptionGetOne !== void 0) {
|
|
603
|
+
body.description_get_one = options.descriptionGetOne;
|
|
604
|
+
}
|
|
605
|
+
if (options?.descriptionGetMany !== void 0) {
|
|
606
|
+
body.description_get_many = options.descriptionGetMany;
|
|
607
|
+
}
|
|
608
|
+
if (options?.descriptionSearch !== void 0) {
|
|
609
|
+
body.description_search = options.descriptionSearch;
|
|
610
|
+
}
|
|
611
|
+
if (options?.descriptionSchema !== void 0) {
|
|
612
|
+
body.description_schema = options.descriptionSchema;
|
|
613
|
+
}
|
|
572
614
|
return this.request("POST", `${this.paths.apiFoldersRoot(aKey)}/`, { jsonBody: body });
|
|
573
615
|
}
|
|
574
616
|
async getApiFolder(apiKey, folderKey) {
|
|
@@ -580,9 +622,21 @@ var ManagementClient = class {
|
|
|
580
622
|
const aKey = resolveKey(apiKey);
|
|
581
623
|
const fKey = resolveKey(folderKey);
|
|
582
624
|
const body = {};
|
|
583
|
-
if (options?.allowedMethods) {
|
|
625
|
+
if (options?.allowedMethods !== void 0) {
|
|
584
626
|
body.allowed_methods = options.allowedMethods;
|
|
585
627
|
}
|
|
628
|
+
if (options?.descriptionGetOne !== void 0) {
|
|
629
|
+
body.description_get_one = options.descriptionGetOne;
|
|
630
|
+
}
|
|
631
|
+
if (options?.descriptionGetMany !== void 0) {
|
|
632
|
+
body.description_get_many = options.descriptionGetMany;
|
|
633
|
+
}
|
|
634
|
+
if (options?.descriptionSearch !== void 0) {
|
|
635
|
+
body.description_search = options.descriptionSearch;
|
|
636
|
+
}
|
|
637
|
+
if (options?.descriptionSchema !== void 0) {
|
|
638
|
+
body.description_schema = options.descriptionSchema;
|
|
639
|
+
}
|
|
586
640
|
return this.request("PUT", `${this.paths.apiFoldersRoot(aKey)}/${fKey}/`, {
|
|
587
641
|
jsonBody: body
|
|
588
642
|
});
|
|
@@ -652,14 +706,15 @@ var ManagementClient = class {
|
|
|
652
706
|
const key = resolveKey(roleKey);
|
|
653
707
|
const payload = await this.request("GET", `${this.paths.rolePermissionObjectsRoot(key)}/`, {
|
|
654
708
|
params: { content_type: contentType }
|
|
655
|
-
})
|
|
656
|
-
return
|
|
709
|
+
});
|
|
710
|
+
return this.normalizePermissionObjectListPayload(payload);
|
|
657
711
|
}
|
|
658
712
|
async addManagementPermissionObject(roleKey, payload) {
|
|
659
713
|
const key = resolveKey(roleKey);
|
|
660
|
-
|
|
714
|
+
const data = await this.request("POST", `${this.paths.rolePermissionObjectsRoot(key)}/`, {
|
|
661
715
|
jsonBody: payload
|
|
662
716
|
});
|
|
717
|
+
return this.normalizePermissionObjectPayload(data, payload);
|
|
663
718
|
}
|
|
664
719
|
async deleteManagementPermissionObject(roleKey, payload) {
|
|
665
720
|
const key = resolveKey(roleKey);
|
|
@@ -703,11 +758,10 @@ var ManagementClient = class {
|
|
|
703
758
|
}
|
|
704
759
|
async deleteFluxRolePermission(roleKey, contentType) {
|
|
705
760
|
const key = resolveKey(roleKey);
|
|
706
|
-
await this.request(
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
);
|
|
761
|
+
await this.request("DELETE", `${this.paths.fluxRolePermissionsRoot(key)}/`, {
|
|
762
|
+
params: { content_type: contentType },
|
|
763
|
+
parseJson: false
|
|
764
|
+
});
|
|
711
765
|
}
|
|
712
766
|
async replaceFluxRolePermissions(roleKey, permissions) {
|
|
713
767
|
const key = resolveKey(roleKey);
|
|
@@ -721,14 +775,15 @@ var ManagementClient = class {
|
|
|
721
775
|
const key = resolveKey(roleKey);
|
|
722
776
|
const payload = await this.request("GET", `${this.paths.fluxRolePermissionObjectsRoot(key)}/`, {
|
|
723
777
|
params: { content_type: contentType }
|
|
724
|
-
})
|
|
725
|
-
return
|
|
778
|
+
});
|
|
779
|
+
return this.normalizePermissionObjectListPayload(payload);
|
|
726
780
|
}
|
|
727
781
|
async addFluxPermissionObject(roleKey, payload) {
|
|
728
782
|
const key = resolveKey(roleKey);
|
|
729
|
-
|
|
783
|
+
const data = await this.request("POST", `${this.paths.fluxRolePermissionObjectsRoot(key)}/`, {
|
|
730
784
|
jsonBody: payload
|
|
731
785
|
});
|
|
786
|
+
return this.normalizePermissionObjectPayload(data, payload);
|
|
732
787
|
}
|
|
733
788
|
async deleteFluxPermissionObject(roleKey, payload) {
|
|
734
789
|
const key = resolveKey(roleKey);
|
|
@@ -823,10 +878,7 @@ var ManagementClient = class {
|
|
|
823
878
|
async publishFolderVersion(folderKey, versionKey) {
|
|
824
879
|
const fKey = resolveKey(folderKey);
|
|
825
880
|
const vKey = resolveKey(versionKey);
|
|
826
|
-
return this.request(
|
|
827
|
-
"POST",
|
|
828
|
-
`${this.paths.folderVersionsBase(fKey)}/${vKey}/publish/`
|
|
829
|
-
);
|
|
881
|
+
return this.request("POST", `${this.paths.folderVersionsBase(fKey)}/${vKey}/publish/`);
|
|
830
882
|
}
|
|
831
883
|
// ------------------------------------------------------------------ //
|
|
832
884
|
// Folder field operations
|
|
@@ -846,29 +898,25 @@ var ManagementClient = class {
|
|
|
846
898
|
async getFolderField(folderKey, versionKey, fieldPath) {
|
|
847
899
|
const fKey = resolveKey(folderKey);
|
|
848
900
|
const vKey = resolveKey(versionKey);
|
|
849
|
-
return this.request(
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
{ params: { path: fieldPath } }
|
|
853
|
-
);
|
|
901
|
+
return this.request("GET", `${this.paths.folderSchemaTree(fKey, vKey)}/field/`, {
|
|
902
|
+
params: { path: fieldPath }
|
|
903
|
+
});
|
|
854
904
|
}
|
|
855
905
|
async updateFolderField(folderKey, versionKey, fieldPath, payload) {
|
|
856
906
|
const fKey = resolveKey(folderKey);
|
|
857
907
|
const vKey = resolveKey(versionKey);
|
|
858
|
-
return this.request(
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
);
|
|
908
|
+
return this.request("PUT", `${this.paths.folderSchemaTree(fKey, vKey)}/field/`, {
|
|
909
|
+
params: { path: fieldPath },
|
|
910
|
+
jsonBody: payload
|
|
911
|
+
});
|
|
863
912
|
}
|
|
864
913
|
async deleteFolderField(folderKey, versionKey, fieldPath) {
|
|
865
914
|
const fKey = resolveKey(folderKey);
|
|
866
915
|
const vKey = resolveKey(versionKey);
|
|
867
|
-
await this.request(
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
);
|
|
916
|
+
await this.request("DELETE", `${this.paths.folderSchemaTree(fKey, vKey)}/field/`, {
|
|
917
|
+
params: { path: fieldPath },
|
|
918
|
+
parseJson: false
|
|
919
|
+
});
|
|
872
920
|
}
|
|
873
921
|
// ------------------------------------------------------------------ //
|
|
874
922
|
// Component operations
|
|
@@ -923,10 +971,7 @@ var ManagementClient = class {
|
|
|
923
971
|
async publishComponentVersion(componentKey, versionKey) {
|
|
924
972
|
const cKey = resolveKey(componentKey);
|
|
925
973
|
const vKey = resolveKey(versionKey);
|
|
926
|
-
return this.request(
|
|
927
|
-
"POST",
|
|
928
|
-
`${this.paths.componentVersionsBase(cKey)}/${vKey}/publish/`
|
|
929
|
-
);
|
|
974
|
+
return this.request("POST", `${this.paths.componentVersionsBase(cKey)}/${vKey}/publish/`);
|
|
930
975
|
}
|
|
931
976
|
async updateComponentVersion(componentKey, versionKey, payload) {
|
|
932
977
|
const cKey = resolveKey(componentKey);
|
|
@@ -960,29 +1005,25 @@ var ManagementClient = class {
|
|
|
960
1005
|
async getComponentField(componentKey, versionKey, fieldPath) {
|
|
961
1006
|
const cKey = resolveKey(componentKey);
|
|
962
1007
|
const vKey = resolveKey(versionKey);
|
|
963
|
-
return this.request(
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
{ params: { path: fieldPath } }
|
|
967
|
-
);
|
|
1008
|
+
return this.request("GET", `${this.paths.componentSchemaTree(cKey, vKey)}/field/`, {
|
|
1009
|
+
params: { path: fieldPath }
|
|
1010
|
+
});
|
|
968
1011
|
}
|
|
969
1012
|
async updateComponentField(componentKey, versionKey, fieldPath, payload) {
|
|
970
1013
|
const cKey = resolveKey(componentKey);
|
|
971
1014
|
const vKey = resolveKey(versionKey);
|
|
972
|
-
return this.request(
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
);
|
|
1015
|
+
return this.request("PUT", `${this.paths.componentSchemaTree(cKey, vKey)}/field/`, {
|
|
1016
|
+
params: { path: fieldPath },
|
|
1017
|
+
jsonBody: payload
|
|
1018
|
+
});
|
|
977
1019
|
}
|
|
978
1020
|
async deleteComponentField(componentKey, versionKey, fieldPath) {
|
|
979
1021
|
const cKey = resolveKey(componentKey);
|
|
980
1022
|
const vKey = resolveKey(versionKey);
|
|
981
|
-
await this.request(
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
);
|
|
1023
|
+
await this.request("DELETE", `${this.paths.componentSchemaTree(cKey, vKey)}/field/`, {
|
|
1024
|
+
params: { path: fieldPath },
|
|
1025
|
+
parseJson: false
|
|
1026
|
+
});
|
|
986
1027
|
}
|
|
987
1028
|
// ------------------------------------------------------------------ //
|
|
988
1029
|
// Resource operations
|
|
@@ -1147,10 +1188,7 @@ var ManagementClient = class {
|
|
|
1147
1188
|
const fKey = resolveKey(folderKey);
|
|
1148
1189
|
const rKey = resolveKey(resourceKey);
|
|
1149
1190
|
const rvKey = resolveKey(revisionKey);
|
|
1150
|
-
return this.request(
|
|
1151
|
-
"POST",
|
|
1152
|
-
`${this.paths.revisionBase(fKey, rKey)}/${rvKey}/validate/`
|
|
1153
|
-
);
|
|
1191
|
+
return this.request("POST", `${this.paths.revisionBase(fKey, rKey)}/${rvKey}/validate/`);
|
|
1154
1192
|
}
|
|
1155
1193
|
async getRevisionData(folderKey, resourceKey, revisionKey) {
|
|
1156
1194
|
const fKey = resolveKey(folderKey);
|
|
@@ -1255,11 +1293,9 @@ var ManagementClient = class {
|
|
|
1255
1293
|
const oKey = resolveKey(orgKey);
|
|
1256
1294
|
const pKey = resolveKey(projectKey);
|
|
1257
1295
|
const eKey = resolveKey(envKey);
|
|
1258
|
-
await this.request(
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
{ jsonBody: { is_enabled: isEnabled } }
|
|
1262
|
-
);
|
|
1296
|
+
await this.request("POST", `${this.paths.environmentRoot(oKey, pKey, eKey)}/toggle/`, {
|
|
1297
|
+
jsonBody: { is_enabled: isEnabled }
|
|
1298
|
+
});
|
|
1263
1299
|
}
|
|
1264
1300
|
async updateEnvironmentProtection(orgKey, projectKey, envKey, options) {
|
|
1265
1301
|
const oKey = resolveKey(orgKey);
|
|
@@ -1269,11 +1305,9 @@ var ManagementClient = class {
|
|
|
1269
1305
|
if (options.protectionReason) {
|
|
1270
1306
|
body.protection_reason = options.protectionReason;
|
|
1271
1307
|
}
|
|
1272
|
-
return this.request(
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
{ jsonBody: body }
|
|
1276
|
-
);
|
|
1308
|
+
return this.request("PATCH", `${this.paths.environmentRoot(oKey, pKey, eKey)}/protection/`, {
|
|
1309
|
+
jsonBody: body
|
|
1310
|
+
});
|
|
1277
1311
|
}
|
|
1278
1312
|
async clearEnvironmentProtection(orgKey, projectKey, envKey) {
|
|
1279
1313
|
return this.updateEnvironmentProtection(orgKey, projectKey, envKey, {
|
|
@@ -1326,6 +1360,14 @@ var FluxClient = class {
|
|
|
1326
1360
|
const path = this.buildPath(folderPath, "/_search");
|
|
1327
1361
|
return this.transport.request("POST", path, { jsonBody: body });
|
|
1328
1362
|
}
|
|
1363
|
+
async getRouter() {
|
|
1364
|
+
const path = `/${this.apiPrefix}/_router`;
|
|
1365
|
+
return this.transport.request("GET", path);
|
|
1366
|
+
}
|
|
1367
|
+
async getSchema(folderPath) {
|
|
1368
|
+
const path = this.buildPath(folderPath, "/_schema");
|
|
1369
|
+
return this.transport.request("GET", path);
|
|
1370
|
+
}
|
|
1329
1371
|
close() {
|
|
1330
1372
|
this.transport.close();
|
|
1331
1373
|
}
|