@axiom-lattice/client-sdk 8.0.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/oidc-providers.test.d.ts +2 -0
- package/dist/__tests__/oidc-providers.test.d.ts.map +1 -0
- package/dist/__tests__/oidc-providers.test.js +161 -0
- package/dist/__tests__/oidc-providers.test.js.map +1 -0
- package/dist/__tests__/platform.test.d.ts +2 -0
- package/dist/__tests__/platform.test.d.ts.map +1 -0
- package/dist/__tests__/platform.test.js +532 -0
- package/dist/__tests__/platform.test.js.map +1 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +415 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +825 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +821 -0
- package/dist/index.mjs.map +1 -1
- package/dist/oidc-providers.d.ts +84 -0
- package/dist/oidc-providers.d.ts.map +1 -0
- package/dist/oidc-providers.js +142 -0
- package/dist/oidc-providers.js.map +1 -0
- package/dist/platform.d.ts +322 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +686 -0
- package/dist/platform.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4643,6 +4643,821 @@ var RoomEventsClient = class {
|
|
|
4643
4643
|
}
|
|
4644
4644
|
};
|
|
4645
4645
|
|
|
4646
|
+
// src/oidc-providers.ts
|
|
4647
|
+
var OidcProviderClientError = class extends Error {
|
|
4648
|
+
constructor(message, status, code, retryable = false, details) {
|
|
4649
|
+
super(message);
|
|
4650
|
+
this.status = status;
|
|
4651
|
+
this.code = code;
|
|
4652
|
+
this.retryable = retryable;
|
|
4653
|
+
this.details = details;
|
|
4654
|
+
this.name = "OidcProviderClientError";
|
|
4655
|
+
}
|
|
4656
|
+
};
|
|
4657
|
+
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4658
|
+
function invalidResponse(message) {
|
|
4659
|
+
return new OidcProviderClientError(message, 500, "INVALID_RESPONSE", false);
|
|
4660
|
+
}
|
|
4661
|
+
function requiredString4(row, field) {
|
|
4662
|
+
if (typeof row[field] !== "string")
|
|
4663
|
+
throw invalidResponse(`Invalid ${field}`);
|
|
4664
|
+
return row[field];
|
|
4665
|
+
}
|
|
4666
|
+
function hydrateSummary(value) {
|
|
4667
|
+
if (!isRecord4(value))
|
|
4668
|
+
throw invalidResponse("Invalid OIDC provider summary");
|
|
4669
|
+
const source = value.source;
|
|
4670
|
+
if (source !== "env" && source !== "store") {
|
|
4671
|
+
throw invalidResponse("Invalid OIDC provider source");
|
|
4672
|
+
}
|
|
4673
|
+
return {
|
|
4674
|
+
id: requiredString4(value, "id"),
|
|
4675
|
+
displayName: requiredString4(value, "displayName"),
|
|
4676
|
+
issuer: requiredString4(value, "issuer"),
|
|
4677
|
+
clientId: requiredString4(value, "clientId"),
|
|
4678
|
+
hasClientSecret: value.hasClientSecret === true,
|
|
4679
|
+
scopes: requiredString4(value, "scopes"),
|
|
4680
|
+
enabled: value.enabled === true,
|
|
4681
|
+
jitProvisioning: value.jitProvisioning === true,
|
|
4682
|
+
autoLinkEmail: value.autoLinkEmail === true,
|
|
4683
|
+
...typeof value.defaultTenantId === "string" ? { defaultTenantId: value.defaultTenantId } : {},
|
|
4684
|
+
...Array.isArray(value.allowedPrivateHosts) ? {
|
|
4685
|
+
allowedPrivateHosts: value.allowedPrivateHosts.filter(
|
|
4686
|
+
(host) => typeof host === "string"
|
|
4687
|
+
)
|
|
4688
|
+
} : {},
|
|
4689
|
+
redirectUri: requiredString4(value, "redirectUri"),
|
|
4690
|
+
source,
|
|
4691
|
+
updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : null
|
|
4692
|
+
};
|
|
4693
|
+
}
|
|
4694
|
+
function hydrateTestResult(value) {
|
|
4695
|
+
if (!isRecord4(value))
|
|
4696
|
+
throw invalidResponse("Invalid OIDC test result");
|
|
4697
|
+
const scopesSupported = Array.isArray(value.scopesSupported) ? value.scopesSupported.filter(
|
|
4698
|
+
(scope) => typeof scope === "string"
|
|
4699
|
+
) : void 0;
|
|
4700
|
+
return {
|
|
4701
|
+
issuer: requiredString4(value, "issuer"),
|
|
4702
|
+
authorizationEndpoint: requiredString4(value, "authorizationEndpoint"),
|
|
4703
|
+
tokenEndpoint: requiredString4(value, "tokenEndpoint"),
|
|
4704
|
+
jwksUri: requiredString4(value, "jwksUri"),
|
|
4705
|
+
...typeof value.userinfoEndpoint === "string" ? { userinfoEndpoint: value.userinfoEndpoint } : {},
|
|
4706
|
+
...scopesSupported ? { scopesSupported } : {}
|
|
4707
|
+
};
|
|
4708
|
+
}
|
|
4709
|
+
function errorFromEnvelope(payload, response) {
|
|
4710
|
+
const raw = payload?.error;
|
|
4711
|
+
if (typeof raw === "string") {
|
|
4712
|
+
return new OidcProviderClientError(raw, response.status, raw, false);
|
|
4713
|
+
}
|
|
4714
|
+
if (isRecord4(raw)) {
|
|
4715
|
+
const code = typeof raw.code === "string" ? raw.code : response.ok ? "INVALID_RESPONSE" : "HTTP_ERROR";
|
|
4716
|
+
return new OidcProviderClientError(
|
|
4717
|
+
typeof raw.message === "string" ? raw.message : "OIDC provider request failed",
|
|
4718
|
+
response.status,
|
|
4719
|
+
code,
|
|
4720
|
+
raw.retryable === true,
|
|
4721
|
+
raw.details
|
|
4722
|
+
);
|
|
4723
|
+
}
|
|
4724
|
+
return new OidcProviderClientError(
|
|
4725
|
+
"OIDC provider request failed",
|
|
4726
|
+
response.status,
|
|
4727
|
+
response.ok ? "INVALID_RESPONSE" : "HTTP_ERROR",
|
|
4728
|
+
false
|
|
4729
|
+
);
|
|
4730
|
+
}
|
|
4731
|
+
var OidcProvidersClient = class {
|
|
4732
|
+
constructor(baseURL, getHeaders) {
|
|
4733
|
+
this.baseURL = baseURL;
|
|
4734
|
+
this.getHeaders = getHeaders;
|
|
4735
|
+
}
|
|
4736
|
+
async list() {
|
|
4737
|
+
const data = await this.request("/api/oidc-providers");
|
|
4738
|
+
if (!Array.isArray(data))
|
|
4739
|
+
throw invalidResponse("Invalid provider list");
|
|
4740
|
+
return data.map(hydrateSummary);
|
|
4741
|
+
}
|
|
4742
|
+
async create(input) {
|
|
4743
|
+
const data = await this.request("/api/oidc-providers", {
|
|
4744
|
+
method: "POST",
|
|
4745
|
+
body: JSON.stringify(input)
|
|
4746
|
+
});
|
|
4747
|
+
return hydrateSummary(data);
|
|
4748
|
+
}
|
|
4749
|
+
async update(id, input) {
|
|
4750
|
+
const data = await this.request(
|
|
4751
|
+
`/api/oidc-providers/${encodeURIComponent(id)}`,
|
|
4752
|
+
{ method: "PATCH", body: JSON.stringify(input) }
|
|
4753
|
+
);
|
|
4754
|
+
return hydrateSummary(data);
|
|
4755
|
+
}
|
|
4756
|
+
async delete(id) {
|
|
4757
|
+
await this.request(
|
|
4758
|
+
`/api/oidc-providers/${encodeURIComponent(id)}`,
|
|
4759
|
+
{ method: "DELETE" }
|
|
4760
|
+
);
|
|
4761
|
+
}
|
|
4762
|
+
async test(input) {
|
|
4763
|
+
const data = await this.request("/api/oidc-providers/test", {
|
|
4764
|
+
method: "POST",
|
|
4765
|
+
body: JSON.stringify(input)
|
|
4766
|
+
});
|
|
4767
|
+
return hydrateTestResult(data);
|
|
4768
|
+
}
|
|
4769
|
+
async testStored(id, overrides) {
|
|
4770
|
+
const data = await this.request(
|
|
4771
|
+
`/api/oidc-providers/${encodeURIComponent(id)}/test`,
|
|
4772
|
+
{
|
|
4773
|
+
method: "POST",
|
|
4774
|
+
...overrides ? { body: JSON.stringify(overrides) } : {}
|
|
4775
|
+
}
|
|
4776
|
+
);
|
|
4777
|
+
return hydrateTestResult(data);
|
|
4778
|
+
}
|
|
4779
|
+
async request(path, init = {}) {
|
|
4780
|
+
const headers = { ...this.getHeaders() };
|
|
4781
|
+
if (init.body !== void 0) {
|
|
4782
|
+
headers["Content-Type"] = "application/json";
|
|
4783
|
+
}
|
|
4784
|
+
const response = await fetch(`${this.baseURL}${path}`, {
|
|
4785
|
+
...init,
|
|
4786
|
+
headers
|
|
4787
|
+
});
|
|
4788
|
+
const payload = await response.json().catch(() => void 0);
|
|
4789
|
+
if (!response.ok || payload?.success !== true) {
|
|
4790
|
+
throw errorFromEnvelope(payload, response);
|
|
4791
|
+
}
|
|
4792
|
+
return payload.data;
|
|
4793
|
+
}
|
|
4794
|
+
};
|
|
4795
|
+
|
|
4796
|
+
// src/platform.ts
|
|
4797
|
+
var PlatformClientError = class extends Error {
|
|
4798
|
+
constructor(message, status, code, retryable = false, details) {
|
|
4799
|
+
super(message);
|
|
4800
|
+
this.status = status;
|
|
4801
|
+
this.code = code;
|
|
4802
|
+
this.retryable = retryable;
|
|
4803
|
+
this.details = details;
|
|
4804
|
+
this.name = "PlatformClientError";
|
|
4805
|
+
}
|
|
4806
|
+
};
|
|
4807
|
+
var PLATFORM_ROLES = ["owner", "admin", "auditor"];
|
|
4808
|
+
var TENANT_ROLES = ["owner", "admin", "member"];
|
|
4809
|
+
var isRecord5 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4810
|
+
function invalidResponse2(message) {
|
|
4811
|
+
return new PlatformClientError(message, 500, "INVALID_RESPONSE", false);
|
|
4812
|
+
}
|
|
4813
|
+
function requiredString5(row, field) {
|
|
4814
|
+
if (typeof row[field] !== "string")
|
|
4815
|
+
throw invalidResponse2(`Invalid ${field}`);
|
|
4816
|
+
return row[field];
|
|
4817
|
+
}
|
|
4818
|
+
function optionalNullableString(row, field) {
|
|
4819
|
+
const value = row[field];
|
|
4820
|
+
if (value === null || value === void 0)
|
|
4821
|
+
return null;
|
|
4822
|
+
if (typeof value !== "string")
|
|
4823
|
+
throw invalidResponse2(`Invalid ${field}`);
|
|
4824
|
+
return value;
|
|
4825
|
+
}
|
|
4826
|
+
function hydrateSettingsSnapshot(value) {
|
|
4827
|
+
if (!isRecord5(value) || typeof value.version !== "number" || !isRecord5(value.effective) || !isRecord5(value.sources) || !isRecord5(value.fallbacks)) {
|
|
4828
|
+
throw invalidResponse2("Invalid platform settings");
|
|
4829
|
+
}
|
|
4830
|
+
return {
|
|
4831
|
+
version: value.version,
|
|
4832
|
+
effective: value.effective,
|
|
4833
|
+
sources: value.sources,
|
|
4834
|
+
fallbacks: value.fallbacks,
|
|
4835
|
+
...typeof value.updatedBy === "string" ? { updatedBy: value.updatedBy } : {},
|
|
4836
|
+
...typeof value.updatedAt === "string" ? { updatedAt: value.updatedAt } : {},
|
|
4837
|
+
...typeof value.refreshedAt === "string" ? { refreshedAt: value.refreshedAt } : {}
|
|
4838
|
+
};
|
|
4839
|
+
}
|
|
4840
|
+
function hydrateEnvironment(value) {
|
|
4841
|
+
if (!isRecord5(value) || !isRecord5(value.runtime) || !isRecord5(value.publicEndpoints) || !isRecord5(value.dependencies) || !isRecord5(value.settings) || !isRecord5(value.diagnostics)) {
|
|
4842
|
+
throw invalidResponse2("Invalid platform environment");
|
|
4843
|
+
}
|
|
4844
|
+
return value;
|
|
4845
|
+
}
|
|
4846
|
+
var BRANDING_TEXT_KEYS = [
|
|
4847
|
+
"brandName",
|
|
4848
|
+
"logoUrl",
|
|
4849
|
+
"faviconUrl",
|
|
4850
|
+
"primaryColor",
|
|
4851
|
+
"backgroundColor",
|
|
4852
|
+
"loginTitle",
|
|
4853
|
+
"loginSubtitle"
|
|
4854
|
+
];
|
|
4855
|
+
function hydrateBranding(value) {
|
|
4856
|
+
if (!isRecord5(value))
|
|
4857
|
+
throw invalidResponse2("Invalid branding");
|
|
4858
|
+
const branding = {};
|
|
4859
|
+
for (const key of BRANDING_TEXT_KEYS) {
|
|
4860
|
+
const field = value[key];
|
|
4861
|
+
if (field === void 0)
|
|
4862
|
+
continue;
|
|
4863
|
+
if (typeof field !== "string") {
|
|
4864
|
+
throw invalidResponse2(`Invalid branding.${key}`);
|
|
4865
|
+
}
|
|
4866
|
+
branding[key] = field;
|
|
4867
|
+
}
|
|
4868
|
+
return branding;
|
|
4869
|
+
}
|
|
4870
|
+
function hydrateBrandingDomain(value) {
|
|
4871
|
+
if (!isRecord5(value))
|
|
4872
|
+
throw invalidResponse2("Invalid branding domain");
|
|
4873
|
+
const domain = { host: requiredString5(value, "host") };
|
|
4874
|
+
if (value.status !== void 0) {
|
|
4875
|
+
if (value.status !== "active" && value.status !== "pending") {
|
|
4876
|
+
throw invalidResponse2("Invalid branding domain status");
|
|
4877
|
+
}
|
|
4878
|
+
domain.status = value.status;
|
|
4879
|
+
}
|
|
4880
|
+
const publicGatewayUrl = optionalString(value, "publicGatewayUrl");
|
|
4881
|
+
if (publicGatewayUrl !== void 0) {
|
|
4882
|
+
domain.publicGatewayUrl = publicGatewayUrl;
|
|
4883
|
+
}
|
|
4884
|
+
const publicConsoleUrl = optionalString(value, "publicConsoleUrl");
|
|
4885
|
+
if (publicConsoleUrl !== void 0) {
|
|
4886
|
+
domain.publicConsoleUrl = publicConsoleUrl;
|
|
4887
|
+
}
|
|
4888
|
+
if (value.branding !== void 0) {
|
|
4889
|
+
domain.branding = hydrateBranding(value.branding);
|
|
4890
|
+
}
|
|
4891
|
+
return domain;
|
|
4892
|
+
}
|
|
4893
|
+
function hydrateBrandingSettings(value) {
|
|
4894
|
+
if (!isRecord5(value))
|
|
4895
|
+
throw invalidResponse2("Invalid branding settings");
|
|
4896
|
+
const settings = {};
|
|
4897
|
+
if (value.default !== void 0) {
|
|
4898
|
+
settings.default = hydrateBranding(value.default);
|
|
4899
|
+
}
|
|
4900
|
+
if (value.domains !== void 0) {
|
|
4901
|
+
if (!Array.isArray(value.domains)) {
|
|
4902
|
+
throw invalidResponse2("Invalid branding domains");
|
|
4903
|
+
}
|
|
4904
|
+
settings.domains = value.domains.map(hydrateBrandingDomain);
|
|
4905
|
+
}
|
|
4906
|
+
return settings;
|
|
4907
|
+
}
|
|
4908
|
+
function hydrateBrandingSettingsView(value) {
|
|
4909
|
+
if (!isRecord5(value) || typeof value.version !== "number") {
|
|
4910
|
+
throw invalidResponse2("Invalid platform branding settings");
|
|
4911
|
+
}
|
|
4912
|
+
return {
|
|
4913
|
+
version: value.version,
|
|
4914
|
+
branding: hydrateBrandingSettings(value.branding),
|
|
4915
|
+
...typeof value.updatedBy === "string" ? { updatedBy: value.updatedBy } : {},
|
|
4916
|
+
...typeof value.updatedAt === "string" ? { updatedAt: value.updatedAt } : {}
|
|
4917
|
+
};
|
|
4918
|
+
}
|
|
4919
|
+
function hydrateResolvedBranding(value) {
|
|
4920
|
+
if (!isRecord5(value) || value.source !== "domain" && value.source !== "default") {
|
|
4921
|
+
throw invalidResponse2("Invalid resolved branding");
|
|
4922
|
+
}
|
|
4923
|
+
return {
|
|
4924
|
+
branding: hydrateBranding(value.branding),
|
|
4925
|
+
source: value.source,
|
|
4926
|
+
...typeof value.host === "string" ? { host: value.host } : {},
|
|
4927
|
+
...typeof value.publicGatewayUrl === "string" ? { publicGatewayUrl: value.publicGatewayUrl } : {},
|
|
4928
|
+
...typeof value.publicConsoleUrl === "string" ? { publicConsoleUrl: value.publicConsoleUrl } : {}
|
|
4929
|
+
};
|
|
4930
|
+
}
|
|
4931
|
+
function hydratePlatformRole(value) {
|
|
4932
|
+
if (typeof value === "string" && PLATFORM_ROLES.includes(value)) {
|
|
4933
|
+
return value;
|
|
4934
|
+
}
|
|
4935
|
+
throw invalidResponse2("Invalid platform role");
|
|
4936
|
+
}
|
|
4937
|
+
function hydrateTenantRole(value) {
|
|
4938
|
+
if (typeof value === "string" && TENANT_ROLES.includes(value)) {
|
|
4939
|
+
return value;
|
|
4940
|
+
}
|
|
4941
|
+
throw invalidResponse2("Invalid tenant role");
|
|
4942
|
+
}
|
|
4943
|
+
function hydrateStatus(value) {
|
|
4944
|
+
if (value === null || value === void 0)
|
|
4945
|
+
return null;
|
|
4946
|
+
if (value === "active" || value === "pending" || value === "suspended") {
|
|
4947
|
+
return value;
|
|
4948
|
+
}
|
|
4949
|
+
throw invalidResponse2("Invalid user status");
|
|
4950
|
+
}
|
|
4951
|
+
function optionalString(row, field) {
|
|
4952
|
+
const value = row[field];
|
|
4953
|
+
if (value === null || value === void 0)
|
|
4954
|
+
return void 0;
|
|
4955
|
+
if (typeof value !== "string")
|
|
4956
|
+
throw invalidResponse2(`Invalid ${field}`);
|
|
4957
|
+
return value;
|
|
4958
|
+
}
|
|
4959
|
+
function hydrateInvitation(value) {
|
|
4960
|
+
if (!isRecord5(value))
|
|
4961
|
+
throw invalidResponse2("Invalid invitation");
|
|
4962
|
+
const invitedBy = optionalString(value, "invitedBy");
|
|
4963
|
+
const expiresAt = optionalString(value, "expiresAt");
|
|
4964
|
+
const consumedAt = optionalString(value, "consumedAt");
|
|
4965
|
+
return {
|
|
4966
|
+
email: requiredString5(value, "email"),
|
|
4967
|
+
role: hydratePlatformRole(value.role),
|
|
4968
|
+
createdAt: requiredString5(value, "createdAt"),
|
|
4969
|
+
...invitedBy ? { invitedBy } : {},
|
|
4970
|
+
...expiresAt ? { expiresAt } : {},
|
|
4971
|
+
...consumedAt ? { consumedAt } : {}
|
|
4972
|
+
};
|
|
4973
|
+
}
|
|
4974
|
+
function hydrateMember3(value) {
|
|
4975
|
+
if (!isRecord5(value))
|
|
4976
|
+
throw invalidResponse2("Invalid platform member");
|
|
4977
|
+
return {
|
|
4978
|
+
id: requiredString5(value, "id"),
|
|
4979
|
+
email: optionalNullableString(value, "email"),
|
|
4980
|
+
name: optionalNullableString(value, "name"),
|
|
4981
|
+
status: hydrateStatus(value.status),
|
|
4982
|
+
role: hydratePlatformRole(value.role),
|
|
4983
|
+
grantedAt: requiredString5(value, "grantedAt"),
|
|
4984
|
+
...typeof value.grantedBy === "string" ? { grantedBy: value.grantedBy } : {}
|
|
4985
|
+
};
|
|
4986
|
+
}
|
|
4987
|
+
function hydrateTenantMember(value) {
|
|
4988
|
+
if (!isRecord5(value))
|
|
4989
|
+
throw invalidResponse2("Invalid tenant member");
|
|
4990
|
+
return {
|
|
4991
|
+
userId: requiredString5(value, "userId"),
|
|
4992
|
+
tenantId: requiredString5(value, "tenantId"),
|
|
4993
|
+
role: hydrateTenantRole(value.role),
|
|
4994
|
+
joinedAt: requiredString5(value, "joinedAt"),
|
|
4995
|
+
email: optionalNullableString(value, "email"),
|
|
4996
|
+
name: optionalNullableString(value, "name"),
|
|
4997
|
+
status: hydrateStatus(value.status)
|
|
4998
|
+
};
|
|
4999
|
+
}
|
|
5000
|
+
function hydrateOidcIdentityClaimStatus(value) {
|
|
5001
|
+
if (value === "pending" || value === "approved" || value === "rejected" || value === "expired") {
|
|
5002
|
+
return value;
|
|
5003
|
+
}
|
|
5004
|
+
throw invalidResponse2("Invalid SSO claim status");
|
|
5005
|
+
}
|
|
5006
|
+
function hydrateOidcIdentityClaim(value) {
|
|
5007
|
+
if (!isRecord5(value))
|
|
5008
|
+
throw invalidResponse2("Invalid SSO claim");
|
|
5009
|
+
const name = optionalString(value, "name");
|
|
5010
|
+
const picture = optionalString(value, "picture");
|
|
5011
|
+
const reviewedBy = optionalString(value, "reviewedBy");
|
|
5012
|
+
const reviewedAt = optionalString(value, "reviewedAt");
|
|
5013
|
+
const linkedUserId = optionalString(value, "linkedUserId");
|
|
5014
|
+
const inviteLinkId = optionalString(value, "inviteLinkId");
|
|
5015
|
+
const requestedUserId = optionalString(value, "requestedUserId");
|
|
5016
|
+
const requestedPlatformRole = value.requestedPlatformRole !== void 0 ? hydratePlatformRole(value.requestedPlatformRole) : void 0;
|
|
5017
|
+
const requestedTenantId = optionalString(value, "requestedTenantId");
|
|
5018
|
+
const requestedTenantRole = value.requestedTenantRole !== void 0 ? hydrateTenantRole(value.requestedTenantRole) : void 0;
|
|
5019
|
+
const source = value.source === "email_completion" || value.source === "invite_link" ? value.source : void 0;
|
|
5020
|
+
const existing = value.existingUser;
|
|
5021
|
+
let existingUser;
|
|
5022
|
+
if (existing !== void 0 && existing !== null) {
|
|
5023
|
+
if (!isRecord5(existing))
|
|
5024
|
+
throw invalidResponse2("Invalid existing user");
|
|
5025
|
+
const platformRole = existing.role !== void 0 ? hydratePlatformRole(existing.role) : existing.platformRole !== void 0 ? hydratePlatformRole(existing.platformRole) : void 0;
|
|
5026
|
+
existingUser = {
|
|
5027
|
+
id: requiredString5(existing, "id"),
|
|
5028
|
+
email: requiredString5(existing, "email"),
|
|
5029
|
+
name: requiredString5(existing, "name"),
|
|
5030
|
+
status: hydrateStatus(existing.status) ?? "pending",
|
|
5031
|
+
...platformRole ? { platformRole } : {}
|
|
5032
|
+
};
|
|
5033
|
+
}
|
|
5034
|
+
return {
|
|
5035
|
+
id: requiredString5(value, "id"),
|
|
5036
|
+
providerId: requiredString5(value, "providerId"),
|
|
5037
|
+
issuer: requiredString5(value, "issuer"),
|
|
5038
|
+
email: requiredString5(value, "email"),
|
|
5039
|
+
...name ? { name } : {},
|
|
5040
|
+
...picture ? { picture } : {},
|
|
5041
|
+
status: hydrateOidcIdentityClaimStatus(value.status),
|
|
5042
|
+
createdAt: requiredString5(value, "createdAt"),
|
|
5043
|
+
updatedAt: requiredString5(value, "updatedAt"),
|
|
5044
|
+
expiresAt: requiredString5(value, "expiresAt"),
|
|
5045
|
+
...reviewedBy ? { reviewedBy } : {},
|
|
5046
|
+
...reviewedAt ? { reviewedAt } : {},
|
|
5047
|
+
...linkedUserId ? { linkedUserId } : {},
|
|
5048
|
+
...source ? { source } : {},
|
|
5049
|
+
...inviteLinkId ? { inviteLinkId } : {},
|
|
5050
|
+
...requestedUserId ? { requestedUserId } : {},
|
|
5051
|
+
...requestedPlatformRole ? { requestedPlatformRole } : {},
|
|
5052
|
+
...requestedTenantId ? { requestedTenantId } : {},
|
|
5053
|
+
...requestedTenantRole ? { requestedTenantRole } : {},
|
|
5054
|
+
expired: value.expired === true,
|
|
5055
|
+
...existingUser ? { existingUser } : {}
|
|
5056
|
+
};
|
|
5057
|
+
}
|
|
5058
|
+
function hydrateTenantStatus(value) {
|
|
5059
|
+
if (value === "active" || value === "inactive" || value === "suspended") {
|
|
5060
|
+
return value;
|
|
5061
|
+
}
|
|
5062
|
+
throw invalidResponse2("Invalid tenant status");
|
|
5063
|
+
}
|
|
5064
|
+
function optionalRecord(row, field) {
|
|
5065
|
+
const value = row[field];
|
|
5066
|
+
if (value === void 0 || value === null)
|
|
5067
|
+
return void 0;
|
|
5068
|
+
if (!isRecord5(value))
|
|
5069
|
+
throw invalidResponse2(`Invalid ${field}`);
|
|
5070
|
+
return value;
|
|
5071
|
+
}
|
|
5072
|
+
function hydrateInviteLink(value) {
|
|
5073
|
+
if (!isRecord5(value))
|
|
5074
|
+
throw invalidResponse2("Invalid invite link");
|
|
5075
|
+
const scope = value.scope;
|
|
5076
|
+
if (scope !== "platform" && scope !== "tenant") {
|
|
5077
|
+
throw invalidResponse2("Invalid invite scope");
|
|
5078
|
+
}
|
|
5079
|
+
const platformRole = value.platformRole !== void 0 ? hydratePlatformRole(value.platformRole) : void 0;
|
|
5080
|
+
const tenantRole = value.tenantRole !== void 0 ? hydrateTenantRole(value.tenantRole) : void 0;
|
|
5081
|
+
return {
|
|
5082
|
+
id: requiredString5(value, "id"),
|
|
5083
|
+
scope,
|
|
5084
|
+
...optionalString(value, "email") ? { email: optionalString(value, "email") } : {},
|
|
5085
|
+
...platformRole ? { platformRole } : {},
|
|
5086
|
+
...optionalString(value, "tenantId") ? { tenantId: optionalString(value, "tenantId") } : {},
|
|
5087
|
+
...tenantRole ? { tenantRole } : {},
|
|
5088
|
+
...optionalString(value, "createdBy") ? { createdBy: optionalString(value, "createdBy") } : {},
|
|
5089
|
+
createdAt: requiredString5(value, "createdAt"),
|
|
5090
|
+
updatedAt: requiredString5(value, "updatedAt"),
|
|
5091
|
+
expiresAt: requiredString5(value, "expiresAt"),
|
|
5092
|
+
maxUses: Number(value.maxUses),
|
|
5093
|
+
usedCount: Number(value.usedCount),
|
|
5094
|
+
...optionalString(value, "revokedAt") ? { revokedAt: optionalString(value, "revokedAt") } : {},
|
|
5095
|
+
active: value.active === true,
|
|
5096
|
+
url: requiredString5(value, "url")
|
|
5097
|
+
};
|
|
5098
|
+
}
|
|
5099
|
+
function hydrateTenant(value) {
|
|
5100
|
+
if (!isRecord5(value))
|
|
5101
|
+
throw invalidResponse2("Invalid tenant");
|
|
5102
|
+
const metadata = optionalRecord(value, "metadata");
|
|
5103
|
+
return {
|
|
5104
|
+
id: requiredString5(value, "id"),
|
|
5105
|
+
name: requiredString5(value, "name"),
|
|
5106
|
+
description: optionalNullableString(value, "description"),
|
|
5107
|
+
status: hydrateTenantStatus(value.status),
|
|
5108
|
+
...metadata ? { metadata } : {},
|
|
5109
|
+
createdAt: requiredString5(value, "createdAt"),
|
|
5110
|
+
updatedAt: requiredString5(value, "updatedAt")
|
|
5111
|
+
};
|
|
5112
|
+
}
|
|
5113
|
+
function hydrateUser(value) {
|
|
5114
|
+
if (!isRecord5(value))
|
|
5115
|
+
throw invalidResponse2("Invalid user");
|
|
5116
|
+
const status = value.status;
|
|
5117
|
+
if (status !== "active" && status !== "pending" && status !== "suspended") {
|
|
5118
|
+
throw invalidResponse2("Invalid user status");
|
|
5119
|
+
}
|
|
5120
|
+
const metadata = optionalRecord(value, "metadata");
|
|
5121
|
+
return {
|
|
5122
|
+
id: requiredString5(value, "id"),
|
|
5123
|
+
email: requiredString5(value, "email"),
|
|
5124
|
+
name: requiredString5(value, "name"),
|
|
5125
|
+
status,
|
|
5126
|
+
...metadata ? { metadata } : {},
|
|
5127
|
+
...typeof value.createdAt === "string" ? { createdAt: value.createdAt } : {},
|
|
5128
|
+
...typeof value.updatedAt === "string" ? { updatedAt: value.updatedAt } : {}
|
|
5129
|
+
};
|
|
5130
|
+
}
|
|
5131
|
+
function errorFromEnvelope2(payload, response) {
|
|
5132
|
+
const raw = payload?.error;
|
|
5133
|
+
if (typeof raw === "string") {
|
|
5134
|
+
return new PlatformClientError(raw, response.status, raw, false);
|
|
5135
|
+
}
|
|
5136
|
+
if (isRecord5(raw)) {
|
|
5137
|
+
const code = typeof raw.code === "string" ? raw.code : response.ok ? "INVALID_RESPONSE" : "HTTP_ERROR";
|
|
5138
|
+
return new PlatformClientError(
|
|
5139
|
+
typeof raw.message === "string" ? raw.message : "Platform request failed",
|
|
5140
|
+
response.status,
|
|
5141
|
+
code,
|
|
5142
|
+
raw.retryable === true,
|
|
5143
|
+
raw.details
|
|
5144
|
+
);
|
|
5145
|
+
}
|
|
5146
|
+
return new PlatformClientError(
|
|
5147
|
+
"Platform request failed",
|
|
5148
|
+
response.status,
|
|
5149
|
+
response.ok ? "INVALID_RESPONSE" : "HTTP_ERROR",
|
|
5150
|
+
false
|
|
5151
|
+
);
|
|
5152
|
+
}
|
|
5153
|
+
var PlatformClient = class {
|
|
5154
|
+
constructor(baseURL, getHeaders) {
|
|
5155
|
+
this.baseURL = baseURL;
|
|
5156
|
+
this.getHeaders = getHeaders;
|
|
5157
|
+
}
|
|
5158
|
+
async me() {
|
|
5159
|
+
const data = await this.request("/api/platform/me");
|
|
5160
|
+
if (!isRecord5(data))
|
|
5161
|
+
throw invalidResponse2("Invalid platform identity");
|
|
5162
|
+
if (data.role === null || data.role === void 0)
|
|
5163
|
+
return null;
|
|
5164
|
+
return hydratePlatformRole(data.role);
|
|
5165
|
+
}
|
|
5166
|
+
/**
|
|
5167
|
+
* Reads the platform-guarded gateway identity and capability surface.
|
|
5168
|
+
*
|
|
5169
|
+
* @returns The same `GatewayInfo` payload as the legacy public `/info`.
|
|
5170
|
+
*/
|
|
5171
|
+
async getInfo() {
|
|
5172
|
+
return this.request("/api/platform/system/info");
|
|
5173
|
+
}
|
|
5174
|
+
/**
|
|
5175
|
+
* Reads the platform-guarded JSON runtime metrics for this replica.
|
|
5176
|
+
*
|
|
5177
|
+
* @returns The same `SystemMetrics` payload as legacy `/metrics?format=json`.
|
|
5178
|
+
*/
|
|
5179
|
+
async getSystemMetrics() {
|
|
5180
|
+
return this.request("/api/platform/system/metrics");
|
|
5181
|
+
}
|
|
5182
|
+
/**
|
|
5183
|
+
* Reads the effective platform settings, provenance, and version.
|
|
5184
|
+
*
|
|
5185
|
+
* @returns The current snapshot with ISO-string `updatedAt`.
|
|
5186
|
+
*/
|
|
5187
|
+
async getSettings() {
|
|
5188
|
+
const data = await this.request("/api/platform/settings");
|
|
5189
|
+
return hydrateSettingsSnapshot(data);
|
|
5190
|
+
}
|
|
5191
|
+
/**
|
|
5192
|
+
* Applies a partial settings patch and/or resets existing overrides.
|
|
5193
|
+
*
|
|
5194
|
+
* @param input Version guard plus the patch and reset paths.
|
|
5195
|
+
* @returns The committed snapshot after the update.
|
|
5196
|
+
*/
|
|
5197
|
+
async updateSettings(input) {
|
|
5198
|
+
const data = await this.request("/api/platform/settings", {
|
|
5199
|
+
method: "PATCH",
|
|
5200
|
+
body: JSON.stringify(input)
|
|
5201
|
+
});
|
|
5202
|
+
return hydrateSettingsSnapshot(data);
|
|
5203
|
+
}
|
|
5204
|
+
/**
|
|
5205
|
+
* Reads the safe runtime environment projection.
|
|
5206
|
+
*
|
|
5207
|
+
* @returns Runtime identity, public endpoints, dependency presence, and
|
|
5208
|
+
* diagnostics. Secret values are never included.
|
|
5209
|
+
*/
|
|
5210
|
+
async getEnvironment() {
|
|
5211
|
+
const data = await this.request("/api/platform/environment");
|
|
5212
|
+
return hydrateEnvironment(data);
|
|
5213
|
+
}
|
|
5214
|
+
/**
|
|
5215
|
+
* Resolves the public branding for the current gateway host.
|
|
5216
|
+
*
|
|
5217
|
+
* The public `/api/branding` route does not require a session, but this
|
|
5218
|
+
* method reuses the normal request helper and headers.
|
|
5219
|
+
*/
|
|
5220
|
+
async getBranding() {
|
|
5221
|
+
const data = await this.request("/api/branding");
|
|
5222
|
+
return hydrateResolvedBranding(data);
|
|
5223
|
+
}
|
|
5224
|
+
/** Reads the platform default and host-scoped branding settings. */
|
|
5225
|
+
async getBrandingSettings() {
|
|
5226
|
+
const data = await this.request("/api/platform/branding");
|
|
5227
|
+
return hydrateBrandingSettingsView(data);
|
|
5228
|
+
}
|
|
5229
|
+
/**
|
|
5230
|
+
* Replaces the full branding configuration with versioning.
|
|
5231
|
+
*
|
|
5232
|
+
* @param input Version guard plus the complete branding settings document.
|
|
5233
|
+
* @returns The committed branding settings after the update.
|
|
5234
|
+
*/
|
|
5235
|
+
async updateBrandingSettings(input) {
|
|
5236
|
+
const data = await this.request("/api/platform/branding", {
|
|
5237
|
+
method: "PATCH",
|
|
5238
|
+
body: JSON.stringify(input)
|
|
5239
|
+
});
|
|
5240
|
+
return hydrateBrandingSettingsView(data);
|
|
5241
|
+
}
|
|
5242
|
+
async listTenants() {
|
|
5243
|
+
const data = await this.request("/api/tenants");
|
|
5244
|
+
if (!Array.isArray(data))
|
|
5245
|
+
throw invalidResponse2("Invalid tenant list");
|
|
5246
|
+
return data.map(hydrateTenant);
|
|
5247
|
+
}
|
|
5248
|
+
async createTenant(input) {
|
|
5249
|
+
const data = await this.request("/api/tenants", {
|
|
5250
|
+
method: "POST",
|
|
5251
|
+
body: JSON.stringify(input)
|
|
5252
|
+
});
|
|
5253
|
+
return hydrateTenant(data);
|
|
5254
|
+
}
|
|
5255
|
+
async updateTenant(tenantId, input) {
|
|
5256
|
+
const data = await this.request(
|
|
5257
|
+
`/api/tenants/${encodeURIComponent(tenantId)}`,
|
|
5258
|
+
{ method: "PATCH", body: JSON.stringify(input) }
|
|
5259
|
+
);
|
|
5260
|
+
return hydrateTenant(data);
|
|
5261
|
+
}
|
|
5262
|
+
async deleteTenant(tenantId) {
|
|
5263
|
+
await this.request(
|
|
5264
|
+
`/api/tenants/${encodeURIComponent(tenantId)}`,
|
|
5265
|
+
{ method: "DELETE" }
|
|
5266
|
+
);
|
|
5267
|
+
}
|
|
5268
|
+
async listUsers() {
|
|
5269
|
+
const data = await this.request("/api/users");
|
|
5270
|
+
if (!Array.isArray(data))
|
|
5271
|
+
throw invalidResponse2("Invalid user list");
|
|
5272
|
+
return data.map(hydrateUser);
|
|
5273
|
+
}
|
|
5274
|
+
async createUser(input) {
|
|
5275
|
+
const data = await this.request("/api/platform/users", {
|
|
5276
|
+
method: "POST",
|
|
5277
|
+
body: JSON.stringify(input)
|
|
5278
|
+
});
|
|
5279
|
+
return hydrateUser(data);
|
|
5280
|
+
}
|
|
5281
|
+
async updateUser(userId, input) {
|
|
5282
|
+
const data = await this.request(
|
|
5283
|
+
`/api/users/${encodeURIComponent(userId)}`,
|
|
5284
|
+
{ method: "PATCH", body: JSON.stringify(input) }
|
|
5285
|
+
);
|
|
5286
|
+
return hydrateUser(data);
|
|
5287
|
+
}
|
|
5288
|
+
async deleteUser(userId) {
|
|
5289
|
+
await this.request(`/api/users/${encodeURIComponent(userId)}`, {
|
|
5290
|
+
method: "DELETE"
|
|
5291
|
+
});
|
|
5292
|
+
}
|
|
5293
|
+
async listMembers() {
|
|
5294
|
+
const data = await this.request("/api/platform/members");
|
|
5295
|
+
if (!Array.isArray(data))
|
|
5296
|
+
throw invalidResponse2("Invalid member list");
|
|
5297
|
+
return data.map(hydrateMember3);
|
|
5298
|
+
}
|
|
5299
|
+
async grantMember(input) {
|
|
5300
|
+
const data = await this.request("/api/platform/members", {
|
|
5301
|
+
method: "POST",
|
|
5302
|
+
body: JSON.stringify(input)
|
|
5303
|
+
});
|
|
5304
|
+
if (!isRecord5(data))
|
|
5305
|
+
throw invalidResponse2("Invalid platform grant");
|
|
5306
|
+
const member = data.member !== void 0 ? hydrateMember3(data.member) : void 0;
|
|
5307
|
+
const invitation = data.invitation !== void 0 ? hydrateInvitation(data.invitation) : void 0;
|
|
5308
|
+
if (!member && !invitation) {
|
|
5309
|
+
throw invalidResponse2("Invalid platform grant");
|
|
5310
|
+
}
|
|
5311
|
+
return {
|
|
5312
|
+
...member ? { member } : {},
|
|
5313
|
+
...invitation ? { invitation } : {}
|
|
5314
|
+
};
|
|
5315
|
+
}
|
|
5316
|
+
async listInvitations() {
|
|
5317
|
+
const data = await this.request("/api/platform/invitations");
|
|
5318
|
+
if (!Array.isArray(data))
|
|
5319
|
+
throw invalidResponse2("Invalid invitation list");
|
|
5320
|
+
return data.map(hydrateInvitation);
|
|
5321
|
+
}
|
|
5322
|
+
async revokeInvitation(email) {
|
|
5323
|
+
await this.request(
|
|
5324
|
+
`/api/platform/invitations/${encodeURIComponent(email)}`,
|
|
5325
|
+
{ method: "DELETE" }
|
|
5326
|
+
);
|
|
5327
|
+
}
|
|
5328
|
+
async updateMember(userId, role) {
|
|
5329
|
+
const data = await this.request(
|
|
5330
|
+
`/api/platform/members/${encodeURIComponent(userId)}`,
|
|
5331
|
+
{ method: "PATCH", body: JSON.stringify({ role }) }
|
|
5332
|
+
);
|
|
5333
|
+
return hydrateMember3(data);
|
|
5334
|
+
}
|
|
5335
|
+
async revokeMember(userId) {
|
|
5336
|
+
await this.request(
|
|
5337
|
+
`/api/platform/members/${encodeURIComponent(userId)}`,
|
|
5338
|
+
{ method: "DELETE" }
|
|
5339
|
+
);
|
|
5340
|
+
}
|
|
5341
|
+
async listTenantMembers(tenantId) {
|
|
5342
|
+
const query = new URLSearchParams({ tenantId }).toString();
|
|
5343
|
+
const data = await this.request(
|
|
5344
|
+
`/api/platform/tenant-members?${query}`
|
|
5345
|
+
);
|
|
5346
|
+
if (!Array.isArray(data))
|
|
5347
|
+
throw invalidResponse2("Invalid tenant member list");
|
|
5348
|
+
return data.map(hydrateTenantMember);
|
|
5349
|
+
}
|
|
5350
|
+
async addTenantMember(input) {
|
|
5351
|
+
const data = await this.request("/api/platform/tenant-members", {
|
|
5352
|
+
method: "POST",
|
|
5353
|
+
body: JSON.stringify(input)
|
|
5354
|
+
});
|
|
5355
|
+
return hydrateTenantMember(data);
|
|
5356
|
+
}
|
|
5357
|
+
async listInviteLinks() {
|
|
5358
|
+
const data = await this.request("/api/platform/invite-links");
|
|
5359
|
+
if (!Array.isArray(data))
|
|
5360
|
+
throw invalidResponse2("Invalid invite link list");
|
|
5361
|
+
return data.map(hydrateInviteLink);
|
|
5362
|
+
}
|
|
5363
|
+
async createInviteLink(input) {
|
|
5364
|
+
const data = await this.request("/api/platform/invite-links", {
|
|
5365
|
+
method: "POST",
|
|
5366
|
+
body: JSON.stringify(input)
|
|
5367
|
+
});
|
|
5368
|
+
return hydrateInviteLink(data);
|
|
5369
|
+
}
|
|
5370
|
+
async revokeInviteLink(id) {
|
|
5371
|
+
const data = await this.request(
|
|
5372
|
+
`/api/platform/invite-links/${encodeURIComponent(id)}`,
|
|
5373
|
+
{ method: "DELETE" }
|
|
5374
|
+
);
|
|
5375
|
+
return hydrateInviteLink(data);
|
|
5376
|
+
}
|
|
5377
|
+
async getInviteLink(token) {
|
|
5378
|
+
const data = await this.request(
|
|
5379
|
+
`/api/invites/${encodeURIComponent(token)}`
|
|
5380
|
+
);
|
|
5381
|
+
return hydrateInviteLink(data);
|
|
5382
|
+
}
|
|
5383
|
+
async claimInviteLink(token) {
|
|
5384
|
+
const data = await this.request(
|
|
5385
|
+
`/api/invites/${encodeURIComponent(token)}/claim`,
|
|
5386
|
+
{ method: "POST", body: JSON.stringify({}) }
|
|
5387
|
+
);
|
|
5388
|
+
if (!isRecord5(data) || data.status !== "joined" && data.status !== "pending_approval") {
|
|
5389
|
+
throw invalidResponse2("Invalid invite claim result");
|
|
5390
|
+
}
|
|
5391
|
+
const scope = data.scope;
|
|
5392
|
+
if (scope !== "platform" && scope !== "tenant") {
|
|
5393
|
+
throw invalidResponse2("Invalid invite claim scope");
|
|
5394
|
+
}
|
|
5395
|
+
return {
|
|
5396
|
+
status: data.status,
|
|
5397
|
+
scope,
|
|
5398
|
+
...optionalString(data, "tenantId") ? { tenantId: optionalString(data, "tenantId") } : {},
|
|
5399
|
+
...data.tenantRole !== void 0 ? { tenantRole: hydrateTenantRole(data.tenantRole) } : {},
|
|
5400
|
+
...data.platformRole !== void 0 ? { platformRole: hydratePlatformRole(data.platformRole) } : {}
|
|
5401
|
+
};
|
|
5402
|
+
}
|
|
5403
|
+
async updateTenantMemberRole(tenantId, userId, role) {
|
|
5404
|
+
const data = await this.request(
|
|
5405
|
+
`/api/platform/tenant-members/${encodeURIComponent(tenantId)}/${encodeURIComponent(userId)}`,
|
|
5406
|
+
{ method: "PATCH", body: JSON.stringify({ role }) }
|
|
5407
|
+
);
|
|
5408
|
+
return hydrateTenantMember(data);
|
|
5409
|
+
}
|
|
5410
|
+
async removeTenantMember(tenantId, userId) {
|
|
5411
|
+
await this.request(
|
|
5412
|
+
`/api/platform/tenant-members/${encodeURIComponent(tenantId)}/${encodeURIComponent(userId)}`,
|
|
5413
|
+
{ method: "DELETE" }
|
|
5414
|
+
);
|
|
5415
|
+
}
|
|
5416
|
+
async listOidcClaims(status = "pending") {
|
|
5417
|
+
const query = new URLSearchParams({ status }).toString();
|
|
5418
|
+
const data = await this.request(`/api/platform/oidc-claims?${query}`);
|
|
5419
|
+
if (!Array.isArray(data))
|
|
5420
|
+
throw invalidResponse2("Invalid SSO claim list");
|
|
5421
|
+
return data.map(hydrateOidcIdentityClaim);
|
|
5422
|
+
}
|
|
5423
|
+
async updateOidcClaimEmail(id, email) {
|
|
5424
|
+
const data = await this.request(
|
|
5425
|
+
`/api/platform/oidc-claims/${encodeURIComponent(id)}`,
|
|
5426
|
+
{ method: "PATCH", body: JSON.stringify({ email }) }
|
|
5427
|
+
);
|
|
5428
|
+
return hydrateOidcIdentityClaim(data);
|
|
5429
|
+
}
|
|
5430
|
+
async approveOidcClaim(id, input = {}) {
|
|
5431
|
+
const data = await this.request(
|
|
5432
|
+
`/api/platform/oidc-claims/${encodeURIComponent(id)}/approve`,
|
|
5433
|
+
{ method: "POST", body: JSON.stringify(input) }
|
|
5434
|
+
);
|
|
5435
|
+
return hydrateOidcIdentityClaim(data);
|
|
5436
|
+
}
|
|
5437
|
+
async rejectOidcClaim(id) {
|
|
5438
|
+
const data = await this.request(
|
|
5439
|
+
`/api/platform/oidc-claims/${encodeURIComponent(id)}/reject`,
|
|
5440
|
+
{ method: "POST", body: JSON.stringify({}) }
|
|
5441
|
+
);
|
|
5442
|
+
return hydrateOidcIdentityClaim(data);
|
|
5443
|
+
}
|
|
5444
|
+
async request(path, init = {}) {
|
|
5445
|
+
const headers = { ...this.getHeaders() };
|
|
5446
|
+
if (init.body !== void 0) {
|
|
5447
|
+
headers["Content-Type"] = "application/json";
|
|
5448
|
+
}
|
|
5449
|
+
const response = await fetch(`${this.baseURL}${path}`, {
|
|
5450
|
+
...init,
|
|
5451
|
+
headers
|
|
5452
|
+
});
|
|
5453
|
+
const payload = await response.json().catch(() => void 0);
|
|
5454
|
+
if (!response.ok || payload?.success !== true) {
|
|
5455
|
+
throw errorFromEnvelope2(payload, response);
|
|
5456
|
+
}
|
|
5457
|
+
return payload.data;
|
|
5458
|
+
}
|
|
5459
|
+
};
|
|
5460
|
+
|
|
4646
5461
|
// src/client.ts
|
|
4647
5462
|
var _Client = class extends AbstractClient {
|
|
4648
5463
|
/**
|
|
@@ -4664,6 +5479,8 @@ var _Client = class extends AbstractClient {
|
|
|
4664
5479
|
this.workspaceRooms = new WorkspaceRoomsClient(this.config.baseURL, () => this.getAllHeaders());
|
|
4665
5480
|
this.workspaceMembers = new WorkspaceMembersClient(this.config.baseURL, () => this.getAllHeaders());
|
|
4666
5481
|
this.roomEvents = new RoomEventsClient(this.config.baseURL, () => this.getAllHeaders());
|
|
5482
|
+
this.oidcProviders = new OidcProvidersClient(this.config.baseURL, () => this.getAllHeaders());
|
|
5483
|
+
this.platform = new PlatformClient(this.config.baseURL, () => this.getAllHeaders());
|
|
4667
5484
|
}
|
|
4668
5485
|
/**
|
|
4669
5486
|
* Helper method to handle fetch responses and errors
|
|
@@ -6214,6 +7031,10 @@ export {
|
|
|
6214
7031
|
ExportImportClient,
|
|
6215
7032
|
McpAppShareRuntimeClient,
|
|
6216
7033
|
NetworkError,
|
|
7034
|
+
OidcProviderClientError,
|
|
7035
|
+
OidcProvidersClient,
|
|
7036
|
+
PlatformClient,
|
|
7037
|
+
PlatformClientError,
|
|
6217
7038
|
ProjectRoomClientError,
|
|
6218
7039
|
ProjectRoomsClient,
|
|
6219
7040
|
ResourcesClient,
|