@foxnose/sdk 0.3.0 → 0.4.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/README.md +103 -5
- package/dist/index.cjs +522 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +282 -8
- package/dist/index.d.ts +282 -8
- package/dist/index.js +517 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,14 +31,19 @@ __export(index_exports, {
|
|
|
31
31
|
HttpTransport: () => HttpTransport,
|
|
32
32
|
JWTAuth: () => JWTAuth,
|
|
33
33
|
ManagementClient: () => ManagementClient,
|
|
34
|
+
PlanExhaustedError: () => PlanExhaustedError,
|
|
35
|
+
PlanLimitExceededError: () => PlanLimitExceededError,
|
|
36
|
+
RateLimitExceededError: () => RateLimitExceededError,
|
|
34
37
|
SDK_VERSION: () => SDK_VERSION,
|
|
35
38
|
SearchMode: () => SearchMode,
|
|
36
39
|
SecureKeyAuth: () => SecureKeyAuth,
|
|
37
40
|
SimpleKeyAuth: () => SimpleKeyAuth,
|
|
41
|
+
SpendCapExceededError: () => SpendCapExceededError,
|
|
38
42
|
StaticTokenProvider: () => StaticTokenProvider,
|
|
39
43
|
VERSION: () => SDK_VERSION,
|
|
40
44
|
buildSearchBody: () => buildSearchBody,
|
|
41
45
|
createConfig: () => createConfig,
|
|
46
|
+
nestedFieldMeta: () => nestedFieldMeta,
|
|
42
47
|
resolveKey: () => resolveKey
|
|
43
48
|
});
|
|
44
49
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -108,6 +113,119 @@ var FoxnoseAPIError = class extends FoxnoseError {
|
|
|
108
113
|
this.responseBody = options.responseBody;
|
|
109
114
|
}
|
|
110
115
|
};
|
|
116
|
+
var SpendCapExceededError = class extends FoxnoseAPIError {
|
|
117
|
+
/** Spend cap in USD, or null when unset on the server side. */
|
|
118
|
+
capUsd;
|
|
119
|
+
/** ISO timestamp when the current billing cycle resets. */
|
|
120
|
+
cycleResetsAt;
|
|
121
|
+
/** URL where the spend cap can be raised. */
|
|
122
|
+
raiseCapUrl;
|
|
123
|
+
constructor(options) {
|
|
124
|
+
super(options);
|
|
125
|
+
this.name = "SpendCapExceededError";
|
|
126
|
+
this.capUsd = options.capUsd;
|
|
127
|
+
this.cycleResetsAt = options.cycleResetsAt;
|
|
128
|
+
this.raiseCapUrl = options.raiseCapUrl;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var PlanExhaustedError = class extends FoxnoseAPIError {
|
|
132
|
+
/** Usage axis that was exhausted (e.g. retrievals, writes, data_storage, vector_storage). */
|
|
133
|
+
axis;
|
|
134
|
+
/** ISO timestamp when the usage window resets. */
|
|
135
|
+
windowResetsAt;
|
|
136
|
+
/** URL where the plan can be upgraded. */
|
|
137
|
+
upgradeUrl;
|
|
138
|
+
constructor(options) {
|
|
139
|
+
super(options);
|
|
140
|
+
this.name = "PlanExhaustedError";
|
|
141
|
+
this.axis = options.axis;
|
|
142
|
+
this.windowResetsAt = options.windowResetsAt;
|
|
143
|
+
this.upgradeUrl = options.upgradeUrl;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var PlanLimitExceededError = class extends FoxnoseAPIError {
|
|
147
|
+
/** Entity whose limit was exceeded (e.g. collections, environments, api_keys). */
|
|
148
|
+
entity;
|
|
149
|
+
/** Maximum allowed by the current plan. */
|
|
150
|
+
limit;
|
|
151
|
+
/** Current count that triggered the error. */
|
|
152
|
+
current;
|
|
153
|
+
/** URL where the plan can be upgraded, if provided. */
|
|
154
|
+
upgradeUrl;
|
|
155
|
+
constructor(options) {
|
|
156
|
+
super(options);
|
|
157
|
+
this.name = "PlanLimitExceededError";
|
|
158
|
+
this.entity = options.entity;
|
|
159
|
+
this.limit = options.limit;
|
|
160
|
+
this.current = options.current;
|
|
161
|
+
this.upgradeUrl = options.upgradeUrl;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
var RateLimitExceededError = class extends FoxnoseAPIError {
|
|
165
|
+
/** Seconds to wait before retrying, from the Retry-After header. */
|
|
166
|
+
retryAfter;
|
|
167
|
+
constructor(options) {
|
|
168
|
+
super(options);
|
|
169
|
+
this.name = "RateLimitExceededError";
|
|
170
|
+
this.retryAfter = options.retryAfter;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
function isPlainObject(value) {
|
|
174
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
175
|
+
}
|
|
176
|
+
function getHeader(headers, name) {
|
|
177
|
+
if (!headers) {
|
|
178
|
+
return void 0;
|
|
179
|
+
}
|
|
180
|
+
const target = name.toLowerCase();
|
|
181
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
182
|
+
if (key.toLowerCase() === target) {
|
|
183
|
+
return value;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return void 0;
|
|
187
|
+
}
|
|
188
|
+
function buildAPIError(options) {
|
|
189
|
+
const { statusCode, errorCode, detail, responseHeaders, responseBody } = options;
|
|
190
|
+
const body = isPlainObject(responseBody) ? responseBody : void 0;
|
|
191
|
+
if (statusCode === 402 && errorCode === "spend_cap_reached" && body) {
|
|
192
|
+
return new SpendCapExceededError({
|
|
193
|
+
...options,
|
|
194
|
+
message: "message" in body ? options.message : "Spend cap reached",
|
|
195
|
+
capUsd: typeof body.cap_usd === "number" ? body.cap_usd : body.cap_usd === null ? null : void 0,
|
|
196
|
+
cycleResetsAt: typeof body.cycle_resets_at === "string" ? body.cycle_resets_at : void 0,
|
|
197
|
+
raiseCapUrl: typeof body.raise_cap_url === "string" ? body.raise_cap_url : void 0
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (statusCode === 402 && errorCode === "plan_exhausted" && body) {
|
|
201
|
+
return new PlanExhaustedError({
|
|
202
|
+
...options,
|
|
203
|
+
message: "message" in body ? options.message : "Plan allowance exhausted",
|
|
204
|
+
axis: typeof body.axis === "string" ? body.axis : void 0,
|
|
205
|
+
windowResetsAt: typeof body.window_resets_at === "string" ? body.window_resets_at : void 0,
|
|
206
|
+
upgradeUrl: typeof body.upgrade_url === "string" ? body.upgrade_url : void 0
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (statusCode === 403 && errorCode === "plan_limit_exceeded") {
|
|
210
|
+
const d = isPlainObject(detail) ? detail : {};
|
|
211
|
+
return new PlanLimitExceededError({
|
|
212
|
+
...options,
|
|
213
|
+
entity: typeof d.entity === "string" ? d.entity : void 0,
|
|
214
|
+
limit: typeof d.limit === "number" ? d.limit : void 0,
|
|
215
|
+
current: typeof d.current === "number" ? d.current : void 0,
|
|
216
|
+
upgradeUrl: typeof d.upgrade_url === "string" ? d.upgrade_url : void 0
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (statusCode === 429 && errorCode === "rate_limited") {
|
|
220
|
+
const raw = getHeader(responseHeaders, "Retry-After");
|
|
221
|
+
const parsed = raw !== void 0 ? Number(raw) : NaN;
|
|
222
|
+
return new RateLimitExceededError({
|
|
223
|
+
...options,
|
|
224
|
+
retryAfter: Number.isNaN(parsed) ? void 0 : parsed
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return new FoxnoseAPIError(options);
|
|
228
|
+
}
|
|
111
229
|
var FoxnoseAuthError = class extends FoxnoseError {
|
|
112
230
|
constructor(message) {
|
|
113
231
|
super(message);
|
|
@@ -192,7 +310,7 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
192
310
|
statusCodes: [408, 425, 429, 500, 502, 503, 504],
|
|
193
311
|
methods: ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"]
|
|
194
312
|
};
|
|
195
|
-
var SDK_VERSION = "0.
|
|
313
|
+
var SDK_VERSION = "0.4.0";
|
|
196
314
|
var DEFAULT_USER_AGENT = `foxnose-sdk-js/${SDK_VERSION}`;
|
|
197
315
|
function createConfig(options) {
|
|
198
316
|
if (!options.baseUrl) {
|
|
@@ -372,10 +490,12 @@ var HttpTransport = class {
|
|
|
372
490
|
if (text) {
|
|
373
491
|
try {
|
|
374
492
|
const payload = JSON.parse(text);
|
|
375
|
-
message = payload.message ?? message;
|
|
376
|
-
errorCode = payload.error_code;
|
|
377
|
-
detail = payload.detail;
|
|
378
493
|
body = payload;
|
|
494
|
+
if (payload && typeof payload === "object" && !Array.isArray(payload)) {
|
|
495
|
+
message = payload.message ?? message;
|
|
496
|
+
errorCode = payload.error_code;
|
|
497
|
+
detail = payload.detail;
|
|
498
|
+
}
|
|
379
499
|
} catch {
|
|
380
500
|
body = text;
|
|
381
501
|
}
|
|
@@ -386,7 +506,7 @@ var HttpTransport = class {
|
|
|
386
506
|
response.headers.forEach((value, key) => {
|
|
387
507
|
responseHeaders[key] = value;
|
|
388
508
|
});
|
|
389
|
-
throw
|
|
509
|
+
throw buildAPIError({
|
|
390
510
|
message: message || "API request failed",
|
|
391
511
|
statusCode: response.status,
|
|
392
512
|
errorCode,
|
|
@@ -400,7 +520,38 @@ var HttpTransport = class {
|
|
|
400
520
|
}
|
|
401
521
|
};
|
|
402
522
|
|
|
523
|
+
// src/_deprecation.ts
|
|
524
|
+
var warned = /* @__PURE__ */ new Set();
|
|
525
|
+
function warnDeprecatedMethod(oldName, newName, removal = "1.0") {
|
|
526
|
+
if (warned.has(oldName)) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
warned.add(oldName);
|
|
530
|
+
console.warn(
|
|
531
|
+
`@foxnose/sdk: ${oldName}() is deprecated; use ${newName}() instead. ${oldName}() will be removed in @foxnose/sdk ${removal}.`
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
|
|
403
535
|
// src/management/models.ts
|
|
536
|
+
function nestedFieldMeta(opts) {
|
|
537
|
+
if (opts.extra) {
|
|
538
|
+
const reserved = ["component", "component_version", "auto_update"];
|
|
539
|
+
const collisions = reserved.filter(
|
|
540
|
+
(k) => Object.prototype.hasOwnProperty.call(opts.extra, k)
|
|
541
|
+
);
|
|
542
|
+
if (collisions.length > 0) {
|
|
543
|
+
throw new Error(
|
|
544
|
+
`nestedFieldMeta: 'extra' must not include reserved keys: ${collisions.join(", ")}`
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return {
|
|
549
|
+
...opts.extra ?? {},
|
|
550
|
+
component: opts.component,
|
|
551
|
+
component_version: opts.componentVersion,
|
|
552
|
+
auto_update: opts.autoUpdate ?? false
|
|
553
|
+
};
|
|
554
|
+
}
|
|
404
555
|
function resolveKey(value) {
|
|
405
556
|
if (typeof value === "string") {
|
|
406
557
|
return value;
|
|
@@ -420,11 +571,18 @@ function managementPaths(environmentKey) {
|
|
|
420
571
|
projectRoot: (orgKey, projectKey) => `/organizations/${orgKey}/projects/${projectKey}`,
|
|
421
572
|
environmentsBase: (orgKey, projectKey) => `/organizations/${orgKey}/projects/${projectKey}/environments`,
|
|
422
573
|
environmentRoot: (orgKey, projectKey, envKey) => `/organizations/${orgKey}/projects/${projectKey}/environments/${envKey}`,
|
|
423
|
-
// Folder paths
|
|
574
|
+
// Folder paths (deprecated — see Collection paths below).
|
|
424
575
|
foldersTreeRoot: () => `/v1/${environmentKey}/folders/tree`,
|
|
425
576
|
foldersTreeItem: () => `/v1/${environmentKey}/folders/tree/folder`,
|
|
426
577
|
folderVersionsBase: (folderKey) => `/v1/${environmentKey}/folders/${folderKey}/model/versions`,
|
|
427
578
|
folderSchemaTree: (folderKey, versionKey) => `/v1/${environmentKey}/folders/${folderKey}/model/versions/${versionKey}/schema/tree`,
|
|
579
|
+
// Collection paths (canonical going forward; folder paths above hit the
|
|
580
|
+
// deprecated /folders/ URL alias on the server side).
|
|
581
|
+
collectionsTreeRoot: () => `/v1/${environmentKey}/collections/tree`,
|
|
582
|
+
collectionsTreeItem: () => `/v1/${environmentKey}/collections/tree/collection`,
|
|
583
|
+
collectionVersionsBase: (collectionKey) => `/v1/${environmentKey}/collections/${collectionKey}/model/versions`,
|
|
584
|
+
collectionSchemaTree: (collectionKey, versionKey) => `/v1/${environmentKey}/collections/${collectionKey}/model/versions/${versionKey}/schema/tree`,
|
|
585
|
+
collectionSyncComponent: (collectionKey) => `/v1/${environmentKey}/collections/${collectionKey}/sync_component`,
|
|
428
586
|
// Component paths
|
|
429
587
|
componentsRoot: () => `/v1/${environmentKey}/components`,
|
|
430
588
|
componentRoot: (componentKey) => `/v1/${environmentKey}/components/${componentKey}`,
|
|
@@ -443,6 +601,7 @@ function managementPaths(environmentKey) {
|
|
|
443
601
|
apisRoot: () => `/v1/${environmentKey}/api`,
|
|
444
602
|
apiRoot: (apiKey) => `/v1/${environmentKey}/api/${apiKey}`,
|
|
445
603
|
apiFoldersRoot: (apiKey) => `/v1/${environmentKey}/api/${apiKey}/folders`,
|
|
604
|
+
apiCollectionsRoot: (apiKey) => `/v1/${environmentKey}/api/${apiKey}/collections`,
|
|
446
605
|
// Management role paths
|
|
447
606
|
managementRolesRoot: () => `/v1/${environmentKey}/permissions/management-api/roles`,
|
|
448
607
|
managementRoleRoot: (roleKey) => `/v1/${environmentKey}/permissions/management-api/roles/${roleKey}`,
|
|
@@ -628,13 +787,84 @@ var ManagementClient = class {
|
|
|
628
787
|
await this.request("DELETE", `${this.paths.apiRoot(key)}/`, { parseJson: false });
|
|
629
788
|
}
|
|
630
789
|
// ------------------------------------------------------------------ //
|
|
631
|
-
// API
|
|
790
|
+
// API ↔ Collection association (canonical)
|
|
632
791
|
// ------------------------------------------------------------------ //
|
|
792
|
+
async listApiCollections(apiKey, params) {
|
|
793
|
+
const key = resolveKey(apiKey);
|
|
794
|
+
return this.request("GET", `${this.paths.apiCollectionsRoot(key)}/`, { params });
|
|
795
|
+
}
|
|
796
|
+
async addApiCollection(apiKey, collectionKey, options) {
|
|
797
|
+
const aKey = resolveKey(apiKey);
|
|
798
|
+
const cKey = resolveKey(collectionKey);
|
|
799
|
+
const body = { folder: cKey };
|
|
800
|
+
if (options?.allowedMethods !== void 0) {
|
|
801
|
+
body.allowed_methods = options.allowedMethods;
|
|
802
|
+
}
|
|
803
|
+
if (options?.descriptionGetOne !== void 0) {
|
|
804
|
+
body.description_get_one = options.descriptionGetOne;
|
|
805
|
+
}
|
|
806
|
+
if (options?.descriptionGetMany !== void 0) {
|
|
807
|
+
body.description_get_many = options.descriptionGetMany;
|
|
808
|
+
}
|
|
809
|
+
if (options?.descriptionSearch !== void 0) {
|
|
810
|
+
body.description_search = options.descriptionSearch;
|
|
811
|
+
}
|
|
812
|
+
if (options?.descriptionSchema !== void 0) {
|
|
813
|
+
body.description_schema = options.descriptionSchema;
|
|
814
|
+
}
|
|
815
|
+
return this.request("POST", `${this.paths.apiCollectionsRoot(aKey)}/`, {
|
|
816
|
+
jsonBody: body
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
async getApiCollection(apiKey, collectionKey) {
|
|
820
|
+
const aKey = resolveKey(apiKey);
|
|
821
|
+
const cKey = resolveKey(collectionKey);
|
|
822
|
+
return this.request("GET", `${this.paths.apiCollectionsRoot(aKey)}/${cKey}/`);
|
|
823
|
+
}
|
|
824
|
+
async updateApiCollection(apiKey, collectionKey, options) {
|
|
825
|
+
const aKey = resolveKey(apiKey);
|
|
826
|
+
const cKey = resolveKey(collectionKey);
|
|
827
|
+
const body = {};
|
|
828
|
+
if (options?.allowedMethods !== void 0) {
|
|
829
|
+
body.allowed_methods = options.allowedMethods;
|
|
830
|
+
}
|
|
831
|
+
if (options?.descriptionGetOne !== void 0) {
|
|
832
|
+
body.description_get_one = options.descriptionGetOne;
|
|
833
|
+
}
|
|
834
|
+
if (options?.descriptionGetMany !== void 0) {
|
|
835
|
+
body.description_get_many = options.descriptionGetMany;
|
|
836
|
+
}
|
|
837
|
+
if (options?.descriptionSearch !== void 0) {
|
|
838
|
+
body.description_search = options.descriptionSearch;
|
|
839
|
+
}
|
|
840
|
+
if (options?.descriptionSchema !== void 0) {
|
|
841
|
+
body.description_schema = options.descriptionSchema;
|
|
842
|
+
}
|
|
843
|
+
return this.request("PUT", `${this.paths.apiCollectionsRoot(aKey)}/${cKey}/`, {
|
|
844
|
+
jsonBody: body
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
async removeApiCollection(apiKey, collectionKey) {
|
|
848
|
+
const aKey = resolveKey(apiKey);
|
|
849
|
+
const cKey = resolveKey(collectionKey);
|
|
850
|
+
await this.request(
|
|
851
|
+
"DELETE",
|
|
852
|
+
`${this.paths.apiCollectionsRoot(aKey)}/${cKey}/`,
|
|
853
|
+
{ parseJson: false }
|
|
854
|
+
);
|
|
855
|
+
}
|
|
856
|
+
// ------------------------------------------------------------------ //
|
|
857
|
+
// API ↔ Folder association (deprecated; hits legacy /folders/ URL)
|
|
858
|
+
// ------------------------------------------------------------------ //
|
|
859
|
+
/** @deprecated Use {@link listApiCollections} instead. */
|
|
633
860
|
async listApiFolders(apiKey, params) {
|
|
861
|
+
warnDeprecatedMethod("listApiFolders", "listApiCollections");
|
|
634
862
|
const key = resolveKey(apiKey);
|
|
635
863
|
return this.request("GET", `${this.paths.apiFoldersRoot(key)}/`, { params });
|
|
636
864
|
}
|
|
865
|
+
/** @deprecated Use {@link addApiCollection} instead. */
|
|
637
866
|
async addApiFolder(apiKey, folderKey, options) {
|
|
867
|
+
warnDeprecatedMethod("addApiFolder", "addApiCollection");
|
|
638
868
|
const aKey = resolveKey(apiKey);
|
|
639
869
|
const fKey = resolveKey(folderKey);
|
|
640
870
|
const body = { folder: fKey };
|
|
@@ -655,12 +885,16 @@ var ManagementClient = class {
|
|
|
655
885
|
}
|
|
656
886
|
return this.request("POST", `${this.paths.apiFoldersRoot(aKey)}/`, { jsonBody: body });
|
|
657
887
|
}
|
|
888
|
+
/** @deprecated Use {@link getApiCollection} instead. */
|
|
658
889
|
async getApiFolder(apiKey, folderKey) {
|
|
890
|
+
warnDeprecatedMethod("getApiFolder", "getApiCollection");
|
|
659
891
|
const aKey = resolveKey(apiKey);
|
|
660
892
|
const fKey = resolveKey(folderKey);
|
|
661
893
|
return this.request("GET", `${this.paths.apiFoldersRoot(aKey)}/${fKey}/`);
|
|
662
894
|
}
|
|
895
|
+
/** @deprecated Use {@link updateApiCollection} instead. */
|
|
663
896
|
async updateApiFolder(apiKey, folderKey, options) {
|
|
897
|
+
warnDeprecatedMethod("updateApiFolder", "updateApiCollection");
|
|
664
898
|
const aKey = resolveKey(apiKey);
|
|
665
899
|
const fKey = resolveKey(folderKey);
|
|
666
900
|
const body = {};
|
|
@@ -683,7 +917,9 @@ var ManagementClient = class {
|
|
|
683
917
|
jsonBody: body
|
|
684
918
|
});
|
|
685
919
|
}
|
|
920
|
+
/** @deprecated Use {@link removeApiCollection} instead. */
|
|
686
921
|
async removeApiFolder(apiKey, folderKey) {
|
|
922
|
+
warnDeprecatedMethod("removeApiFolder", "removeApiCollection");
|
|
687
923
|
const aKey = resolveKey(apiKey);
|
|
688
924
|
const fKey = resolveKey(folderKey);
|
|
689
925
|
await this.request("DELETE", `${this.paths.apiFoldersRoot(aKey)}/${fKey}/`, {
|
|
@@ -835,39 +1071,271 @@ var ManagementClient = class {
|
|
|
835
1071
|
});
|
|
836
1072
|
}
|
|
837
1073
|
// ------------------------------------------------------------------ //
|
|
838
|
-
//
|
|
1074
|
+
// Collection operations (canonical)
|
|
1075
|
+
// ------------------------------------------------------------------ //
|
|
1076
|
+
async listCollections(params) {
|
|
1077
|
+
return this.request("GET", `${this.paths.collectionsTreeRoot()}/`, { params });
|
|
1078
|
+
}
|
|
1079
|
+
async getCollection(collectionKey) {
|
|
1080
|
+
const key = resolveKey(collectionKey);
|
|
1081
|
+
return this.request("GET", `${this.paths.collectionsTreeItem()}/`, {
|
|
1082
|
+
params: { key }
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
async getCollectionByPath(path) {
|
|
1086
|
+
return this.request("GET", `${this.paths.collectionsTreeItem()}/`, {
|
|
1087
|
+
params: { path }
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
async listCollectionTree(options) {
|
|
1091
|
+
const params = {};
|
|
1092
|
+
if (options?.key) params.key = options.key;
|
|
1093
|
+
if (options?.mode) params.mode = options.mode;
|
|
1094
|
+
return this.request("GET", `${this.paths.collectionsTreeRoot()}/`, { params });
|
|
1095
|
+
}
|
|
1096
|
+
async createCollection(payload) {
|
|
1097
|
+
return this.request("POST", `${this.paths.collectionsTreeRoot()}/`, {
|
|
1098
|
+
jsonBody: payload
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
async updateCollection(collectionKey, payload) {
|
|
1102
|
+
const key = resolveKey(collectionKey);
|
|
1103
|
+
return this.request("PUT", `${this.paths.collectionsTreeItem()}/`, {
|
|
1104
|
+
params: { key },
|
|
1105
|
+
jsonBody: payload
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
async deleteCollection(collectionKey) {
|
|
1109
|
+
const key = resolveKey(collectionKey);
|
|
1110
|
+
await this.request("DELETE", `${this.paths.collectionsTreeItem()}/`, {
|
|
1111
|
+
params: { key },
|
|
1112
|
+
parseJson: false
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
// ------------------------------------------------------------------ //
|
|
1116
|
+
// Collection schema version operations (canonical)
|
|
839
1117
|
// ------------------------------------------------------------------ //
|
|
1118
|
+
async listCollectionVersions(collectionKey, params) {
|
|
1119
|
+
const key = resolveKey(collectionKey);
|
|
1120
|
+
return this.request("GET", `${this.paths.collectionVersionsBase(key)}/`, {
|
|
1121
|
+
params
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
async createCollectionVersion(collectionKey, payload, options) {
|
|
1125
|
+
const key = resolveKey(collectionKey);
|
|
1126
|
+
const params = {};
|
|
1127
|
+
if (options?.copyFrom) {
|
|
1128
|
+
params.copy_from = resolveKey(options.copyFrom);
|
|
1129
|
+
}
|
|
1130
|
+
return this.request("POST", `${this.paths.collectionVersionsBase(key)}/`, {
|
|
1131
|
+
jsonBody: payload,
|
|
1132
|
+
params: Object.keys(params).length > 0 ? params : void 0
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
async getCollectionVersion(collectionKey, versionKey, options) {
|
|
1136
|
+
const cKey = resolveKey(collectionKey);
|
|
1137
|
+
const vKey = resolveKey(versionKey);
|
|
1138
|
+
const params = {};
|
|
1139
|
+
if (options?.includeSchema !== void 0) {
|
|
1140
|
+
params.include_schema = options.includeSchema;
|
|
1141
|
+
}
|
|
1142
|
+
return this.request(
|
|
1143
|
+
"GET",
|
|
1144
|
+
`${this.paths.collectionVersionsBase(cKey)}/${vKey}/`,
|
|
1145
|
+
{
|
|
1146
|
+
params: Object.keys(params).length > 0 ? params : void 0
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
async updateCollectionVersion(collectionKey, versionKey, payload) {
|
|
1151
|
+
const cKey = resolveKey(collectionKey);
|
|
1152
|
+
const vKey = resolveKey(versionKey);
|
|
1153
|
+
return this.request(
|
|
1154
|
+
"PUT",
|
|
1155
|
+
`${this.paths.collectionVersionsBase(cKey)}/${vKey}/`,
|
|
1156
|
+
{ jsonBody: payload }
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
async deleteCollectionVersion(collectionKey, versionKey) {
|
|
1160
|
+
const cKey = resolveKey(collectionKey);
|
|
1161
|
+
const vKey = resolveKey(versionKey);
|
|
1162
|
+
await this.request(
|
|
1163
|
+
"DELETE",
|
|
1164
|
+
`${this.paths.collectionVersionsBase(cKey)}/${vKey}/`,
|
|
1165
|
+
{ parseJson: false }
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
async publishCollectionVersion(collectionKey, versionKey) {
|
|
1169
|
+
const cKey = resolveKey(collectionKey);
|
|
1170
|
+
const vKey = resolveKey(versionKey);
|
|
1171
|
+
return this.request(
|
|
1172
|
+
"POST",
|
|
1173
|
+
`${this.paths.collectionVersionsBase(cKey)}/${vKey}/publish/`
|
|
1174
|
+
);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Advance pinned nested fields on a Collection to a target Component version.
|
|
1178
|
+
*
|
|
1179
|
+
* Creates a new published Collection schema version with the affected
|
|
1180
|
+
* `meta.component_version` pins advanced. Fields with `auto_update=true`
|
|
1181
|
+
* and fields already at the requested target version are reported in
|
|
1182
|
+
* `skipped` rather than advanced.
|
|
1183
|
+
*
|
|
1184
|
+
* @param collectionKey The Collection to sync.
|
|
1185
|
+
* @param options.fieldPaths Optional list of nested field paths to advance.
|
|
1186
|
+
* When omitted, every pinned (`auto_update=false`) nested field on the
|
|
1187
|
+
* Collection's current version is considered.
|
|
1188
|
+
* @param options.toVersions Optional per-path override mapping field path
|
|
1189
|
+
* to target Component Version UID. Paths not in this mapping advance to
|
|
1190
|
+
* the referenced Component's `current_version`. When both `fieldPaths`
|
|
1191
|
+
* and `toVersions` are supplied, every key in `toVersions` must also
|
|
1192
|
+
* appear in `fieldPaths`.
|
|
1193
|
+
*
|
|
1194
|
+
* @returns Summary of synced and skipped paths, plus the new
|
|
1195
|
+
* `schema_version` UID (`null` if no paths were advanced).
|
|
1196
|
+
*
|
|
1197
|
+
* @throws `Error` locally (before any HTTP request) when both `fieldPaths`
|
|
1198
|
+
* and `toVersions` are supplied AND `toVersions` contains a key that is
|
|
1199
|
+
* not in `fieldPaths` (mirrors the server-side validator so the misuse
|
|
1200
|
+
* surfaces at the call-site).
|
|
1201
|
+
* @throws `FoxnoseApiError` on:
|
|
1202
|
+
* - 409 `component_sync_conflict` — target version would break existing resources
|
|
1203
|
+
* - 422 `too_many_versions` — Collection schema quota exhausted
|
|
1204
|
+
* - 422 `validation_error` — request body invalid
|
|
1205
|
+
* - 404 — Collection or specified target version missing
|
|
1206
|
+
*
|
|
1207
|
+
* @example
|
|
1208
|
+
* ```ts
|
|
1209
|
+
* // Advance every pinned nested field to its Component's current version.
|
|
1210
|
+
* await client.syncCollectionComponent('articles');
|
|
1211
|
+
*
|
|
1212
|
+
* // Advance a specific path to a chosen Component version.
|
|
1213
|
+
* await client.syncCollectionComponent('articles', {
|
|
1214
|
+
* fieldPaths: ['seo'],
|
|
1215
|
+
* toVersions: { seo: 'ver-def67890' },
|
|
1216
|
+
* });
|
|
1217
|
+
* ```
|
|
1218
|
+
*/
|
|
1219
|
+
async syncCollectionComponent(collectionKey, options = {}) {
|
|
1220
|
+
const cKey = resolveKey(collectionKey);
|
|
1221
|
+
if (options.fieldPaths !== void 0 && options.toVersions !== void 0) {
|
|
1222
|
+
const fieldPathSet = new Set(options.fieldPaths);
|
|
1223
|
+
const extras = Object.keys(options.toVersions).filter((k) => !fieldPathSet.has(k)).sort();
|
|
1224
|
+
if (extras.length > 0) {
|
|
1225
|
+
throw new Error(
|
|
1226
|
+
`toVersions includes paths not present in fieldPaths: [${extras.join(", ")}]`
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
const body = {};
|
|
1231
|
+
if (options.fieldPaths !== void 0) {
|
|
1232
|
+
body.field_paths = options.fieldPaths;
|
|
1233
|
+
}
|
|
1234
|
+
if (options.toVersions !== void 0) {
|
|
1235
|
+
body.to_versions = options.toVersions;
|
|
1236
|
+
}
|
|
1237
|
+
return this.request(
|
|
1238
|
+
"POST",
|
|
1239
|
+
`${this.paths.collectionSyncComponent(cKey)}/`,
|
|
1240
|
+
{ jsonBody: body }
|
|
1241
|
+
);
|
|
1242
|
+
}
|
|
1243
|
+
// ------------------------------------------------------------------ //
|
|
1244
|
+
// Collection schema field operations (canonical)
|
|
1245
|
+
// ------------------------------------------------------------------ //
|
|
1246
|
+
async listCollectionFields(collectionKey, versionKey, params) {
|
|
1247
|
+
const cKey = resolveKey(collectionKey);
|
|
1248
|
+
const vKey = resolveKey(versionKey);
|
|
1249
|
+
return this.request(
|
|
1250
|
+
"GET",
|
|
1251
|
+
`${this.paths.collectionSchemaTree(cKey, vKey)}/`,
|
|
1252
|
+
{ params }
|
|
1253
|
+
);
|
|
1254
|
+
}
|
|
1255
|
+
async createCollectionField(collectionKey, versionKey, payload) {
|
|
1256
|
+
const cKey = resolveKey(collectionKey);
|
|
1257
|
+
const vKey = resolveKey(versionKey);
|
|
1258
|
+
return this.request(
|
|
1259
|
+
"POST",
|
|
1260
|
+
`${this.paths.collectionSchemaTree(cKey, vKey)}/`,
|
|
1261
|
+
{ jsonBody: payload }
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
async getCollectionField(collectionKey, versionKey, fieldPath) {
|
|
1265
|
+
const cKey = resolveKey(collectionKey);
|
|
1266
|
+
const vKey = resolveKey(versionKey);
|
|
1267
|
+
return this.request(
|
|
1268
|
+
"GET",
|
|
1269
|
+
`${this.paths.collectionSchemaTree(cKey, vKey)}/field/`,
|
|
1270
|
+
{ params: { path: fieldPath } }
|
|
1271
|
+
);
|
|
1272
|
+
}
|
|
1273
|
+
async updateCollectionField(collectionKey, versionKey, fieldPath, payload) {
|
|
1274
|
+
const cKey = resolveKey(collectionKey);
|
|
1275
|
+
const vKey = resolveKey(versionKey);
|
|
1276
|
+
return this.request(
|
|
1277
|
+
"PUT",
|
|
1278
|
+
`${this.paths.collectionSchemaTree(cKey, vKey)}/field/`,
|
|
1279
|
+
{ params: { path: fieldPath }, jsonBody: payload }
|
|
1280
|
+
);
|
|
1281
|
+
}
|
|
1282
|
+
async deleteCollectionField(collectionKey, versionKey, fieldPath) {
|
|
1283
|
+
const cKey = resolveKey(collectionKey);
|
|
1284
|
+
const vKey = resolveKey(versionKey);
|
|
1285
|
+
await this.request(
|
|
1286
|
+
"DELETE",
|
|
1287
|
+
`${this.paths.collectionSchemaTree(cKey, vKey)}/field/`,
|
|
1288
|
+
{ params: { path: fieldPath }, parseJson: false }
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
// ------------------------------------------------------------------ //
|
|
1292
|
+
// Folder operations (deprecated; hit legacy /folders/ URL)
|
|
1293
|
+
// ------------------------------------------------------------------ //
|
|
1294
|
+
/** @deprecated Use {@link listCollections} instead. */
|
|
840
1295
|
async listFolders(params) {
|
|
1296
|
+
warnDeprecatedMethod("listFolders", "listCollections");
|
|
841
1297
|
return this.request("GET", `${this.paths.foldersTreeRoot()}/`, { params });
|
|
842
1298
|
}
|
|
1299
|
+
/** @deprecated Use {@link getCollection} instead. */
|
|
843
1300
|
async getFolder(folderKey) {
|
|
1301
|
+
warnDeprecatedMethod("getFolder", "getCollection");
|
|
844
1302
|
const key = resolveKey(folderKey);
|
|
845
1303
|
return this.request("GET", `${this.paths.foldersTreeItem()}/`, {
|
|
846
1304
|
params: { key }
|
|
847
1305
|
});
|
|
848
1306
|
}
|
|
1307
|
+
/** @deprecated Use {@link getCollectionByPath} instead. */
|
|
849
1308
|
async getFolderByPath(path) {
|
|
1309
|
+
warnDeprecatedMethod("getFolderByPath", "getCollectionByPath");
|
|
850
1310
|
return this.request("GET", `${this.paths.foldersTreeItem()}/`, {
|
|
851
1311
|
params: { path }
|
|
852
1312
|
});
|
|
853
1313
|
}
|
|
1314
|
+
/** @deprecated Use {@link listCollectionTree} instead. */
|
|
854
1315
|
async listFolderTree(options) {
|
|
1316
|
+
warnDeprecatedMethod("listFolderTree", "listCollectionTree");
|
|
855
1317
|
const params = {};
|
|
856
1318
|
if (options?.key) params.key = options.key;
|
|
857
1319
|
if (options?.mode) params.mode = options.mode;
|
|
858
1320
|
return this.request("GET", `${this.paths.foldersTreeRoot()}/`, { params });
|
|
859
1321
|
}
|
|
1322
|
+
/** @deprecated Use {@link createCollection} instead. */
|
|
860
1323
|
async createFolder(payload) {
|
|
1324
|
+
warnDeprecatedMethod("createFolder", "createCollection");
|
|
861
1325
|
return this.request("POST", `${this.paths.foldersTreeRoot()}/`, { jsonBody: payload });
|
|
862
1326
|
}
|
|
1327
|
+
/** @deprecated Use {@link updateCollection} instead. */
|
|
863
1328
|
async updateFolder(folderKey, payload) {
|
|
1329
|
+
warnDeprecatedMethod("updateFolder", "updateCollection");
|
|
864
1330
|
const key = resolveKey(folderKey);
|
|
865
1331
|
return this.request("PUT", `${this.paths.foldersTreeItem()}/`, {
|
|
866
1332
|
params: { key },
|
|
867
1333
|
jsonBody: payload
|
|
868
1334
|
});
|
|
869
1335
|
}
|
|
1336
|
+
/** @deprecated Use {@link deleteCollection} instead. */
|
|
870
1337
|
async deleteFolder(folderKey) {
|
|
1338
|
+
warnDeprecatedMethod("deleteFolder", "deleteCollection");
|
|
871
1339
|
const key = resolveKey(folderKey);
|
|
872
1340
|
await this.request("DELETE", `${this.paths.foldersTreeItem()}/`, {
|
|
873
1341
|
params: { key },
|
|
@@ -875,13 +1343,17 @@ var ManagementClient = class {
|
|
|
875
1343
|
});
|
|
876
1344
|
}
|
|
877
1345
|
// ------------------------------------------------------------------ //
|
|
878
|
-
// Folder version operations
|
|
1346
|
+
// Folder version operations (deprecated)
|
|
879
1347
|
// ------------------------------------------------------------------ //
|
|
1348
|
+
/** @deprecated Use {@link listCollectionVersions} instead. */
|
|
880
1349
|
async listFolderVersions(folderKey, params) {
|
|
1350
|
+
warnDeprecatedMethod("listFolderVersions", "listCollectionVersions");
|
|
881
1351
|
const key = resolveKey(folderKey);
|
|
882
1352
|
return this.request("GET", `${this.paths.folderVersionsBase(key)}/`, { params });
|
|
883
1353
|
}
|
|
1354
|
+
/** @deprecated Use {@link createCollectionVersion} instead. */
|
|
884
1355
|
async createFolderVersion(folderKey, payload, options) {
|
|
1356
|
+
warnDeprecatedMethod("createFolderVersion", "createCollectionVersion");
|
|
885
1357
|
const key = resolveKey(folderKey);
|
|
886
1358
|
const params = {};
|
|
887
1359
|
if (options?.copyFrom) {
|
|
@@ -892,7 +1364,9 @@ var ManagementClient = class {
|
|
|
892
1364
|
params: Object.keys(params).length > 0 ? params : void 0
|
|
893
1365
|
});
|
|
894
1366
|
}
|
|
1367
|
+
/** @deprecated Use {@link getCollectionVersion} instead. */
|
|
895
1368
|
async getFolderVersion(folderKey, versionKey, options) {
|
|
1369
|
+
warnDeprecatedMethod("getFolderVersion", "getCollectionVersion");
|
|
896
1370
|
const fKey = resolveKey(folderKey);
|
|
897
1371
|
const vKey = resolveKey(versionKey);
|
|
898
1372
|
const params = {};
|
|
@@ -903,48 +1377,62 @@ var ManagementClient = class {
|
|
|
903
1377
|
params: Object.keys(params).length > 0 ? params : void 0
|
|
904
1378
|
});
|
|
905
1379
|
}
|
|
1380
|
+
/** @deprecated Use {@link updateCollectionVersion} instead. */
|
|
906
1381
|
async updateFolderVersion(folderKey, versionKey, payload) {
|
|
1382
|
+
warnDeprecatedMethod("updateFolderVersion", "updateCollectionVersion");
|
|
907
1383
|
const fKey = resolveKey(folderKey);
|
|
908
1384
|
const vKey = resolveKey(versionKey);
|
|
909
1385
|
return this.request("PUT", `${this.paths.folderVersionsBase(fKey)}/${vKey}/`, {
|
|
910
1386
|
jsonBody: payload
|
|
911
1387
|
});
|
|
912
1388
|
}
|
|
1389
|
+
/** @deprecated Use {@link deleteCollectionVersion} instead. */
|
|
913
1390
|
async deleteFolderVersion(folderKey, versionKey) {
|
|
1391
|
+
warnDeprecatedMethod("deleteFolderVersion", "deleteCollectionVersion");
|
|
914
1392
|
const fKey = resolveKey(folderKey);
|
|
915
1393
|
const vKey = resolveKey(versionKey);
|
|
916
1394
|
await this.request("DELETE", `${this.paths.folderVersionsBase(fKey)}/${vKey}/`, {
|
|
917
1395
|
parseJson: false
|
|
918
1396
|
});
|
|
919
1397
|
}
|
|
1398
|
+
/** @deprecated Use {@link publishCollectionVersion} instead. */
|
|
920
1399
|
async publishFolderVersion(folderKey, versionKey) {
|
|
1400
|
+
warnDeprecatedMethod("publishFolderVersion", "publishCollectionVersion");
|
|
921
1401
|
const fKey = resolveKey(folderKey);
|
|
922
1402
|
const vKey = resolveKey(versionKey);
|
|
923
1403
|
return this.request("POST", `${this.paths.folderVersionsBase(fKey)}/${vKey}/publish/`);
|
|
924
1404
|
}
|
|
925
1405
|
// ------------------------------------------------------------------ //
|
|
926
|
-
// Folder field operations
|
|
1406
|
+
// Folder field operations (deprecated)
|
|
927
1407
|
// ------------------------------------------------------------------ //
|
|
1408
|
+
/** @deprecated Use {@link listCollectionFields} instead. */
|
|
928
1409
|
async listFolderFields(folderKey, versionKey, params) {
|
|
1410
|
+
warnDeprecatedMethod("listFolderFields", "listCollectionFields");
|
|
929
1411
|
const fKey = resolveKey(folderKey);
|
|
930
1412
|
const vKey = resolveKey(versionKey);
|
|
931
1413
|
return this.request("GET", `${this.paths.folderSchemaTree(fKey, vKey)}/`, { params });
|
|
932
1414
|
}
|
|
1415
|
+
/** @deprecated Use {@link createCollectionField} instead. */
|
|
933
1416
|
async createFolderField(folderKey, versionKey, payload) {
|
|
1417
|
+
warnDeprecatedMethod("createFolderField", "createCollectionField");
|
|
934
1418
|
const fKey = resolveKey(folderKey);
|
|
935
1419
|
const vKey = resolveKey(versionKey);
|
|
936
1420
|
return this.request("POST", `${this.paths.folderSchemaTree(fKey, vKey)}/`, {
|
|
937
1421
|
jsonBody: payload
|
|
938
1422
|
});
|
|
939
1423
|
}
|
|
1424
|
+
/** @deprecated Use {@link getCollectionField} instead. */
|
|
940
1425
|
async getFolderField(folderKey, versionKey, fieldPath) {
|
|
1426
|
+
warnDeprecatedMethod("getFolderField", "getCollectionField");
|
|
941
1427
|
const fKey = resolveKey(folderKey);
|
|
942
1428
|
const vKey = resolveKey(versionKey);
|
|
943
1429
|
return this.request("GET", `${this.paths.folderSchemaTree(fKey, vKey)}/field/`, {
|
|
944
1430
|
params: { path: fieldPath }
|
|
945
1431
|
});
|
|
946
1432
|
}
|
|
1433
|
+
/** @deprecated Use {@link updateCollectionField} instead. */
|
|
947
1434
|
async updateFolderField(folderKey, versionKey, fieldPath, payload) {
|
|
1435
|
+
warnDeprecatedMethod("updateFolderField", "updateCollectionField");
|
|
948
1436
|
const fKey = resolveKey(folderKey);
|
|
949
1437
|
const vKey = resolveKey(versionKey);
|
|
950
1438
|
return this.request("PUT", `${this.paths.folderSchemaTree(fKey, vKey)}/field/`, {
|
|
@@ -952,7 +1440,9 @@ var ManagementClient = class {
|
|
|
952
1440
|
jsonBody: payload
|
|
953
1441
|
});
|
|
954
1442
|
}
|
|
1443
|
+
/** @deprecated Use {@link deleteCollectionField} instead. */
|
|
955
1444
|
async deleteFolderField(folderKey, versionKey, fieldPath) {
|
|
1445
|
+
warnDeprecatedMethod("deleteFolderField", "deleteCollectionField");
|
|
956
1446
|
const fKey = resolveKey(folderKey);
|
|
957
1447
|
const vKey = resolveKey(versionKey);
|
|
958
1448
|
await this.request("DELETE", `${this.paths.folderSchemaTree(fKey, vKey)}/field/`, {
|
|
@@ -1080,32 +1570,41 @@ var ManagementClient = class {
|
|
|
1080
1570
|
return this.request("GET", `${this.paths.resourceBase(fKey)}/${rKey}/`);
|
|
1081
1571
|
}
|
|
1082
1572
|
async createResource(folderKey, payload, options) {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1573
|
+
if (options && typeof options === "object" && "component" in options) {
|
|
1574
|
+
throw new TypeError(
|
|
1575
|
+
"The `component` option has been removed. Resources now derive their schema from the folder's model. Remove the `component` field from your call site."
|
|
1576
|
+
);
|
|
1087
1577
|
}
|
|
1578
|
+
const key = resolveKey(folderKey);
|
|
1088
1579
|
const body = { ...payload };
|
|
1089
1580
|
if (options?.externalId) {
|
|
1090
1581
|
body.external_id = options.externalId;
|
|
1091
1582
|
}
|
|
1092
1583
|
return this.request("POST", `${this.paths.resourceBase(key)}/`, {
|
|
1093
|
-
params: Object.keys(params).length ? params : void 0,
|
|
1094
1584
|
jsonBody: body
|
|
1095
1585
|
});
|
|
1096
1586
|
}
|
|
1097
1587
|
async upsertResource(folderKey, payload, options) {
|
|
1588
|
+
if (options && typeof options === "object" && "component" in options) {
|
|
1589
|
+
throw new TypeError(
|
|
1590
|
+
"The `component` option has been removed. Resources now derive their schema from the folder's model. Remove the `component` field from your call site."
|
|
1591
|
+
);
|
|
1592
|
+
}
|
|
1098
1593
|
const key = resolveKey(folderKey);
|
|
1099
1594
|
const params = { external_id: options.externalId };
|
|
1100
|
-
if (options.component) {
|
|
1101
|
-
params.component = resolveKey(options.component);
|
|
1102
|
-
}
|
|
1103
1595
|
return this.request("PUT", `${this.paths.resourceBase(key)}/`, {
|
|
1104
1596
|
params,
|
|
1105
1597
|
jsonBody: payload
|
|
1106
1598
|
});
|
|
1107
1599
|
}
|
|
1108
1600
|
async batchUpsertResources(folderKey, items, options) {
|
|
1601
|
+
for (const item of items) {
|
|
1602
|
+
if (item && typeof item === "object" && "component" in item) {
|
|
1603
|
+
throw new TypeError(
|
|
1604
|
+
"BatchUpsertItem.component has been removed. Resources now derive their schema from the folder's model. Remove the `component` field from your batch items."
|
|
1605
|
+
);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1109
1608
|
const fKey = resolveKey(folderKey);
|
|
1110
1609
|
const maxConcurrency = options?.maxConcurrency ?? 5;
|
|
1111
1610
|
if (maxConcurrency < 1) {
|
|
@@ -1123,9 +1622,6 @@ var ManagementClient = class {
|
|
|
1123
1622
|
const processItem = async (index, item) => {
|
|
1124
1623
|
try {
|
|
1125
1624
|
const params = { external_id: item.external_id };
|
|
1126
|
-
if (item.component) {
|
|
1127
|
-
params.component = item.component;
|
|
1128
|
-
}
|
|
1129
1625
|
const result = await this.request(
|
|
1130
1626
|
"PUT",
|
|
1131
1627
|
`${this.paths.resourceBase(fKey)}/`,
|
|
@@ -1703,14 +2199,19 @@ var FluxClient = class {
|
|
|
1703
2199
|
HttpTransport,
|
|
1704
2200
|
JWTAuth,
|
|
1705
2201
|
ManagementClient,
|
|
2202
|
+
PlanExhaustedError,
|
|
2203
|
+
PlanLimitExceededError,
|
|
2204
|
+
RateLimitExceededError,
|
|
1706
2205
|
SDK_VERSION,
|
|
1707
2206
|
SearchMode,
|
|
1708
2207
|
SecureKeyAuth,
|
|
1709
2208
|
SimpleKeyAuth,
|
|
2209
|
+
SpendCapExceededError,
|
|
1710
2210
|
StaticTokenProvider,
|
|
1711
2211
|
VERSION,
|
|
1712
2212
|
buildSearchBody,
|
|
1713
2213
|
createConfig,
|
|
2214
|
+
nestedFieldMeta,
|
|
1714
2215
|
resolveKey
|
|
1715
2216
|
});
|
|
1716
2217
|
//# sourceMappingURL=index.cjs.map
|