@lucern/sdk 0.3.0-alpha.5 → 0.3.0-alpha.7
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/CHANGELOG.md +3 -0
- package/dist/adminClient.d.ts +8 -8
- package/dist/adminClient.js +47 -36
- package/dist/adminClient.js.map +1 -1
- package/dist/answersClient.js +26 -8
- package/dist/answersClient.js.map +1 -1
- package/dist/audience/index.d.ts +2 -1
- package/dist/audience/index.js +1 -3
- package/dist/audience/index.js.map +1 -1
- package/dist/audiencesClient.d.ts +16 -16
- package/dist/audiencesClient.js +102 -87
- package/dist/audiencesClient.js.map +1 -1
- package/dist/auditClient.js +30 -10
- package/dist/auditClient.js.map +1 -1
- package/dist/authDeviceClient.js +16 -3
- package/dist/authDeviceClient.js.map +1 -1
- package/dist/beliefs/index.d.ts +3 -3
- package/dist/beliefs/index.js +513 -758
- package/dist/beliefs/index.js.map +1 -1
- package/dist/beliefsClient.d.ts +2 -2
- package/dist/beliefsClient.js +31 -19
- package/dist/beliefsClient.js.map +1 -1
- package/dist/boundaryClientSurface.js +10 -3
- package/dist/boundaryClientSurface.js.map +1 -1
- package/dist/client.d.ts +247 -270
- package/dist/client.js +513 -758
- package/dist/client.js.map +1 -1
- package/dist/clientHelpers.d.ts +29 -0
- package/dist/clientHelpers.js +122 -0
- package/dist/clientHelpers.js.map +1 -0
- package/dist/contextClient.js +26 -8
- package/dist/contextClient.js.map +1 -1
- package/dist/contextPackCompiler.js +19 -30
- package/dist/contextPackCompiler.js.map +1 -1
- package/dist/contextPackPolicy.js +7 -17
- package/dist/contextPackPolicy.js.map +1 -1
- package/dist/contracts/index.js +4 -3
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/lens-filter.contract.js +4 -3
- package/dist/contracts/lens-filter.contract.js.map +1 -1
- package/dist/contracts/lens-workflow.contract.js +4 -3
- package/dist/contracts/lens-workflow.contract.js.map +1 -1
- package/dist/contracts/lensFilter.js +4 -3
- package/dist/contracts/lensFilter.js.map +1 -1
- package/dist/contracts/lensWorkflow.js +4 -3
- package/dist/contracts/lensWorkflow.js.map +1 -1
- package/dist/contradictions/index.d.ts +2 -2
- package/dist/contradictions/index.js +513 -758
- package/dist/contradictions/index.js.map +1 -1
- package/dist/coreClient.d.ts +2 -1
- package/dist/coreClient.js +27 -11
- package/dist/coreClient.js.map +1 -1
- package/dist/decisions/index.d.ts +12 -12
- package/dist/decisions/index.js +513 -758
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisionsClient.d.ts +4 -12
- package/dist/decisionsClient.js +37 -31
- package/dist/decisionsClient.js.map +1 -1
- package/dist/edges/index.d.ts +2 -2
- package/dist/edges/index.js +513 -758
- package/dist/edges/index.js.map +1 -1
- package/dist/embeddingsClient.js +37 -14
- package/dist/embeddingsClient.js.map +1 -1
- package/dist/eventingClient.js +37 -14
- package/dist/eventingClient.js.map +1 -1
- package/dist/events.js +6 -3
- package/dist/events.js.map +1 -1
- package/dist/eventsCore.d.ts +1 -1
- package/dist/eventsCore.js +27 -11
- package/dist/eventsCore.js.map +1 -1
- package/dist/evidence/index.d.ts +2 -2
- package/dist/evidence/index.js +513 -758
- package/dist/evidence/index.js.map +1 -1
- package/dist/evidenceClient.js +27 -11
- package/dist/evidenceClient.js.map +1 -1
- package/dist/functionSurface.js +27 -11
- package/dist/functionSurface.js.map +1 -1
- package/dist/functionSurfaceClient.js +27 -11
- package/dist/functionSurfaceClient.js.map +1 -1
- package/dist/gatewayFacades.d.ts +27 -45
- package/dist/gatewayFacades.js +92 -118
- package/dist/gatewayFacades.js.map +1 -1
- package/dist/graphAnalysisClient.js +31 -12
- package/dist/graphAnalysisClient.js.map +1 -1
- package/dist/graphClient.d.ts +5 -13
- package/dist/graphClient.js +42 -35
- package/dist/graphClient.js.map +1 -1
- package/dist/graphRecommendationsClient.js +31 -13
- package/dist/graphRecommendationsClient.js.map +1 -1
- package/dist/graphStateClassifierClient.js +37 -15
- package/dist/graphStateClassifierClient.js.map +1 -1
- package/dist/harnessClient.d.ts +13 -24
- package/dist/harnessClient.js +38 -37
- package/dist/harnessClient.js.map +1 -1
- package/dist/identityClient.d.ts +8 -8
- package/dist/identityClient.js +48 -31
- package/dist/identityClient.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +592 -819
- package/dist/index.js.map +1 -1
- package/dist/infisicalRuntime.js +47 -24
- package/dist/infisicalRuntime.js.map +1 -1
- package/dist/jobsClient.js +37 -15
- package/dist/jobsClient.js.map +1 -1
- package/dist/learningClient.d.ts +6 -6
- package/dist/learningClient.js +55 -39
- package/dist/learningClient.js.map +1 -1
- package/dist/lenses/index.d.ts +29 -35
- package/dist/lenses/index.js +513 -758
- package/dist/lenses/index.js.map +1 -1
- package/dist/mcpClient.js +26 -8
- package/dist/mcpClient.js.map +1 -1
- package/dist/modelRuntimeClient.js +37 -14
- package/dist/modelRuntimeClient.js.map +1 -1
- package/dist/nodes/index.d.ts +17 -17
- package/dist/nodes/index.js +513 -758
- package/dist/nodes/index.js.map +1 -1
- package/dist/ontologies/index.d.ts +31 -30
- package/dist/ontologies/index.js +513 -758
- package/dist/ontologies/index.js.map +1 -1
- package/dist/ontologyClient.d.ts +17 -25
- package/dist/ontologyClient.js +63 -37
- package/dist/ontologyClient.js.map +1 -1
- package/dist/ontologyLinksClient.js +37 -15
- package/dist/ontologyLinksClient.js.map +1 -1
- package/dist/orgGraphSearchClient.js +30 -10
- package/dist/orgGraphSearchClient.js.map +1 -1
- package/dist/packsClient.d.ts +9 -23
- package/dist/packsClient.js +39 -43
- package/dist/packsClient.js.map +1 -1
- package/dist/policyClient.d.ts +11 -10
- package/dist/policyClient.js +48 -22
- package/dist/policyClient.js.map +1 -1
- package/dist/questions/index.d.ts +2 -2
- package/dist/questions/index.js +513 -758
- package/dist/questions/index.js.map +1 -1
- package/dist/realtime/index.d.ts +1 -1
- package/dist/reportsClient.d.ts +7 -7
- package/dist/reportsClient.js +84 -48
- package/dist/reportsClient.js.map +1 -1
- package/dist/schemaClient.d.ts +3 -3
- package/dist/schemaClient.js +40 -26
- package/dist/schemaClient.js.map +1 -1
- package/dist/sdkSurface.d.ts +6 -3
- package/dist/sdkSurface.js +10 -6
- package/dist/sdkSurface.js.map +1 -1
- package/dist/sourcesClient.js +27 -11
- package/dist/sourcesClient.js.map +1 -1
- package/dist/telemetryClient.js +37 -15
- package/dist/telemetryClient.js.map +1 -1
- package/dist/toolRegistryClient.d.ts +10 -2
- package/dist/toolRegistryClient.js +50 -16
- package/dist/toolRegistryClient.js.map +1 -1
- package/dist/topics/index.d.ts +5 -5
- package/dist/topics/index.js +513 -758
- package/dist/topics/index.js.map +1 -1
- package/dist/topicsClient.js +37 -16
- package/dist/topicsClient.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workflowClient.d.ts +15 -33
- package/dist/workflowClient.js +43 -50
- package/dist/workflowClient.js.map +1 -1
- package/dist/worktrees/index.d.ts +22 -30
- package/dist/worktrees/index.js +513 -758
- package/dist/worktrees/index.js.map +1 -1
- package/package.json +4 -4
package/dist/gatewayFacades.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GatewayClientConfig, PlatformGatewaySuccess } from './coreClient.js';
|
|
1
|
+
import { TopicCreateInput, TopicListInput, TopicUpdateInput, TopicTreeQuery, TopicCoverageQuery, TopicBulkCreateInput } from './topicsClient.js';
|
|
2
|
+
import { GatewayClientConfig, PlatformGatewaySuccess, GatewayScope } from './coreClient.js';
|
|
3
|
+
import { TraverseInput, AnalyzeInput, BiasInput, GapsInput } from './graphClient.js';
|
|
4
|
+
import { JsonObject, GraphNeighborhoodResponse, TopicRecord, TopicListResponse, TopicTreeResponse, TopicCoverageResponse } from './types.js';
|
|
3
5
|
import { ModulateConfidenceInput } from './beliefsClient.js';
|
|
4
6
|
import { OntologyBindingInput } from './ontologyClient.js';
|
|
5
|
-
import
|
|
7
|
+
import './authContext.js';
|
|
8
|
+
import './contracts/auth-session.contract.js';
|
|
6
9
|
import './contracts/workflow-runtime.contract.js';
|
|
7
10
|
import './contracts/lens-workflow.contract.js';
|
|
8
11
|
import './contracts/lens-filter.contract.js';
|
|
9
|
-
import './authContext.js';
|
|
10
|
-
import './contracts/auth-session.contract.js';
|
|
11
12
|
import './opinion.js';
|
|
12
13
|
|
|
13
14
|
type GatewayRecord = Record<string, unknown>;
|
|
@@ -36,26 +37,6 @@ type GraphNeighborhoodInput = {
|
|
|
36
37
|
globalIds?: string | string[];
|
|
37
38
|
maxDepth?: number;
|
|
38
39
|
};
|
|
39
|
-
type GraphTraverseInput = {
|
|
40
|
-
startNode: string;
|
|
41
|
-
direction?: string;
|
|
42
|
-
maxDepth?: number;
|
|
43
|
-
topicId?: string;
|
|
44
|
-
};
|
|
45
|
-
type GraphAnalyzeInput = {
|
|
46
|
-
topicId?: string;
|
|
47
|
-
metric?: GraphAnalyticsMetric;
|
|
48
|
-
limit?: number;
|
|
49
|
-
};
|
|
50
|
-
type GraphBiasInput = {
|
|
51
|
-
topicId?: string;
|
|
52
|
-
threshold?: number;
|
|
53
|
-
limit?: number;
|
|
54
|
-
};
|
|
55
|
-
type GraphGapsInput = {
|
|
56
|
-
topicId?: string;
|
|
57
|
-
minConfidence?: number;
|
|
58
|
-
};
|
|
59
40
|
type GraphFalsifyInput = {
|
|
60
41
|
topicId?: string;
|
|
61
42
|
beliefId?: string;
|
|
@@ -363,11 +344,6 @@ type WorktreeTargetsInput = {
|
|
|
363
344
|
removeBeliefIds?: string[];
|
|
364
345
|
removeQuestionIds?: string[];
|
|
365
346
|
};
|
|
366
|
-
type OntologyListInput = {
|
|
367
|
-
tenantId?: string;
|
|
368
|
-
tier?: string;
|
|
369
|
-
status?: string;
|
|
370
|
-
};
|
|
371
347
|
type OntologyMatchInput = GatewayRecord;
|
|
372
348
|
type WebhookCreateInput = GatewayRecord;
|
|
373
349
|
type WebhookUpdateInput = GatewayRecord;
|
|
@@ -499,11 +475,12 @@ declare function createEventsFacade(config?: GatewayClientConfig): {
|
|
|
499
475
|
};
|
|
500
476
|
declare function createGraphFacade(config?: GatewayClientConfig): {
|
|
501
477
|
neighborhood(input: GraphNeighborhoodInput): Promise<PlatformGatewaySuccess<GraphNeighborhoodResponse>>;
|
|
502
|
-
traverse(input: GraphTraverseInput): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
503
|
-
analyze(input?: GraphAnalyzeInput): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
504
|
-
bias(input?: GraphBiasInput): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
505
|
-
gaps(input: GraphGapsInput): Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
506
478
|
falsify(input: GraphFalsifyInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
|
|
479
|
+
} & {
|
|
480
|
+
traverse: (query: TraverseInput) => Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
481
|
+
analyze: (query?: AnalyzeInput) => Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
482
|
+
bias: (query?: BiasInput) => Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
483
|
+
gaps: (query: GapsInput) => Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
507
484
|
};
|
|
508
485
|
declare function createIdentityFacade(config?: GatewayClientConfig): {
|
|
509
486
|
whoami(): Promise<PlatformGatewaySuccess<{
|
|
@@ -538,14 +515,19 @@ declare function createIdentityFacade(config?: GatewayClientConfig): {
|
|
|
538
515
|
};
|
|
539
516
|
declare function createOntologiesFacade(config?: GatewayClientConfig): {
|
|
540
517
|
get(id: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
|
|
541
|
-
list(query?: OntologyListInput): Promise<PlatformGatewaySuccess<{
|
|
542
|
-
ontologies: any[];
|
|
543
|
-
total: number;
|
|
544
|
-
items: any[];
|
|
545
|
-
definitions: any[];
|
|
546
|
-
}>>;
|
|
547
518
|
bind(input: OntologyBindingInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
|
|
548
519
|
match(input: OntologyMatchInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
|
|
520
|
+
} & {
|
|
521
|
+
list: (filters?: GatewayScope & {
|
|
522
|
+
tenantId?: string;
|
|
523
|
+
tier?: string;
|
|
524
|
+
status?: string;
|
|
525
|
+
}) => Promise<PlatformGatewaySuccess<{
|
|
526
|
+
ontologies: unknown[];
|
|
527
|
+
total: number;
|
|
528
|
+
items: unknown[];
|
|
529
|
+
definitions: unknown[];
|
|
530
|
+
}>>;
|
|
549
531
|
};
|
|
550
532
|
declare function createQuestionsFacade(config?: GatewayClientConfig): {
|
|
551
533
|
create(input: QuestionCreateInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
|
|
@@ -574,9 +556,9 @@ declare function createTasksFacade(config?: GatewayClientConfig): {
|
|
|
574
556
|
list(query: TaskListQuery): Promise<PlatformGatewaySuccess<TaskListResult>>;
|
|
575
557
|
};
|
|
576
558
|
declare function createTopicsFacade(config?: GatewayClientConfig): {
|
|
577
|
-
create(input: TopicCreateInput, idempotencyKey?: string)
|
|
578
|
-
get(
|
|
579
|
-
list(query?: TopicListInput)
|
|
559
|
+
create: (input: TopicCreateInput, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<TopicRecord>>;
|
|
560
|
+
get: (topicId: string) => Promise<PlatformGatewaySuccess<TopicRecord>>;
|
|
561
|
+
list: (query?: TopicListInput) => Promise<PlatformGatewaySuccess<TopicListResponse>>;
|
|
580
562
|
update(input: TopicUpdateInput & {
|
|
581
563
|
id: string;
|
|
582
564
|
}, idempotencyKey?: string): Promise<PlatformGatewaySuccess<TopicRecord>>;
|
|
@@ -586,8 +568,8 @@ declare function createTopicsFacade(config?: GatewayClientConfig): {
|
|
|
586
568
|
coverage(input: TopicCoverageQuery & {
|
|
587
569
|
id: string;
|
|
588
570
|
}): Promise<PlatformGatewaySuccess<TopicCoverageResponse>>;
|
|
589
|
-
remove(
|
|
590
|
-
bulkCreate(input: TopicBulkCreateInput, idempotencyKey?: string)
|
|
571
|
+
remove: (topicId: string, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
572
|
+
bulkCreate: (input: TopicBulkCreateInput, idempotencyKey?: string) => Promise<PlatformGatewaySuccess<Record<string, unknown>>>;
|
|
591
573
|
};
|
|
592
574
|
declare function createWebhooksFacade(config?: GatewayClientConfig): {
|
|
593
575
|
create(input: WebhookCreateInput, idempotencyKey?: string): Promise<PlatformGatewaySuccess<GatewayRecord>>;
|
package/dist/gatewayFacades.js
CHANGED
|
@@ -232,9 +232,7 @@ function generatePortableRequestId() {
|
|
|
232
232
|
8
|
|
233
233
|
).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
234
234
|
}
|
|
235
|
-
|
|
236
|
-
return generatePortableRequestId();
|
|
237
|
-
}
|
|
235
|
+
var randomIdempotencyKey = generatePortableRequestId;
|
|
238
236
|
function isRetryableStatus(status) {
|
|
239
237
|
return status >= 500 || status === 408 || status === 429;
|
|
240
238
|
}
|
|
@@ -299,8 +297,11 @@ function timeoutError(timeoutMs) {
|
|
|
299
297
|
error.name = "AbortError";
|
|
300
298
|
return error;
|
|
301
299
|
}
|
|
300
|
+
function isRecord(value) {
|
|
301
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
302
|
+
}
|
|
302
303
|
function readPolicySummaryFromDetails(details) {
|
|
303
|
-
if (!
|
|
304
|
+
if (!isRecord(details)) {
|
|
304
305
|
return null;
|
|
305
306
|
}
|
|
306
307
|
const directSummary = details.summary;
|
|
@@ -308,11 +309,11 @@ function readPolicySummaryFromDetails(details) {
|
|
|
308
309
|
return directSummary.trim();
|
|
309
310
|
}
|
|
310
311
|
const policy = details.policy;
|
|
311
|
-
if (!
|
|
312
|
+
if (!isRecord(policy)) {
|
|
312
313
|
return null;
|
|
313
314
|
}
|
|
314
315
|
const explanation = policy.explanation;
|
|
315
|
-
if (!
|
|
316
|
+
if (!isRecord(explanation)) {
|
|
316
317
|
return null;
|
|
317
318
|
}
|
|
318
319
|
const nestedSummary = explanation.summary;
|
|
@@ -376,11 +377,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
376
377
|
if (!text) {
|
|
377
378
|
return null;
|
|
378
379
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
} catch {
|
|
380
|
+
const parsed = tryParseGatewayEnvelopeJson(text);
|
|
381
|
+
if (!parsed.ok) {
|
|
382
382
|
return null;
|
|
383
383
|
}
|
|
384
|
+
return isRecord(parsed.value) ? parsed.value : null;
|
|
384
385
|
}
|
|
385
386
|
function resolveTimeoutMs(method, requestTimeoutMs) {
|
|
386
387
|
if (typeof requestTimeoutMs === "number") {
|
|
@@ -392,16 +393,31 @@ function createGatewayRequestClient(config = {}) {
|
|
|
392
393
|
}
|
|
393
394
|
return config.timeoutMs ?? 15e3;
|
|
394
395
|
}
|
|
396
|
+
function tryParseGatewayEnvelopeJson(text) {
|
|
397
|
+
const trimmed = text.trim();
|
|
398
|
+
if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
|
|
399
|
+
return { ok: false, reason: "non-json" };
|
|
400
|
+
}
|
|
401
|
+
try {
|
|
402
|
+
return { ok: true, value: JSON.parse(trimmed) };
|
|
403
|
+
} catch (error) {
|
|
404
|
+
if (error instanceof SyntaxError) {
|
|
405
|
+
return { ok: false, reason: "invalid-json", error };
|
|
406
|
+
}
|
|
407
|
+
throw error;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
395
410
|
function buildApiError(args) {
|
|
396
411
|
const failure = args.failure;
|
|
397
|
-
const legacyError = failure &&
|
|
412
|
+
const legacyError = failure && isRecord(failure.error) ? failure.error : failure?.legacyError;
|
|
398
413
|
const correlationId = failure?.correlationId ?? args.response.headers.get("x-lucern-correlation-id")?.trim() ?? args.requestId;
|
|
399
414
|
const policyTraceId = failure?.policyTraceId ?? args.response.headers.get("x-lucern-policy-trace-id")?.trim() ?? null;
|
|
400
415
|
const details = failure?.details ?? legacyError?.details;
|
|
401
416
|
const policySummary = readPolicySummaryFromDetails(details);
|
|
417
|
+
const failureMessage = typeof failure?.error === "string" ? failure.error : legacyError?.message;
|
|
402
418
|
return new LucernApiError({
|
|
403
419
|
code: failure?.code ?? legacyError?.code ?? fallbackErrorCode(args.response.status),
|
|
404
|
-
message: policySummary ??
|
|
420
|
+
message: policySummary ?? failureMessage ?? (args.response.ok ? "Platform API returned an invalid success payload." : "Platform API request failed."),
|
|
405
421
|
status: args.response.status,
|
|
406
422
|
invariant: failure?.invariant,
|
|
407
423
|
suggestion: failure?.suggestion,
|
|
@@ -527,8 +543,11 @@ function createGatewayRequestClient(config = {}) {
|
|
|
527
543
|
}
|
|
528
544
|
|
|
529
545
|
// src/sdkSurface.ts
|
|
546
|
+
function isRecord2(value) {
|
|
547
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
548
|
+
}
|
|
530
549
|
function asRecord(value) {
|
|
531
|
-
return value
|
|
550
|
+
return isRecord2(value) ? value : {};
|
|
532
551
|
}
|
|
533
552
|
function cleanString2(value) {
|
|
534
553
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
@@ -589,9 +608,7 @@ function normalizeNodeWriteInput(value) {
|
|
|
589
608
|
}
|
|
590
609
|
return next;
|
|
591
610
|
}
|
|
592
|
-
|
|
593
|
-
return normalizeVerificationStatus(value);
|
|
594
|
-
}
|
|
611
|
+
var normalizeNodeVerificationStatus = normalizeVerificationStatus;
|
|
595
612
|
function normalizeTopicQuery(value) {
|
|
596
613
|
const topicId = cleanString2(value.topicId);
|
|
597
614
|
if (!topicId) {
|
|
@@ -618,7 +635,10 @@ function createListResult(items, legacyKey) {
|
|
|
618
635
|
total: items.length
|
|
619
636
|
};
|
|
620
637
|
if (legacyKey) {
|
|
621
|
-
|
|
638
|
+
return {
|
|
639
|
+
...result,
|
|
640
|
+
[legacyKey]: items
|
|
641
|
+
};
|
|
622
642
|
}
|
|
623
643
|
return result;
|
|
624
644
|
}
|
|
@@ -638,7 +658,7 @@ function mapAliasedList(data, legacyKey) {
|
|
|
638
658
|
// src/ontologyClient.ts
|
|
639
659
|
function createOntologyClient(config = {}) {
|
|
640
660
|
const gateway = createGatewayRequestClient(config);
|
|
641
|
-
|
|
661
|
+
const client = {
|
|
642
662
|
/**
|
|
643
663
|
* List ontology definitions matching optional filters.
|
|
644
664
|
*/
|
|
@@ -647,13 +667,14 @@ function createOntologyClient(config = {}) {
|
|
|
647
667
|
path: `/api/platform/v1/ontologies${toQueryString(filters)}`
|
|
648
668
|
}).then(
|
|
649
669
|
(response) => mapGatewayData(response, (data) => {
|
|
650
|
-
const record =
|
|
651
|
-
const ontologies =
|
|
652
|
-
const
|
|
670
|
+
const record = asRecord(data);
|
|
671
|
+
const ontologies = asListItems(data, "ontologies");
|
|
672
|
+
const definitions = ontologies.length > 0 ? ontologies : asListItems(data, "definitions");
|
|
673
|
+
const total = typeof record.total === "number" && Number.isFinite(record.total) ? record.total : definitions.length;
|
|
653
674
|
return {
|
|
654
675
|
...record,
|
|
655
|
-
...createListResult(
|
|
656
|
-
ontologies,
|
|
676
|
+
...createListResult(definitions, "definitions"),
|
|
677
|
+
ontologies: definitions,
|
|
657
678
|
total
|
|
658
679
|
};
|
|
659
680
|
})
|
|
@@ -680,18 +701,6 @@ function createOntologyClient(config = {}) {
|
|
|
680
701
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
681
702
|
});
|
|
682
703
|
},
|
|
683
|
-
/**
|
|
684
|
-
* List ontology definitions.
|
|
685
|
-
*/
|
|
686
|
-
async listDefinitions(filters = {}) {
|
|
687
|
-
return this.list(filters);
|
|
688
|
-
},
|
|
689
|
-
/**
|
|
690
|
-
* Get an ontology definition.
|
|
691
|
-
*/
|
|
692
|
-
async getDefinition(id) {
|
|
693
|
-
return this.get(id);
|
|
694
|
-
},
|
|
695
704
|
/**
|
|
696
705
|
* Create an ontology definition.
|
|
697
706
|
*/
|
|
@@ -733,7 +742,7 @@ function createOntologyClient(config = {}) {
|
|
|
733
742
|
}).then(
|
|
734
743
|
(response) => mapGatewayData(
|
|
735
744
|
response,
|
|
736
|
-
(data) => createListResult(
|
|
745
|
+
(data) => createListResult(asListItems(data, "versions"), "versions")
|
|
737
746
|
)
|
|
738
747
|
);
|
|
739
748
|
},
|
|
@@ -781,20 +790,19 @@ function createOntologyClient(config = {}) {
|
|
|
781
790
|
(data) => createListResult(Array.isArray(data) ? data : [], "topics")
|
|
782
791
|
)
|
|
783
792
|
);
|
|
784
|
-
},
|
|
785
|
-
/**
|
|
786
|
-
* @deprecated Use listTopics.
|
|
787
|
-
*/
|
|
788
|
-
async listTopicsByOntology(ontologyId) {
|
|
789
|
-
return this.listTopics(ontologyId);
|
|
790
793
|
}
|
|
791
794
|
};
|
|
795
|
+
return Object.assign(client, {
|
|
796
|
+
listDefinitions: client.list,
|
|
797
|
+
getDefinition: client.get,
|
|
798
|
+
listTopicsByOntology: client.listTopics
|
|
799
|
+
});
|
|
792
800
|
}
|
|
793
801
|
|
|
794
802
|
// src/graphClient.ts
|
|
795
803
|
function createGraphClient(config = {}) {
|
|
796
804
|
const gateway = createGatewayRequestClient(config);
|
|
797
|
-
|
|
805
|
+
const client = {
|
|
798
806
|
/**
|
|
799
807
|
* List graph nodes matching the provided filters.
|
|
800
808
|
*/
|
|
@@ -807,12 +815,6 @@ function createGraphClient(config = {}) {
|
|
|
807
815
|
(response) => mapGatewayData(response, (data) => mapAliasedList(data, "nodes"))
|
|
808
816
|
);
|
|
809
817
|
},
|
|
810
|
-
/**
|
|
811
|
-
* @deprecated Use listNodes.
|
|
812
|
-
*/
|
|
813
|
-
async queryNodes(query) {
|
|
814
|
-
return this.listNodes(query);
|
|
815
|
-
},
|
|
816
818
|
/**
|
|
817
819
|
* Retrieve a single graph node by nodeId or globalId.
|
|
818
820
|
*/
|
|
@@ -923,12 +925,6 @@ function createGraphClient(config = {}) {
|
|
|
923
925
|
)
|
|
924
926
|
);
|
|
925
927
|
},
|
|
926
|
-
/**
|
|
927
|
-
* @deprecated Use listEdges.
|
|
928
|
-
*/
|
|
929
|
-
async queryEdges(query) {
|
|
930
|
-
return this.listEdges(query);
|
|
931
|
-
},
|
|
932
928
|
/**
|
|
933
929
|
* Create a graph edge.
|
|
934
930
|
*/
|
|
@@ -1016,12 +1012,6 @@ function createGraphClient(config = {}) {
|
|
|
1016
1012
|
body: normalizeTopicQuery(query)
|
|
1017
1013
|
});
|
|
1018
1014
|
},
|
|
1019
|
-
/**
|
|
1020
|
-
* Retrieve a graph neighborhood around a root node.
|
|
1021
|
-
*/
|
|
1022
|
-
async getNeighborhood(query) {
|
|
1023
|
-
return this.neighborhood(query);
|
|
1024
|
-
},
|
|
1025
1015
|
/**
|
|
1026
1016
|
* Retrieve the shortest known path between two graph nodes.
|
|
1027
1017
|
*/
|
|
@@ -1039,6 +1029,11 @@ function createGraphClient(config = {}) {
|
|
|
1039
1029
|
});
|
|
1040
1030
|
}
|
|
1041
1031
|
};
|
|
1032
|
+
return Object.assign(client, {
|
|
1033
|
+
queryNodes: client.listNodes,
|
|
1034
|
+
queryEdges: client.listEdges,
|
|
1035
|
+
getNeighborhood: client.neighborhood
|
|
1036
|
+
});
|
|
1042
1037
|
}
|
|
1043
1038
|
|
|
1044
1039
|
// src/boundaryClientSurface.ts
|
|
@@ -1046,6 +1041,9 @@ function cleanOptionalString(value) {
|
|
|
1046
1041
|
const normalized = value?.trim();
|
|
1047
1042
|
return normalized ? normalized : void 0;
|
|
1048
1043
|
}
|
|
1044
|
+
function isRecord3(value) {
|
|
1045
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1046
|
+
}
|
|
1049
1047
|
function cleanRequiredString(value, label) {
|
|
1050
1048
|
const normalized = cleanOptionalString(value);
|
|
1051
1049
|
if (!normalized) {
|
|
@@ -1067,9 +1065,10 @@ function knownPayload(input, allowed, operation) {
|
|
|
1067
1065
|
return { ...input };
|
|
1068
1066
|
}
|
|
1069
1067
|
function listResultFromEnvelope(data, legacyKey) {
|
|
1070
|
-
const record = data
|
|
1068
|
+
const record = isRecord3(data) ? data : {};
|
|
1069
|
+
const legacyItems = record[legacyKey];
|
|
1071
1070
|
return createListResult(
|
|
1072
|
-
Array.isArray(
|
|
1071
|
+
Array.isArray(legacyItems) ? legacyItems : Array.isArray(data) ? data : [],
|
|
1073
1072
|
legacyKey
|
|
1074
1073
|
);
|
|
1075
1074
|
}
|
|
@@ -1125,6 +1124,13 @@ function createIdentityClient(config = {}) {
|
|
|
1125
1124
|
body: input,
|
|
1126
1125
|
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1127
1126
|
});
|
|
1127
|
+
const updatePrincipal = (input, idempotencyKey) => requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
1128
|
+
const deleteKey = (keyId, input = {}, idempotencyKey) => gateway.request({
|
|
1129
|
+
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
1130
|
+
method: "POST",
|
|
1131
|
+
body: input,
|
|
1132
|
+
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1133
|
+
});
|
|
1128
1134
|
return {
|
|
1129
1135
|
/**
|
|
1130
1136
|
* Resolve the current authenticated identity summary.
|
|
@@ -1173,15 +1179,11 @@ function createIdentityClient(config = {}) {
|
|
|
1173
1179
|
/**
|
|
1174
1180
|
* Update a principal.
|
|
1175
1181
|
*/
|
|
1176
|
-
|
|
1177
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
1178
|
-
},
|
|
1182
|
+
updatePrincipal,
|
|
1179
1183
|
/**
|
|
1180
1184
|
* @deprecated Use createPrincipal or updatePrincipal.
|
|
1181
1185
|
*/
|
|
1182
|
-
|
|
1183
|
-
return requestPrincipalWrite("PATCH", input, idempotencyKey);
|
|
1184
|
-
},
|
|
1186
|
+
upsertPrincipal: updatePrincipal,
|
|
1185
1187
|
/**
|
|
1186
1188
|
* List keys in the current identity scope.
|
|
1187
1189
|
*/
|
|
@@ -1220,20 +1222,11 @@ function createIdentityClient(config = {}) {
|
|
|
1220
1222
|
/**
|
|
1221
1223
|
* Delete an API key by revoking it.
|
|
1222
1224
|
*/
|
|
1223
|
-
|
|
1224
|
-
return gateway.request({
|
|
1225
|
-
path: `/api/platform/v1/identity/keys/${encodeURIComponent(keyId)}/revoke`,
|
|
1226
|
-
method: "POST",
|
|
1227
|
-
body: input,
|
|
1228
|
-
idempotencyKey: idempotencyKey ?? randomIdempotencyKey()
|
|
1229
|
-
});
|
|
1230
|
-
},
|
|
1225
|
+
deleteKey,
|
|
1231
1226
|
/**
|
|
1232
1227
|
* @deprecated Use deleteKey.
|
|
1233
1228
|
*/
|
|
1234
|
-
|
|
1235
|
-
return this.deleteKey(keyId, input, idempotencyKey);
|
|
1236
|
-
},
|
|
1229
|
+
revokeKey: deleteKey,
|
|
1237
1230
|
/**
|
|
1238
1231
|
* Search Clerk users by email or display attributes.
|
|
1239
1232
|
*/
|
|
@@ -1349,14 +1342,11 @@ function createIdentityClient(config = {}) {
|
|
|
1349
1342
|
}
|
|
1350
1343
|
|
|
1351
1344
|
// src/topicsClient.ts
|
|
1352
|
-
function asRecord2(value) {
|
|
1353
|
-
return value && typeof value === "object" ? value : {};
|
|
1354
|
-
}
|
|
1355
1345
|
function cleanString3(value) {
|
|
1356
1346
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
1357
1347
|
}
|
|
1358
1348
|
function normalizeTopicRecord(value) {
|
|
1359
|
-
const record =
|
|
1349
|
+
const record = asRecord(value);
|
|
1360
1350
|
const topicId = cleanString3(record.topicId) ?? cleanString3(record.id) ?? cleanString3(record._id);
|
|
1361
1351
|
return withTopicAlias({
|
|
1362
1352
|
...record,
|
|
@@ -1381,7 +1371,7 @@ function createTopicsClient(config = {}) {
|
|
|
1381
1371
|
})}`
|
|
1382
1372
|
}).then(
|
|
1383
1373
|
(response) => mapGatewayData(response, (data) => {
|
|
1384
|
-
const record =
|
|
1374
|
+
const record = asRecord(data);
|
|
1385
1375
|
const items = Array.isArray(record.topics) ? record.topics.map(normalizeTopicRecord) : [];
|
|
1386
1376
|
return {
|
|
1387
1377
|
...createListResult(items, "topics"),
|
|
@@ -1398,7 +1388,7 @@ function createTopicsClient(config = {}) {
|
|
|
1398
1388
|
}).then(
|
|
1399
1389
|
(response) => mapGatewayData(
|
|
1400
1390
|
response,
|
|
1401
|
-
(data) => normalizeTopicRecord(
|
|
1391
|
+
(data) => normalizeTopicRecord(asRecord(data).topic ?? data)
|
|
1402
1392
|
)
|
|
1403
1393
|
);
|
|
1404
1394
|
},
|
|
@@ -1434,7 +1424,7 @@ function createTopicsClient(config = {}) {
|
|
|
1434
1424
|
)}`
|
|
1435
1425
|
}).then(
|
|
1436
1426
|
(response) => mapGatewayData(response, (data) => {
|
|
1437
|
-
const record =
|
|
1427
|
+
const record = asRecord(data);
|
|
1438
1428
|
return {
|
|
1439
1429
|
tree: Array.isArray(record.tree) ? record.tree.map(normalizeTopicTreeNode) : []
|
|
1440
1430
|
};
|
|
@@ -1853,7 +1843,7 @@ function createEventsFacade(config = {}) {
|
|
|
1853
1843
|
function createGraphFacade(config = {}) {
|
|
1854
1844
|
const graphClient = createGraphClient(config);
|
|
1855
1845
|
const gateway = createGatewayRequestClient(config);
|
|
1856
|
-
|
|
1846
|
+
const graphFacade = {
|
|
1857
1847
|
async neighborhood(input) {
|
|
1858
1848
|
return graphClient.neighborhood({
|
|
1859
1849
|
globalId: input.globalId,
|
|
@@ -1861,18 +1851,6 @@ function createGraphFacade(config = {}) {
|
|
|
1861
1851
|
maxDepth: input.maxDepth
|
|
1862
1852
|
});
|
|
1863
1853
|
},
|
|
1864
|
-
async traverse(input) {
|
|
1865
|
-
return graphClient.traverse(input);
|
|
1866
|
-
},
|
|
1867
|
-
async analyze(input = {}) {
|
|
1868
|
-
return graphClient.analyze(input);
|
|
1869
|
-
},
|
|
1870
|
-
async bias(input = {}) {
|
|
1871
|
-
return graphClient.bias(input);
|
|
1872
|
-
},
|
|
1873
|
-
async gaps(input) {
|
|
1874
|
-
return graphClient.gaps(input);
|
|
1875
|
-
},
|
|
1876
1854
|
async falsify(input, idempotencyKey = randomIdempotencyKey()) {
|
|
1877
1855
|
return gateway.request({
|
|
1878
1856
|
path: "/api/platform/v1/graph/falsify",
|
|
@@ -1882,6 +1860,12 @@ function createGraphFacade(config = {}) {
|
|
|
1882
1860
|
});
|
|
1883
1861
|
}
|
|
1884
1862
|
};
|
|
1863
|
+
return Object.assign(graphFacade, {
|
|
1864
|
+
traverse: graphClient.traverse,
|
|
1865
|
+
analyze: graphClient.analyze,
|
|
1866
|
+
bias: graphClient.bias,
|
|
1867
|
+
gaps: graphClient.gaps
|
|
1868
|
+
});
|
|
1885
1869
|
}
|
|
1886
1870
|
function createIdentityFacade(config = {}) {
|
|
1887
1871
|
const identityClient = createIdentityClient(config);
|
|
@@ -1895,15 +1879,12 @@ function createIdentityFacade(config = {}) {
|
|
|
1895
1879
|
function createOntologiesFacade(config = {}) {
|
|
1896
1880
|
const ontologyClient = createOntologyClient(config);
|
|
1897
1881
|
const gateway = createGatewayRequestClient(config);
|
|
1898
|
-
|
|
1882
|
+
const ontologyFacade = {
|
|
1899
1883
|
async get(id) {
|
|
1900
1884
|
return gateway.request({
|
|
1901
1885
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(id)}`
|
|
1902
1886
|
});
|
|
1903
1887
|
},
|
|
1904
|
-
async list(query = {}) {
|
|
1905
|
-
return ontologyClient.list(query);
|
|
1906
|
-
},
|
|
1907
1888
|
async bind(input, idempotencyKey) {
|
|
1908
1889
|
return gateway.request({
|
|
1909
1890
|
path: `/api/platform/v1/ontologies/${encodeURIComponent(input.ontologyId)}/bind`,
|
|
@@ -1923,6 +1904,9 @@ function createOntologiesFacade(config = {}) {
|
|
|
1923
1904
|
});
|
|
1924
1905
|
}
|
|
1925
1906
|
};
|
|
1907
|
+
return Object.assign(ontologyFacade, {
|
|
1908
|
+
list: ontologyClient.list
|
|
1909
|
+
});
|
|
1926
1910
|
}
|
|
1927
1911
|
function createQuestionsFacade(config = {}) {
|
|
1928
1912
|
const gateway = createGatewayRequestClient(config);
|
|
@@ -2115,15 +2099,9 @@ function createTasksFacade(config = {}) {
|
|
|
2115
2099
|
function createTopicsFacade(config = {}) {
|
|
2116
2100
|
const topicsClient = createTopicsClient(config);
|
|
2117
2101
|
return {
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
async get(id) {
|
|
2122
|
-
return topicsClient.get(id);
|
|
2123
|
-
},
|
|
2124
|
-
async list(query = {}) {
|
|
2125
|
-
return topicsClient.list(query);
|
|
2126
|
-
},
|
|
2102
|
+
create: topicsClient.create,
|
|
2103
|
+
get: topicsClient.get,
|
|
2104
|
+
list: topicsClient.list,
|
|
2127
2105
|
async update(input, idempotencyKey) {
|
|
2128
2106
|
const { id, ...rest } = input;
|
|
2129
2107
|
return topicsClient.update(id, rest, idempotencyKey);
|
|
@@ -2139,12 +2117,8 @@ function createTopicsFacade(config = {}) {
|
|
|
2139
2117
|
maxDepth: input.maxDepth
|
|
2140
2118
|
});
|
|
2141
2119
|
},
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
},
|
|
2145
|
-
async bulkCreate(input, idempotencyKey = randomIdempotencyKey()) {
|
|
2146
|
-
return topicsClient.bulkCreate(input, idempotencyKey);
|
|
2147
|
-
}
|
|
2120
|
+
remove: topicsClient.remove,
|
|
2121
|
+
bulkCreate: topicsClient.bulkCreate
|
|
2148
2122
|
};
|
|
2149
2123
|
}
|
|
2150
2124
|
function createWebhooksFacade(config = {}) {
|