@lucern/sdk 0.3.0-alpha.2 → 0.3.0-alpha.4
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/adminClient.d.ts +2 -0
- package/dist/adminClient.js +195 -3
- package/dist/adminClient.js.map +1 -1
- package/dist/answersClient.d.ts +2 -0
- package/dist/answersClient.js +195 -3
- package/dist/answersClient.js.map +1 -1
- package/dist/audiencesClient.d.ts +2 -0
- package/dist/audiencesClient.js +195 -3
- package/dist/audiencesClient.js.map +1 -1
- package/dist/auditClient.d.ts +2 -0
- package/dist/auditClient.js +197 -5
- package/dist/auditClient.js.map +1 -1
- package/dist/authContext.d.ts +56 -0
- package/dist/authContext.js +170 -0
- package/dist/authContext.js.map +1 -0
- package/dist/authDeviceClient.d.ts +49 -0
- package/dist/authDeviceClient.js +108 -0
- package/dist/authDeviceClient.js.map +1 -0
- package/dist/beliefs/index.d.ts +19 -2
- package/dist/beliefs/index.js +2648 -327
- package/dist/beliefs/index.js.map +1 -1
- package/dist/beliefsClient.d.ts +2 -0
- package/dist/beliefsClient.js +199 -7
- package/dist/beliefsClient.js.map +1 -1
- package/dist/boundaryClientSurface.d.ts +20 -0
- package/dist/boundaryClientSurface.js +66 -0
- package/dist/boundaryClientSurface.js.map +1 -0
- package/dist/{client-B6aWUUwp.d.ts → client-DOLqClbU.d.ts} +548 -9
- package/dist/client.d.ts +20 -3
- package/dist/client.js +2648 -327
- package/dist/client.js.map +1 -1
- package/dist/contextClient.d.ts +2 -0
- package/dist/contextClient.js +201 -9
- package/dist/contextClient.js.map +1 -1
- package/dist/contracts/api-enums.contract.d.ts +1 -1
- package/dist/contracts/api-enums.contract.js.map +1 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +104 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/mcpTools.d.ts +46 -1
- package/dist/contracts/mcpTools.js +102 -0
- package/dist/contracts/mcpTools.js.map +1 -1
- package/dist/contradictions/index.d.ts +19 -2
- package/dist/contradictions/index.js +2648 -327
- package/dist/contradictions/index.js.map +1 -1
- package/dist/coreClient.d.ts +9 -0
- package/dist/coreClient.js +195 -3
- package/dist/coreClient.js.map +1 -1
- package/dist/decisions/index.d.ts +19 -2
- package/dist/decisions/index.js +2648 -327
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisionsClient.d.ts +2 -0
- package/dist/decisionsClient.js +198 -6
- package/dist/decisionsClient.js.map +1 -1
- package/dist/edges/index.d.ts +19 -2
- package/dist/edges/index.js +2648 -327
- package/dist/edges/index.js.map +1 -1
- package/dist/embeddingsClient.d.ts +106 -0
- package/dist/embeddingsClient.js +708 -0
- package/dist/embeddingsClient.js.map +1 -0
- package/dist/eventingClient.d.ts +96 -0
- package/dist/eventingClient.js +705 -0
- package/dist/eventingClient.js.map +1 -0
- package/dist/eventsCore.d.ts +2 -0
- package/dist/eventsCore.js +195 -3
- package/dist/eventsCore.js.map +1 -1
- package/dist/evidence/index.d.ts +19 -2
- package/dist/evidence/index.js +2648 -327
- package/dist/evidence/index.js.map +1 -1
- package/dist/evidenceClient.d.ts +2 -0
- package/dist/evidenceClient.js +195 -3
- package/dist/evidenceClient.js.map +1 -1
- package/dist/gatewayFacades.d.ts +38 -3
- package/dist/gatewayFacades.js +371 -12
- package/dist/gatewayFacades.js.map +1 -1
- package/dist/graphAnalysisClient.d.ts +147 -0
- package/dist/graphAnalysisClient.js +756 -0
- package/dist/graphAnalysisClient.js.map +1 -0
- package/dist/graphClient.d.ts +2 -0
- package/dist/graphClient.js +202 -10
- package/dist/graphClient.js.map +1 -1
- package/dist/graphRecommendationsClient.d.ts +56 -0
- package/dist/graphRecommendationsClient.js +646 -0
- package/dist/graphRecommendationsClient.js.map +1 -0
- package/dist/graphStateClassifierClient.d.ts +73 -0
- package/dist/graphStateClassifierClient.js +694 -0
- package/dist/graphStateClassifierClient.js.map +1 -0
- package/dist/harnessClient.d.ts +2 -0
- package/dist/harnessClient.js +197 -5
- package/dist/harnessClient.js.map +1 -1
- package/dist/identityClient.d.ts +89 -3
- package/dist/identityClient.js +363 -4
- package/dist/identityClient.js.map +1 -1
- package/dist/index.d.ts +23 -4
- package/dist/index.js +3098 -353
- package/dist/index.js.map +1 -1
- package/dist/infisicalRuntime.d.ts +42 -0
- package/dist/infisicalRuntime.js +291 -0
- package/dist/infisicalRuntime.js.map +1 -0
- package/dist/jobsClient.d.ts +98 -0
- package/dist/jobsClient.js +704 -0
- package/dist/jobsClient.js.map +1 -0
- package/dist/learningClient.d.ts +2 -0
- package/dist/learningClient.js +197 -5
- package/dist/learningClient.js.map +1 -1
- package/dist/lenses/index.d.ts +43 -2
- package/dist/lenses/index.js +2648 -327
- package/dist/lenses/index.js.map +1 -1
- package/dist/mcpClient.d.ts +28 -0
- package/dist/mcpClient.js +650 -0
- package/dist/mcpClient.js.map +1 -0
- package/dist/modelRuntimeClient.d.ts +72 -0
- package/dist/modelRuntimeClient.js +681 -0
- package/dist/modelRuntimeClient.js.map +1 -0
- package/dist/nodes/index.d.ts +37 -2
- package/dist/nodes/index.js +2648 -327
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +19 -2
- package/dist/ontologies/index.js +2648 -327
- package/dist/ontologies/index.js.map +1 -1
- package/dist/ontologyClient.d.ts +2 -0
- package/dist/ontologyClient.js +195 -3
- package/dist/ontologyClient.js.map +1 -1
- package/dist/ontologyLinksClient.d.ts +71 -0
- package/dist/ontologyLinksClient.js +675 -0
- package/dist/ontologyLinksClient.js.map +1 -0
- package/dist/orgGraphSearchClient.d.ts +85 -0
- package/dist/orgGraphSearchClient.js +652 -0
- package/dist/orgGraphSearchClient.js.map +1 -0
- package/dist/packRuntime.d.ts +1 -2
- package/dist/packsClient.d.ts +2 -0
- package/dist/packsClient.js +195 -3
- package/dist/packsClient.js.map +1 -1
- package/dist/policyClient.d.ts +2 -0
- package/dist/policyClient.js +195 -3
- package/dist/policyClient.js.map +1 -1
- package/dist/questions/index.d.ts +19 -2
- package/dist/questions/index.js +2648 -327
- package/dist/questions/index.js.map +1 -1
- package/dist/reportsClient.d.ts +2 -0
- package/dist/reportsClient.js +197 -5
- package/dist/reportsClient.js.map +1 -1
- package/dist/schemaClient.d.ts +2 -0
- package/dist/schemaClient.js +195 -3
- package/dist/schemaClient.js.map +1 -1
- package/dist/sdkSurface.d.ts +2 -0
- package/dist/sourcesClient.d.ts +2 -0
- package/dist/sourcesClient.js +195 -3
- package/dist/sourcesClient.js.map +1 -1
- package/dist/telemetryClient.d.ts +94 -0
- package/dist/telemetryClient.js +719 -0
- package/dist/telemetryClient.js.map +1 -0
- package/dist/toolRegistryClient.d.ts +107 -0
- package/dist/toolRegistryClient.js +733 -0
- package/dist/toolRegistryClient.js.map +1 -0
- package/dist/topics/index.d.ts +19 -2
- package/dist/topics/index.js +2648 -327
- package/dist/topics/index.js.map +1 -1
- package/dist/topicsClient.d.ts +2 -0
- package/dist/topicsClient.js +200 -8
- package/dist/topicsClient.js.map +1 -1
- package/dist/workflowClient.d.ts +43 -7
- package/dist/workflowClient.js +200 -8
- package/dist/workflowClient.js.map +1 -1
- package/dist/worktrees/index.d.ts +43 -2
- package/dist/worktrees/index.js +2648 -327
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +3 -3
package/dist/identityClient.js
CHANGED
|
@@ -1,3 +1,170 @@
|
|
|
1
|
+
// src/authContext.ts
|
|
2
|
+
var LucernSdkAuthContextError = class extends Error {
|
|
3
|
+
reason;
|
|
4
|
+
constructor(reason, message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "LucernSdkAuthContextError";
|
|
7
|
+
this.reason = reason;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function cleanString(value) {
|
|
11
|
+
const normalized = value?.trim();
|
|
12
|
+
return normalized ? normalized : void 0;
|
|
13
|
+
}
|
|
14
|
+
function cleanStringList(values) {
|
|
15
|
+
if (!values) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return values.map((value) => value.trim()).filter(
|
|
19
|
+
(value, index, list) => value.length > 0 && list.indexOf(value) === index
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function requireString(value, reason, label) {
|
|
23
|
+
const normalized = cleanString(value);
|
|
24
|
+
if (!normalized) {
|
|
25
|
+
throw new LucernSdkAuthContextError(
|
|
26
|
+
reason,
|
|
27
|
+
`Canonical Lucern SDK auth context is missing ${label}.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return normalized;
|
|
31
|
+
}
|
|
32
|
+
function requirePrincipalType(principalType) {
|
|
33
|
+
if (!principalType) {
|
|
34
|
+
throw new LucernSdkAuthContextError(
|
|
35
|
+
"principal_missing",
|
|
36
|
+
"Canonical Lucern SDK auth context is missing principalType."
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return principalType;
|
|
40
|
+
}
|
|
41
|
+
function requireAuthMode(authMode) {
|
|
42
|
+
if (!authMode) {
|
|
43
|
+
throw new LucernSdkAuthContextError(
|
|
44
|
+
"principal_missing",
|
|
45
|
+
"Canonical Lucern SDK auth context is missing authMode."
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return authMode;
|
|
49
|
+
}
|
|
50
|
+
function ensurePermitMatch(args) {
|
|
51
|
+
const actual = cleanString(args.actual);
|
|
52
|
+
if (actual && actual !== args.expected) {
|
|
53
|
+
throw new LucernSdkAuthContextError(
|
|
54
|
+
"policy_denied",
|
|
55
|
+
`Canonical Lucern SDK auth context has conflicting Permit ${args.field}.`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function normalizeCanonicalLucernAuthContext(input) {
|
|
60
|
+
if (!input) {
|
|
61
|
+
throw new LucernSdkAuthContextError(
|
|
62
|
+
"principal_missing",
|
|
63
|
+
"Canonical Lucern SDK auth context is required."
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
if (input.policyDecision === "deny") {
|
|
67
|
+
throw new LucernSdkAuthContextError(
|
|
68
|
+
"policy_denied",
|
|
69
|
+
"Canonical Lucern SDK auth context carries a denied policy decision."
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
const principalId = requireString(
|
|
73
|
+
input.principalId,
|
|
74
|
+
"principal_missing",
|
|
75
|
+
"principalId"
|
|
76
|
+
);
|
|
77
|
+
const tenantId = requireString(input.tenantId, "tenant_missing", "tenantId");
|
|
78
|
+
const workspaceId = requireString(
|
|
79
|
+
input.workspaceId,
|
|
80
|
+
"workspace_missing",
|
|
81
|
+
"workspaceId"
|
|
82
|
+
);
|
|
83
|
+
const roles = cleanStringList(input.roles);
|
|
84
|
+
const scopes = cleanStringList(input.scopes);
|
|
85
|
+
const principalType = requirePrincipalType(input.principalType);
|
|
86
|
+
const authMode = requireAuthMode(input.authMode);
|
|
87
|
+
const roleBasedInteractiveAuth = authMode === "interactive_user" && roles.length > 0;
|
|
88
|
+
if (roles.length === 0 || scopes.length === 0 && !roleBasedInteractiveAuth) {
|
|
89
|
+
throw new LucernSdkAuthContextError(
|
|
90
|
+
"membership_missing",
|
|
91
|
+
"Canonical Lucern SDK auth context requires non-empty roles and scopes."
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const subject = cleanString(input.permit?.subject) ?? principalId;
|
|
95
|
+
const tenant = cleanString(input.permit?.tenant) ?? tenantId;
|
|
96
|
+
const workspace = cleanString(input.permit?.workspace) ?? workspaceId;
|
|
97
|
+
ensurePermitMatch({
|
|
98
|
+
field: "subject",
|
|
99
|
+
expected: principalId,
|
|
100
|
+
actual: subject
|
|
101
|
+
});
|
|
102
|
+
ensurePermitMatch({ field: "tenant", expected: tenantId, actual: tenant });
|
|
103
|
+
ensurePermitMatch({
|
|
104
|
+
field: "workspace",
|
|
105
|
+
expected: workspaceId,
|
|
106
|
+
actual: workspace
|
|
107
|
+
});
|
|
108
|
+
const context = input.permit?.context ? { ...input.permit.context } : void 0;
|
|
109
|
+
return {
|
|
110
|
+
clerkId: cleanString(input.clerkId),
|
|
111
|
+
principalId,
|
|
112
|
+
tenantId,
|
|
113
|
+
workspaceId,
|
|
114
|
+
principalType,
|
|
115
|
+
authMode,
|
|
116
|
+
roles,
|
|
117
|
+
scopes,
|
|
118
|
+
delegationChain: input.delegationChain ? [...input.delegationChain] : [],
|
|
119
|
+
policyTraceId: cleanString(input.policyTraceId),
|
|
120
|
+
correlationId: cleanString(input.correlationId),
|
|
121
|
+
membershipId: cleanString(input.membershipId),
|
|
122
|
+
permit: {
|
|
123
|
+
subject,
|
|
124
|
+
tenant,
|
|
125
|
+
workspace,
|
|
126
|
+
resource: cleanString(input.permit?.resource),
|
|
127
|
+
action: cleanString(input.permit?.action),
|
|
128
|
+
relation: cleanString(input.permit?.relation),
|
|
129
|
+
context
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function createCanonicalAuthHeaders(authContext) {
|
|
134
|
+
const headers = {
|
|
135
|
+
"x-lucern-principal-id": authContext.principalId,
|
|
136
|
+
"x-lucern-principal-type": authContext.principalType,
|
|
137
|
+
"x-lucern-tenant": authContext.tenantId,
|
|
138
|
+
"x-lucern-tenant-id": authContext.tenantId,
|
|
139
|
+
"x-lucern-workspace": authContext.workspaceId,
|
|
140
|
+
"x-lucern-workspace-id": authContext.workspaceId,
|
|
141
|
+
"x-lucern-auth-mode": authContext.authMode,
|
|
142
|
+
"x-lucern-roles": authContext.roles.join(","),
|
|
143
|
+
"x-lucern-scopes": authContext.scopes.join(","),
|
|
144
|
+
"x-lucern-permit-context": JSON.stringify(authContext.permit)
|
|
145
|
+
};
|
|
146
|
+
if (authContext.clerkId) {
|
|
147
|
+
headers["x-lucern-clerk-id"] = authContext.clerkId;
|
|
148
|
+
headers["x-lucern-user-id"] = authContext.clerkId;
|
|
149
|
+
}
|
|
150
|
+
if (authContext.delegationChain.length > 0) {
|
|
151
|
+
headers["x-lucern-delegation-chain"] = JSON.stringify(
|
|
152
|
+
authContext.delegationChain
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
if (authContext.policyTraceId) {
|
|
156
|
+
headers["x-lucern-policy-trace-id"] = authContext.policyTraceId;
|
|
157
|
+
}
|
|
158
|
+
if (authContext.correlationId) {
|
|
159
|
+
headers["x-correlation-id"] = authContext.correlationId;
|
|
160
|
+
headers["x-lucern-correlation-id"] = authContext.correlationId;
|
|
161
|
+
}
|
|
162
|
+
if (authContext.membershipId) {
|
|
163
|
+
headers["x-lucern-membership-id"] = authContext.membershipId;
|
|
164
|
+
}
|
|
165
|
+
return headers;
|
|
166
|
+
}
|
|
167
|
+
|
|
1
168
|
// src/coreClient.ts
|
|
2
169
|
var LucernApiError = class extends Error {
|
|
3
170
|
code;
|
|
@@ -154,16 +321,41 @@ function readPolicySummaryFromDetails(details) {
|
|
|
154
321
|
}
|
|
155
322
|
return null;
|
|
156
323
|
}
|
|
324
|
+
async function resolveConfiguredAuthContext(authContext) {
|
|
325
|
+
if (typeof authContext === "function") {
|
|
326
|
+
return await authContext();
|
|
327
|
+
}
|
|
328
|
+
return authContext;
|
|
329
|
+
}
|
|
330
|
+
function mergeHeaderRecord(base, addition) {
|
|
331
|
+
const headers = new Headers(base);
|
|
332
|
+
for (const [key, value] of Object.entries(addition)) {
|
|
333
|
+
const existing = headers.get(key);
|
|
334
|
+
if (existing !== null && existing !== value) {
|
|
335
|
+
throw new LucernSdkAuthContextError(
|
|
336
|
+
"policy_denied",
|
|
337
|
+
`Canonical Lucern SDK auth context conflicts with existing ${key} header.`
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
headers.set(key, value);
|
|
341
|
+
}
|
|
342
|
+
return Object.fromEntries(headers.entries());
|
|
343
|
+
}
|
|
157
344
|
function createGatewayRequestClient(config = {}) {
|
|
158
345
|
const fetchImpl = config.fetchImpl ?? fetch;
|
|
159
346
|
const baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "";
|
|
160
347
|
const maxRetries = config.maxRetries ?? 2;
|
|
161
348
|
const requestIdFactory = config.requestIdFactory ?? (() => generatePortableRequestId());
|
|
162
349
|
async function resolveAuthHeaders() {
|
|
163
|
-
|
|
164
|
-
|
|
350
|
+
const base = config.getAuthHeaders ? await config.getAuthHeaders() : {};
|
|
351
|
+
const authContextInput = await resolveConfiguredAuthContext(
|
|
352
|
+
config.authContext
|
|
353
|
+
);
|
|
354
|
+
if (!authContextInput && !config.requireCanonicalAuthContext) {
|
|
355
|
+
return base;
|
|
165
356
|
}
|
|
166
|
-
|
|
357
|
+
const authContext = normalizeCanonicalLucernAuthContext(authContextInput);
|
|
358
|
+
return mergeHeaderRecord(base, createCanonicalAuthHeaders(authContext));
|
|
167
359
|
}
|
|
168
360
|
async function fetchWithTimeout(url, init, timeoutMs) {
|
|
169
361
|
const controller = new AbortController();
|
|
@@ -352,6 +544,39 @@ function mapGatewayData(response, mapper) {
|
|
|
352
544
|
};
|
|
353
545
|
}
|
|
354
546
|
|
|
547
|
+
// src/boundaryClientSurface.ts
|
|
548
|
+
function cleanOptionalString(value) {
|
|
549
|
+
const normalized = value?.trim();
|
|
550
|
+
return normalized ? normalized : void 0;
|
|
551
|
+
}
|
|
552
|
+
function cleanRequiredString(value, label) {
|
|
553
|
+
const normalized = cleanOptionalString(value);
|
|
554
|
+
if (!normalized) {
|
|
555
|
+
throw new Error(`${label} is required`);
|
|
556
|
+
}
|
|
557
|
+
return normalized;
|
|
558
|
+
}
|
|
559
|
+
function assertKnownKeys(input, allowed, operation) {
|
|
560
|
+
const allowedSet = new Set(allowed);
|
|
561
|
+
const unknownKeys = Object.keys(input).filter((key) => !allowedSet.has(key));
|
|
562
|
+
if (unknownKeys.length > 0) {
|
|
563
|
+
throw new Error(
|
|
564
|
+
`${operation} received unsupported field(s): ${unknownKeys.join(", ")}`
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function knownPayload(input, allowed, operation) {
|
|
569
|
+
assertKnownKeys(input, allowed, operation);
|
|
570
|
+
return { ...input };
|
|
571
|
+
}
|
|
572
|
+
function listResultFromEnvelope(data, legacyKey) {
|
|
573
|
+
const record = data && typeof data === "object" ? data : {};
|
|
574
|
+
return createListResult(
|
|
575
|
+
Array.isArray(record[legacyKey]) ? record[legacyKey] : Array.isArray(data) ? data : [],
|
|
576
|
+
legacyKey
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
|
|
355
580
|
// src/identityClient.ts
|
|
356
581
|
function createIdentityWhoamiClient(config = {}) {
|
|
357
582
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -363,6 +588,37 @@ function createIdentityWhoamiClient(config = {}) {
|
|
|
363
588
|
}
|
|
364
589
|
};
|
|
365
590
|
}
|
|
591
|
+
var TENANT_IDENTITY_FIELDS = [
|
|
592
|
+
"tenantId",
|
|
593
|
+
"workspaceId",
|
|
594
|
+
"principalId",
|
|
595
|
+
"integrationKey",
|
|
596
|
+
"secretRef",
|
|
597
|
+
"policySubject",
|
|
598
|
+
"policyAction",
|
|
599
|
+
"policyResource",
|
|
600
|
+
"decision",
|
|
601
|
+
"config",
|
|
602
|
+
"configKey",
|
|
603
|
+
"configValue",
|
|
604
|
+
"provider",
|
|
605
|
+
"status",
|
|
606
|
+
"metadata",
|
|
607
|
+
"limit",
|
|
608
|
+
"cursor"
|
|
609
|
+
];
|
|
610
|
+
function tenantIdentityQuery(input) {
|
|
611
|
+
return {
|
|
612
|
+
tenantId: cleanRequiredString(input.tenantId, "tenantId"),
|
|
613
|
+
workspaceId: input.workspaceId,
|
|
614
|
+
principalId: input.principalId,
|
|
615
|
+
limit: input.limit,
|
|
616
|
+
cursor: input.cursor
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
function tenantIdentityBody(input, operation) {
|
|
620
|
+
return knownPayload(input, TENANT_IDENTITY_FIELDS, operation);
|
|
621
|
+
}
|
|
366
622
|
function createIdentityClient(config = {}) {
|
|
367
623
|
const gateway = createGatewayRequestClient(config);
|
|
368
624
|
const whoamiClient = createIdentityWhoamiClient(config);
|
|
@@ -488,10 +744,113 @@ function createIdentityClient(config = {}) {
|
|
|
488
744
|
return gateway.request({
|
|
489
745
|
path: `/api/platform/v1/identity/clerk-users${toQueryString({ q })}`
|
|
490
746
|
});
|
|
747
|
+
},
|
|
748
|
+
async getTenantConfig(input) {
|
|
749
|
+
return gateway.request({
|
|
750
|
+
path: `/api/platform/v1/identity/tenant-config${toQueryString(
|
|
751
|
+
tenantIdentityQuery(input)
|
|
752
|
+
)}`
|
|
753
|
+
});
|
|
754
|
+
},
|
|
755
|
+
async updateTenantConfig(input, idempotencyKey) {
|
|
756
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
757
|
+
return gateway.request({
|
|
758
|
+
path: "/api/platform/v1/identity/tenant-config",
|
|
759
|
+
method: "PATCH",
|
|
760
|
+
body: tenantIdentityBody(
|
|
761
|
+
input,
|
|
762
|
+
"identity.updateTenantConfig"
|
|
763
|
+
),
|
|
764
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
765
|
+
});
|
|
766
|
+
},
|
|
767
|
+
async listIntegrations(input) {
|
|
768
|
+
return gateway.request({
|
|
769
|
+
path: `/api/platform/v1/identity/integrations${toQueryString(
|
|
770
|
+
tenantIdentityQuery(input)
|
|
771
|
+
)}`
|
|
772
|
+
}).then(
|
|
773
|
+
(response) => mapGatewayData(
|
|
774
|
+
response,
|
|
775
|
+
(data) => listResultFromEnvelope(
|
|
776
|
+
data,
|
|
777
|
+
"integrations"
|
|
778
|
+
)
|
|
779
|
+
)
|
|
780
|
+
);
|
|
781
|
+
},
|
|
782
|
+
async upsertIntegration(input, idempotencyKey) {
|
|
783
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
784
|
+
cleanRequiredString(input.integrationKey, "integrationKey");
|
|
785
|
+
return gateway.request({
|
|
786
|
+
path: "/api/platform/v1/identity/integrations",
|
|
787
|
+
method: "PUT",
|
|
788
|
+
body: tenantIdentityBody(
|
|
789
|
+
input,
|
|
790
|
+
"identity.upsertIntegration"
|
|
791
|
+
),
|
|
792
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
793
|
+
});
|
|
794
|
+
},
|
|
795
|
+
async listSecrets(input) {
|
|
796
|
+
return gateway.request({
|
|
797
|
+
path: `/api/platform/v1/identity/secrets${toQueryString(
|
|
798
|
+
tenantIdentityQuery(input)
|
|
799
|
+
)}`
|
|
800
|
+
}).then(
|
|
801
|
+
(response) => mapGatewayData(
|
|
802
|
+
response,
|
|
803
|
+
(data) => listResultFromEnvelope(
|
|
804
|
+
data,
|
|
805
|
+
"secrets"
|
|
806
|
+
)
|
|
807
|
+
)
|
|
808
|
+
);
|
|
809
|
+
},
|
|
810
|
+
async putSecretReference(input, idempotencyKey) {
|
|
811
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
812
|
+
cleanRequiredString(input.secretRef, "secretRef");
|
|
813
|
+
return gateway.request({
|
|
814
|
+
path: "/api/platform/v1/identity/secrets",
|
|
815
|
+
method: "PUT",
|
|
816
|
+
body: tenantIdentityBody(
|
|
817
|
+
input,
|
|
818
|
+
"identity.putSecretReference"
|
|
819
|
+
),
|
|
820
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
821
|
+
});
|
|
822
|
+
},
|
|
823
|
+
async evaluatePolicy(input, idempotencyKey) {
|
|
824
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
825
|
+
cleanRequiredString(input.policySubject, "policySubject");
|
|
826
|
+
cleanRequiredString(input.policyAction, "policyAction");
|
|
827
|
+
cleanRequiredString(input.policyResource, "policyResource");
|
|
828
|
+
return gateway.request({
|
|
829
|
+
path: "/api/platform/v1/identity/policy/evaluate",
|
|
830
|
+
method: "POST",
|
|
831
|
+
body: tenantIdentityBody(
|
|
832
|
+
input,
|
|
833
|
+
"identity.evaluatePolicy"
|
|
834
|
+
),
|
|
835
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
836
|
+
});
|
|
837
|
+
},
|
|
838
|
+
async recordPolicyDecision(input, idempotencyKey) {
|
|
839
|
+
cleanRequiredString(input.tenantId, "tenantId");
|
|
840
|
+
cleanRequiredString(input.decision, "decision");
|
|
841
|
+
return gateway.request({
|
|
842
|
+
path: "/api/platform/v1/identity/policy/decisions",
|
|
843
|
+
method: "POST",
|
|
844
|
+
body: tenantIdentityBody(
|
|
845
|
+
input,
|
|
846
|
+
"identity.recordPolicyDecision"
|
|
847
|
+
),
|
|
848
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
849
|
+
});
|
|
491
850
|
}
|
|
492
851
|
};
|
|
493
852
|
}
|
|
494
853
|
|
|
495
|
-
export { LucernApiError, createIdentityClient };
|
|
854
|
+
export { LucernApiError, TENANT_IDENTITY_FIELDS, createIdentityClient };
|
|
496
855
|
//# sourceMappingURL=identityClient.js.map
|
|
497
856
|
//# sourceMappingURL=identityClient.js.map
|