@kortexya/reasoninglayer 1.13.0 → 1.14.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/index.cjs +524 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +605 -145
- package/dist/index.d.ts +605 -145
- package/dist/index.js +524 -148
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var __export = (target, all) => {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/config.ts
|
|
10
|
-
var SDK_VERSION = "1.
|
|
10
|
+
var SDK_VERSION = "1.14.0";
|
|
11
11
|
function resolveConfig(config) {
|
|
12
12
|
if (!config.baseUrl) {
|
|
13
13
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -543,29 +543,61 @@ var HttpClient = class {
|
|
|
543
543
|
};
|
|
544
544
|
};
|
|
545
545
|
|
|
546
|
-
// src/
|
|
546
|
+
// src/user-data-fields.ts
|
|
547
547
|
var USER_DATA_FIELDS = /* @__PURE__ */ new Set([
|
|
548
|
-
|
|
549
|
-
"
|
|
550
|
-
|
|
548
|
+
"annotations",
|
|
549
|
+
"answers",
|
|
550
|
+
"antecedentFeatures",
|
|
551
|
+
"antecedent_features",
|
|
551
552
|
"bindings",
|
|
552
|
-
|
|
553
|
+
"coefficients",
|
|
554
|
+
"conceptValues",
|
|
555
|
+
"concept_values",
|
|
556
|
+
"contextDependentRelations",
|
|
557
|
+
"context_dependent_relations",
|
|
558
|
+
"correctPattern",
|
|
559
|
+
"correct_pattern",
|
|
560
|
+
"currentValues",
|
|
561
|
+
"current_values",
|
|
562
|
+
"dataVersions",
|
|
563
|
+
"data_versions",
|
|
553
564
|
"evidence",
|
|
554
|
-
|
|
555
|
-
"
|
|
556
|
-
"
|
|
557
|
-
|
|
558
|
-
"
|
|
565
|
+
"extra",
|
|
566
|
+
"extracted",
|
|
567
|
+
"features",
|
|
568
|
+
"fieldTypes",
|
|
569
|
+
"field_types",
|
|
570
|
+
"filter",
|
|
571
|
+
"initialBindings",
|
|
572
|
+
"initial_bindings",
|
|
573
|
+
"inputs",
|
|
574
|
+
"interventions",
|
|
559
575
|
"modifiedParams",
|
|
560
|
-
"
|
|
561
|
-
"
|
|
562
|
-
|
|
563
|
-
"
|
|
564
|
-
"
|
|
565
|
-
|
|
566
|
-
"
|
|
567
|
-
"
|
|
576
|
+
"modified_params",
|
|
577
|
+
"observations",
|
|
578
|
+
"optionalInputs",
|
|
579
|
+
"optional_inputs",
|
|
580
|
+
"original",
|
|
581
|
+
"originalValues",
|
|
582
|
+
"original_values",
|
|
583
|
+
"outputs",
|
|
584
|
+
"perStrategyTaxonomies",
|
|
585
|
+
"per_strategy_taxonomies",
|
|
586
|
+
"propsOverride",
|
|
587
|
+
"props_override",
|
|
588
|
+
"roleMinimums",
|
|
589
|
+
"role_minimums",
|
|
590
|
+
"scope",
|
|
591
|
+
"scoresByName",
|
|
592
|
+
"scores_by_name",
|
|
593
|
+
"sortNames",
|
|
594
|
+
"sort_names",
|
|
595
|
+
"topK",
|
|
596
|
+
"top_k",
|
|
597
|
+
"values"
|
|
568
598
|
]);
|
|
599
|
+
|
|
600
|
+
// src/serialization.ts
|
|
569
601
|
function camelToSnake(str) {
|
|
570
602
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
571
603
|
}
|
|
@@ -632,11 +664,11 @@ function buildAuthHeaders(config) {
|
|
|
632
664
|
return headers;
|
|
633
665
|
}
|
|
634
666
|
function transformRequestInit(init) {
|
|
635
|
-
if (!init
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
return { ...init, headers: withoutRawBodyHeader(headers) };
|
|
667
|
+
if (!init) return init;
|
|
668
|
+
if (hasRawBodyHeader(init.headers)) {
|
|
669
|
+
return { ...init, headers: withoutRawBodyHeader(init.headers) };
|
|
639
670
|
}
|
|
671
|
+
if (!init.body || typeof init.body !== "string") return init;
|
|
640
672
|
try {
|
|
641
673
|
const parsed = JSON.parse(init.body);
|
|
642
674
|
const snaked = toSnakeCase(parsed);
|
|
@@ -645,15 +677,14 @@ function transformRequestInit(init) {
|
|
|
645
677
|
return init;
|
|
646
678
|
}
|
|
647
679
|
}
|
|
680
|
+
var RAW_BODY_HEADER_LOWER = RAW_BODY_HEADER.toLowerCase();
|
|
648
681
|
function hasRawBodyHeader(headers) {
|
|
649
682
|
if (!headers) return false;
|
|
650
683
|
if (headers instanceof Headers) return headers.get(RAW_BODY_HEADER) !== null;
|
|
651
684
|
if (Array.isArray(headers)) {
|
|
652
|
-
return headers.some(([name]) => name.toLowerCase() ===
|
|
685
|
+
return headers.some(([name]) => name.toLowerCase() === RAW_BODY_HEADER_LOWER);
|
|
653
686
|
}
|
|
654
|
-
return Object.keys(headers).some(
|
|
655
|
-
(name) => name.toLowerCase() === RAW_BODY_HEADER.toLowerCase()
|
|
656
|
-
);
|
|
687
|
+
return Object.keys(headers).some((name) => name.toLowerCase() === RAW_BODY_HEADER_LOWER);
|
|
657
688
|
}
|
|
658
689
|
function withoutRawBodyHeader(headers) {
|
|
659
690
|
if (headers instanceof Headers) {
|
|
@@ -662,12 +693,12 @@ function withoutRawBodyHeader(headers) {
|
|
|
662
693
|
return copy;
|
|
663
694
|
}
|
|
664
695
|
if (Array.isArray(headers)) {
|
|
665
|
-
return headers.filter(([name]) => name.toLowerCase() !==
|
|
696
|
+
return headers.filter(([name]) => name.toLowerCase() !== RAW_BODY_HEADER_LOWER);
|
|
666
697
|
}
|
|
667
698
|
if (headers) {
|
|
668
699
|
const rest = {};
|
|
669
700
|
for (const [name, value] of Object.entries(headers)) {
|
|
670
|
-
if (name.toLowerCase() !==
|
|
701
|
+
if (name.toLowerCase() !== RAW_BODY_HEADER_LOWER) {
|
|
671
702
|
rest[name] = value;
|
|
672
703
|
}
|
|
673
704
|
}
|
|
@@ -12091,7 +12122,8 @@ function ProofDtoFromApiToFront(dto) {
|
|
|
12091
12122
|
ruleLabel: dto.rule_label,
|
|
12092
12123
|
substitution: HomoiconicSubstitutionDtoFromApiToFront(dto.substitution),
|
|
12093
12124
|
subproofs: dto.subproofs?.map(ProofDtoFromApiToFront),
|
|
12094
|
-
certainty: dto.certainty
|
|
12125
|
+
certainty: dto.certainty,
|
|
12126
|
+
residuated: dto.residuated
|
|
12095
12127
|
};
|
|
12096
12128
|
}
|
|
12097
12129
|
function ProvenanceTagDtoFromApiToFront(dto) {
|
|
@@ -12107,6 +12139,7 @@ function SolutionDtoFromApiToFront(dto) {
|
|
|
12107
12139
|
certainty: dto.certainty,
|
|
12108
12140
|
evidenceMatched: dto.evidence_matched ?? void 0,
|
|
12109
12141
|
evidenceRatio: dto.evidence_ratio ?? void 0,
|
|
12142
|
+
evidenceSupport: dto.evidence_support ?? void 0,
|
|
12110
12143
|
residuatedSorts: dto.residuated_sorts
|
|
12111
12144
|
};
|
|
12112
12145
|
}
|
|
@@ -12485,11 +12518,19 @@ function TaggedForwardChainResponseFromApiToFront(dto) {
|
|
|
12485
12518
|
totalFacts: dto.total_facts
|
|
12486
12519
|
};
|
|
12487
12520
|
}
|
|
12521
|
+
function RuleAggregatorDtoFromFrontToApi(model) {
|
|
12522
|
+
return {
|
|
12523
|
+
group_by: model.groupBy,
|
|
12524
|
+
op: model.op,
|
|
12525
|
+
target: model.target
|
|
12526
|
+
};
|
|
12527
|
+
}
|
|
12488
12528
|
function AddRuleRequestFromFrontToApi(model) {
|
|
12489
12529
|
return {
|
|
12490
12530
|
term: TermInputDtoFromFrontToApi(model.term),
|
|
12491
12531
|
antecedents: model.antecedents?.map(TermInputDtoFromFrontToApi),
|
|
12492
|
-
certainty: model.certainty
|
|
12532
|
+
certainty: model.certainty,
|
|
12533
|
+
aggregator: model.aggregator ? RuleAggregatorDtoFromFrontToApi(model.aggregator) : model.aggregator
|
|
12493
12534
|
};
|
|
12494
12535
|
}
|
|
12495
12536
|
function AddFactRequestFromFrontToApi(model) {
|
|
@@ -12526,7 +12567,8 @@ function ForwardChainRequestFromFrontToApi(model) {
|
|
|
12526
12567
|
persist_derived: model.persistDerived,
|
|
12527
12568
|
enable_provenance_tags: model.enableProvenanceTags,
|
|
12528
12569
|
max_iterations: model.maxIterations,
|
|
12529
|
-
max_facts: model.maxFacts
|
|
12570
|
+
max_facts: model.maxFacts,
|
|
12571
|
+
emit_provenance: model.emitProvenance
|
|
12530
12572
|
};
|
|
12531
12573
|
}
|
|
12532
12574
|
function FuzzyProveRequestFromFrontToApi(model) {
|
|
@@ -12537,7 +12579,8 @@ function FuzzyProveRequestFromFrontToApi(model) {
|
|
|
12537
12579
|
max_solutions: model.maxSolutions,
|
|
12538
12580
|
open_world: model.openWorld,
|
|
12539
12581
|
save_goal: model.saveGoal,
|
|
12540
|
-
tnorm: model.tnorm
|
|
12582
|
+
tnorm: model.tnorm,
|
|
12583
|
+
scope: model.scope
|
|
12541
12584
|
};
|
|
12542
12585
|
}
|
|
12543
12586
|
function BulkFuzzyProveRequestFromFrontToApi(model) {
|
|
@@ -12643,14 +12686,29 @@ var InferenceClient = class {
|
|
|
12643
12686
|
/**
|
|
12644
12687
|
* Add an inference rule.
|
|
12645
12688
|
*
|
|
12646
|
-
* @param request - Rule definition using TermInputDto.
|
|
12689
|
+
* @param request - Rule definition using TermInputDto. Set `aggregator` to declare an
|
|
12690
|
+
* engine-side head aggregator (see {@link RuleAggregatorDto}).
|
|
12647
12691
|
* @returns The created rule wrapped in an AddRuleResponse.
|
|
12692
|
+
* @throws {ApiError} If the rule is rejected or the request fails.
|
|
12693
|
+
*
|
|
12694
|
+
* @remarks
|
|
12695
|
+
* **Serialization format**: untagged `TermInputDto` / `FeatureInputValueDto`.
|
|
12696
|
+
*
|
|
12697
|
+
* @example
|
|
12698
|
+
* ```typescript
|
|
12699
|
+
* await client.inference.addRule({
|
|
12700
|
+
* term: psi('total_spend', { customer_id: Var('C'), amount: Var('A') }),
|
|
12701
|
+
* antecedents: [psi('order', { customer_id: Var('C'), amount: Var('A') })],
|
|
12702
|
+
* aggregator: { groupBy: ['customer_id'], op: 'sum', target: 'amount' },
|
|
12703
|
+
* });
|
|
12704
|
+
* ```
|
|
12648
12705
|
*/
|
|
12649
12706
|
async addRule(request) {
|
|
12650
12707
|
const wireRequest = {
|
|
12651
12708
|
term: convertTermArg(request.term),
|
|
12652
12709
|
antecedents: request.antecedents?.map(convertTermArg),
|
|
12653
|
-
certainty: request.certainty
|
|
12710
|
+
certainty: request.certainty,
|
|
12711
|
+
aggregator: request.aggregator
|
|
12654
12712
|
};
|
|
12655
12713
|
const response = await this.api.addRule(AddRuleRequestFromFrontToApi(wireRequest));
|
|
12656
12714
|
return AddRuleResponseFromApiToFront(response.data);
|
|
@@ -17267,6 +17325,22 @@ function CausalAnalyzeRequestFromFrontToApi(model) {
|
|
|
17267
17325
|
question: CausalAnalyzeQuestionDtoFromFrontToApi(model.question)
|
|
17268
17326
|
};
|
|
17269
17327
|
}
|
|
17328
|
+
function DiDValidationRequestFromFrontToApi(model) {
|
|
17329
|
+
return {
|
|
17330
|
+
covariates: model.covariates,
|
|
17331
|
+
outcome_post: model.outcomePost,
|
|
17332
|
+
outcome_pre: model.outcomePre,
|
|
17333
|
+
treatment: model.treatment
|
|
17334
|
+
};
|
|
17335
|
+
}
|
|
17336
|
+
function DiDValidationResponseFromApiToFront(dto) {
|
|
17337
|
+
return {
|
|
17338
|
+
badControls: dto.bad_controls,
|
|
17339
|
+
explanation: dto.explanation,
|
|
17340
|
+
framework: dto.framework,
|
|
17341
|
+
isValid: dto.is_valid
|
|
17342
|
+
};
|
|
17343
|
+
}
|
|
17270
17344
|
|
|
17271
17345
|
// src/resources/causal.ts
|
|
17272
17346
|
var CausalClient = class {
|
|
@@ -18057,6 +18131,53 @@ var CausalClient = class {
|
|
|
18057
18131
|
);
|
|
18058
18132
|
return RefuteEstimateResponseFromApiToFront(response.data);
|
|
18059
18133
|
}
|
|
18134
|
+
// ===========================================================================
|
|
18135
|
+
// Design validation
|
|
18136
|
+
// ===========================================================================
|
|
18137
|
+
/**
|
|
18138
|
+
* Validate a Difference-in-Differences (DiD) design.
|
|
18139
|
+
*
|
|
18140
|
+
* @param request - The treatment variable, the pre- and post-treatment outcome
|
|
18141
|
+
* variables, and an optional conditioning set.
|
|
18142
|
+
* @returns Whether the design is theoretically sound, an explanation, the bad
|
|
18143
|
+
* controls found in the conditioning set, and the framework used.
|
|
18144
|
+
* @throws {BadRequestError} If the request is malformed.
|
|
18145
|
+
* @throws {ApiError} If the request otherwise fails.
|
|
18146
|
+
*
|
|
18147
|
+
* @remarks
|
|
18148
|
+
* Checks the design against the causal structure the backend builds from the
|
|
18149
|
+
* tenant's homoiconic rules, using the Transformed SWIG (Delta-SWIG) framework
|
|
18150
|
+
* of Knaus & Pfleiderer (2026). This is a design check over the *graph*: no
|
|
18151
|
+
* sample data is submitted and nothing is estimated — validate the design here,
|
|
18152
|
+
* then estimate the effect with {@link CausalClient.ateEstimate}.
|
|
18153
|
+
*
|
|
18154
|
+
* A design can be invalid even with an empty conditioning set (parallel trends
|
|
18155
|
+
* unsupported by the structure); `badControls` names the covariates that induce
|
|
18156
|
+
* bias if conditioned on, so an invalid design is often repaired by dropping
|
|
18157
|
+
* them and re-validating.
|
|
18158
|
+
*
|
|
18159
|
+
* Plain scalar JSON — no value serialization (`ValueDto` / `FeatureValueDto`)
|
|
18160
|
+
* is involved.
|
|
18161
|
+
*
|
|
18162
|
+
* @example
|
|
18163
|
+
* ```typescript
|
|
18164
|
+
* const did = await client.causal.validateDid({
|
|
18165
|
+
* treatment: 'minimum_wage_hike',
|
|
18166
|
+
* outcomePre: 'employment_2025',
|
|
18167
|
+
* outcomePost: 'employment_2026',
|
|
18168
|
+
* covariates: ['county_gdp'],
|
|
18169
|
+
* });
|
|
18170
|
+
* console.log(did.isValid); // false
|
|
18171
|
+
* console.log(did.badControls); // ['county_gdp']
|
|
18172
|
+
* console.log(did.framework); // 'Delta-SWIG (Knaus & Pfleiderer, 2026)'
|
|
18173
|
+
* ```
|
|
18174
|
+
*/
|
|
18175
|
+
async validateDid(request) {
|
|
18176
|
+
const response = await this.api.validateDid(
|
|
18177
|
+
DiDValidationRequestFromFrontToApi(request)
|
|
18178
|
+
);
|
|
18179
|
+
return DiDValidationResponseFromApiToFront(response.data);
|
|
18180
|
+
}
|
|
18060
18181
|
};
|
|
18061
18182
|
|
|
18062
18183
|
// src/normalizers/ingestion.ts
|
|
@@ -20965,7 +21086,8 @@ function RegisterSourceRequestFromFrontToApi(model) {
|
|
|
20965
21086
|
source_id: model.sourceId,
|
|
20966
21087
|
source_name: model.sourceName,
|
|
20967
21088
|
source_type: model.sourceType,
|
|
20968
|
-
config: model.config
|
|
21089
|
+
config: model.config,
|
|
21090
|
+
mode: model.mode
|
|
20969
21091
|
};
|
|
20970
21092
|
}
|
|
20971
21093
|
function RegisterSourceResponseFromApiToFront(dto) {
|
|
@@ -20973,12 +21095,14 @@ function RegisterSourceResponseFromApiToFront(dto) {
|
|
|
20973
21095
|
success: dto.success,
|
|
20974
21096
|
sourceId: dto.source_id,
|
|
20975
21097
|
sourceType: dto.source_type,
|
|
21098
|
+
mode: dto.mode,
|
|
20976
21099
|
message: dto.message
|
|
20977
21100
|
};
|
|
20978
21101
|
}
|
|
20979
21102
|
function SourceSummaryDtoFromApiToFront(dto) {
|
|
20980
21103
|
return {
|
|
20981
21104
|
available: dto.available,
|
|
21105
|
+
mode: dto.mode,
|
|
20982
21106
|
sourceId: dto.source_id,
|
|
20983
21107
|
sourceType: dto.source_type
|
|
20984
21108
|
};
|
|
@@ -20993,7 +21117,8 @@ function SourceDetailResponseFromApiToFront(dto) {
|
|
|
20993
21117
|
return {
|
|
20994
21118
|
sourceId: dto.source_id,
|
|
20995
21119
|
sourceType: dto.source_type,
|
|
20996
|
-
available: dto.available
|
|
21120
|
+
available: dto.available,
|
|
21121
|
+
mode: dto.mode
|
|
20997
21122
|
};
|
|
20998
21123
|
}
|
|
20999
21124
|
function DiscoverSchemaRequestFromFrontToApi(model) {
|
|
@@ -21073,6 +21198,7 @@ function IngestFromSourceRequestFromFrontToApi(model) {
|
|
|
21073
21198
|
function StructuredIngestionStatsDtoFromApiToFront(dto) {
|
|
21074
21199
|
return {
|
|
21075
21200
|
columnsDiscovered: dto.columns_discovered,
|
|
21201
|
+
columnsDropped: dto.columns_dropped,
|
|
21076
21202
|
documentsRendered: dto.documents_rendered,
|
|
21077
21203
|
elapsedMs: dto.elapsed_ms,
|
|
21078
21204
|
entitiesCreated: dto.entities_created,
|
|
@@ -21082,7 +21208,8 @@ function StructuredIngestionStatsDtoFromApiToFront(dto) {
|
|
|
21082
21208
|
relationsDiscovered: dto.relations_discovered,
|
|
21083
21209
|
sortsCreated: dto.sorts_created,
|
|
21084
21210
|
tablesDiscovered: dto.tables_discovered,
|
|
21085
|
-
termsCreated: dto.terms_created
|
|
21211
|
+
termsCreated: dto.terms_created,
|
|
21212
|
+
termsProjected: dto.terms_projected
|
|
21086
21213
|
};
|
|
21087
21214
|
}
|
|
21088
21215
|
function IngestFromSourceResponseFromApiToFront(dto) {
|
|
@@ -21106,8 +21233,31 @@ var SourcesClient = class {
|
|
|
21106
21233
|
/**
|
|
21107
21234
|
* Register a new data source.
|
|
21108
21235
|
*
|
|
21109
|
-
* @param request - Source registration request.
|
|
21110
|
-
*
|
|
21236
|
+
* @param request - Source registration request. Set `mode` to declare the write-path
|
|
21237
|
+
* intent (`'transpile'` for live SQL views, `'ingest'` to materialize rows as
|
|
21238
|
+
* Ψ-term facts); omit it to take the capability-grounded default (`transpile` for
|
|
21239
|
+
* postgres, `ingest` otherwise).
|
|
21240
|
+
* @returns Registration result. `mode` always carries the **resolved** write-path
|
|
21241
|
+
* mode, including when the default applied.
|
|
21242
|
+
* @throws {ApiError} If registration fails, or with **422** if `mode` is not one of
|
|
21243
|
+
* `transpile` / `ingest`.
|
|
21244
|
+
*
|
|
21245
|
+
* @remarks
|
|
21246
|
+
* Registering with `mode: 'transpile'` makes {@link SourcesClient.ingest} refuse this
|
|
21247
|
+
* source with a **409** — materializing a transpiled source would create a second,
|
|
21248
|
+
* divergent namespace over the same rows.
|
|
21249
|
+
*
|
|
21250
|
+
* @example
|
|
21251
|
+
* ```typescript
|
|
21252
|
+
* const result = await client.sources.register({
|
|
21253
|
+
* sourceId: 'crm_postgres',
|
|
21254
|
+
* sourceName: 'CRM PostgreSQL',
|
|
21255
|
+
* sourceType: 'postgres',
|
|
21256
|
+
* config: { connection_string: 'postgres://user:pass@host/db' },
|
|
21257
|
+
* mode: 'ingest',
|
|
21258
|
+
* });
|
|
21259
|
+
* console.log(result.mode); // 'ingest'
|
|
21260
|
+
* ```
|
|
21111
21261
|
*/
|
|
21112
21262
|
async register(request) {
|
|
21113
21263
|
const response = await this.api.registerSource(RegisterSourceRequestFromFrontToApi(request));
|
|
@@ -22283,13 +22433,35 @@ function mapEntity(e) {
|
|
|
22283
22433
|
sourceText: e.source_text ?? null
|
|
22284
22434
|
};
|
|
22285
22435
|
}
|
|
22436
|
+
function toRuleSeverity(severity) {
|
|
22437
|
+
switch (severity) {
|
|
22438
|
+
case "critical":
|
|
22439
|
+
case "major":
|
|
22440
|
+
case "minor":
|
|
22441
|
+
case "informational":
|
|
22442
|
+
return severity;
|
|
22443
|
+
default:
|
|
22444
|
+
return "informational";
|
|
22445
|
+
}
|
|
22446
|
+
}
|
|
22447
|
+
function toRuleStatus(status) {
|
|
22448
|
+
switch (status) {
|
|
22449
|
+
case "pass":
|
|
22450
|
+
case "fail":
|
|
22451
|
+
case "inconclusive":
|
|
22452
|
+
case "not_applicable":
|
|
22453
|
+
return status;
|
|
22454
|
+
default:
|
|
22455
|
+
return "inconclusive";
|
|
22456
|
+
}
|
|
22457
|
+
}
|
|
22286
22458
|
function mapRuleResult(r) {
|
|
22287
22459
|
return {
|
|
22288
22460
|
ruleId: r.rule_id ?? "",
|
|
22289
22461
|
ruleDescription: r.rule_description ?? "",
|
|
22290
22462
|
ruleSort: r.rule_sort ?? "",
|
|
22291
|
-
severity: r.severity
|
|
22292
|
-
status: r.status
|
|
22463
|
+
severity: toRuleSeverity(r.severity),
|
|
22464
|
+
status: toRuleStatus(r.status),
|
|
22293
22465
|
confidence: r.confidence ?? 0,
|
|
22294
22466
|
evidence: r.evidence ?? [],
|
|
22295
22467
|
proofTrace: r.proof_trace ? r.proof_trace.map(mapProofStep) : null,
|
|
@@ -26539,11 +26711,112 @@ var FlowNetworksClient = class {
|
|
|
26539
26711
|
};
|
|
26540
26712
|
|
|
26541
26713
|
// src/normalizers/osfql.ts
|
|
26714
|
+
function isRecord(value) {
|
|
26715
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26716
|
+
}
|
|
26717
|
+
function OsfqlValueFromApiToFront(value) {
|
|
26718
|
+
if (!isRecord(value)) {
|
|
26719
|
+
return void 0;
|
|
26720
|
+
}
|
|
26721
|
+
const payload = value["value"];
|
|
26722
|
+
switch (value["type"]) {
|
|
26723
|
+
case "null":
|
|
26724
|
+
return { type: "null" };
|
|
26725
|
+
case "integer":
|
|
26726
|
+
return typeof payload === "number" ? { type: "integer", value: payload } : void 0;
|
|
26727
|
+
case "float":
|
|
26728
|
+
return typeof payload === "number" ? { type: "float", value: payload } : void 0;
|
|
26729
|
+
case "string":
|
|
26730
|
+
return typeof payload === "string" ? { type: "string", value: payload } : void 0;
|
|
26731
|
+
case "boolean":
|
|
26732
|
+
return typeof payload === "boolean" ? { type: "boolean", value: payload } : void 0;
|
|
26733
|
+
case "term_ref":
|
|
26734
|
+
return typeof payload === "string" ? { type: "term_ref", value: payload } : void 0;
|
|
26735
|
+
case "list": {
|
|
26736
|
+
if (!Array.isArray(payload)) {
|
|
26737
|
+
return void 0;
|
|
26738
|
+
}
|
|
26739
|
+
const items = payload;
|
|
26740
|
+
const parsed = [];
|
|
26741
|
+
for (const item of items) {
|
|
26742
|
+
const element = OsfqlValueFromApiToFront(item);
|
|
26743
|
+
if (element === void 0) {
|
|
26744
|
+
return void 0;
|
|
26745
|
+
}
|
|
26746
|
+
parsed.push(element);
|
|
26747
|
+
}
|
|
26748
|
+
return { type: "list", value: parsed };
|
|
26749
|
+
}
|
|
26750
|
+
case "term": {
|
|
26751
|
+
const term = OsfqlTermValueFromApiToFront(payload);
|
|
26752
|
+
return term === void 0 ? void 0 : { type: "term", value: term };
|
|
26753
|
+
}
|
|
26754
|
+
default:
|
|
26755
|
+
return void 0;
|
|
26756
|
+
}
|
|
26757
|
+
}
|
|
26758
|
+
function OsfqlTermValueFromApiToFront(value) {
|
|
26759
|
+
if (!isRecord(value)) {
|
|
26760
|
+
return void 0;
|
|
26761
|
+
}
|
|
26762
|
+
const sort = value["sort"];
|
|
26763
|
+
if (typeof sort !== "string") {
|
|
26764
|
+
return void 0;
|
|
26765
|
+
}
|
|
26766
|
+
const features = OsfqlBindingFromApiToFront(value["features"]);
|
|
26767
|
+
return features === void 0 ? void 0 : { sort, features };
|
|
26768
|
+
}
|
|
26769
|
+
function OsfqlBindingFromApiToFront(value) {
|
|
26770
|
+
if (!isRecord(value)) {
|
|
26771
|
+
return void 0;
|
|
26772
|
+
}
|
|
26773
|
+
const out = {};
|
|
26774
|
+
for (const [name, raw] of Object.entries(value)) {
|
|
26775
|
+
const parsed = OsfqlValueFromApiToFront(raw);
|
|
26776
|
+
if (parsed === void 0) {
|
|
26777
|
+
return void 0;
|
|
26778
|
+
}
|
|
26779
|
+
out[name] = parsed;
|
|
26780
|
+
}
|
|
26781
|
+
return out;
|
|
26782
|
+
}
|
|
26783
|
+
function OsfqlBindingsFromApiToFront(value) {
|
|
26784
|
+
if (!Array.isArray(value)) {
|
|
26785
|
+
return void 0;
|
|
26786
|
+
}
|
|
26787
|
+
const rows = value;
|
|
26788
|
+
const out = [];
|
|
26789
|
+
for (const row of rows) {
|
|
26790
|
+
const parsed = OsfqlBindingFromApiToFront(row);
|
|
26791
|
+
if (parsed === void 0) {
|
|
26792
|
+
return void 0;
|
|
26793
|
+
}
|
|
26794
|
+
out.push(parsed);
|
|
26795
|
+
}
|
|
26796
|
+
return out;
|
|
26797
|
+
}
|
|
26798
|
+
function OsfqlRequestFromFrontToApi(model) {
|
|
26799
|
+
return {
|
|
26800
|
+
query: model.query,
|
|
26801
|
+
reactive: model.reactive
|
|
26802
|
+
};
|
|
26803
|
+
}
|
|
26542
26804
|
function OsfqlResponseFromApiToFront(dto) {
|
|
26805
|
+
const bindings = OsfqlBindingsFromApiToFront(dto.bindings);
|
|
26806
|
+
if (bindings === void 0) {
|
|
26807
|
+
return void 0;
|
|
26808
|
+
}
|
|
26809
|
+
let fetched;
|
|
26810
|
+
if (dto.fetched !== void 0 && dto.fetched !== null) {
|
|
26811
|
+
fetched = OsfqlBindingsFromApiToFront(dto.fetched);
|
|
26812
|
+
if (fetched === void 0) {
|
|
26813
|
+
return void 0;
|
|
26814
|
+
}
|
|
26815
|
+
}
|
|
26543
26816
|
return {
|
|
26544
26817
|
success: dto.success,
|
|
26545
|
-
bindings
|
|
26546
|
-
fetched
|
|
26818
|
+
bindings,
|
|
26819
|
+
fetched,
|
|
26547
26820
|
producedTermIds: dto.produced_term_ids,
|
|
26548
26821
|
definedSortIds: dto.defined_sort_ids,
|
|
26549
26822
|
diagnostics: dto.diagnostics,
|
|
@@ -26589,15 +26862,28 @@ var OsfqlClient = class {
|
|
|
26589
26862
|
* Execute an OSFQL program.
|
|
26590
26863
|
*
|
|
26591
26864
|
* @param query - The OSFQL program text (one or more statements separated by `;`).
|
|
26865
|
+
* @param options - Optional execution options. Set `reactive` to fire suspended
|
|
26866
|
+
* `AWAIT` demons whose triggers the program has just satisfied.
|
|
26592
26867
|
* @returns The execution result including variable bindings, produced term IDs,
|
|
26593
26868
|
* defined sort IDs, diagnostics, and statement count.
|
|
26594
26869
|
* @throws {ApiError} If the request fails.
|
|
26870
|
+
* @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
|
|
26871
|
+
* published {@link OsfqlValue} contract.
|
|
26595
26872
|
*
|
|
26596
26873
|
* @remarks
|
|
26597
26874
|
* The query is parsed, compiled, and executed against the caller's tenant-isolated
|
|
26598
26875
|
* knowledge base. Results include variable bindings from MATCH queries and IDs of
|
|
26599
26876
|
* any terms or sorts created by INSERT, DERIVE, or DEFINE statements.
|
|
26600
26877
|
*
|
|
26878
|
+
* Bindings use the **tagged** {@link OsfqlValue} format with lowercase `type`
|
|
26879
|
+
* discriminators — not the PascalCase `ValueDto` term-CRUD format.
|
|
26880
|
+
*
|
|
26881
|
+
* `reactive` opts into **reactive (streaming) mode**: once the program has run,
|
|
26882
|
+
* any suspended `AWAIT` demon whose trigger is now satisfied fires
|
|
26883
|
+
* automatically, with no explicit `RELEASE RESIDUATIONS` statement. It defaults
|
|
26884
|
+
* to `false` — demons stay suspended until an explicit RELEASE — so omitting it
|
|
26885
|
+
* leaves the request byte-identical to before.
|
|
26886
|
+
*
|
|
26601
26887
|
* @example
|
|
26602
26888
|
* ```typescript
|
|
26603
26889
|
* // Insert a record and query it back
|
|
@@ -26608,11 +26894,27 @@ var OsfqlClient = class {
|
|
|
26608
26894
|
* console.log(result.bindings); // [{ N: { type: "string", value: "Alice" } }]
|
|
26609
26895
|
* console.log(result.producedTermIds); // ["<uuid>"]
|
|
26610
26896
|
* console.log(result.statementCount); // 2
|
|
26897
|
+
*
|
|
26898
|
+
* // Let an AWAIT demon fire as soon as its trigger is satisfied
|
|
26899
|
+
* await client.osfql.execute('AWAIT person(name: "Bob");');
|
|
26900
|
+
* const reactive = await client.osfql.execute(
|
|
26901
|
+
* 'INSERT person(name: "Bob", age: 41);',
|
|
26902
|
+
* { reactive: true },
|
|
26903
|
+
* );
|
|
26904
|
+
* console.log(reactive.producedTermIds); // includes the demon's own output
|
|
26611
26905
|
* ```
|
|
26612
26906
|
*/
|
|
26613
|
-
async execute(query) {
|
|
26614
|
-
const response = await this.api.executeOsfql(
|
|
26615
|
-
|
|
26907
|
+
async execute(query, options) {
|
|
26908
|
+
const response = await this.api.executeOsfql(
|
|
26909
|
+
OsfqlRequestFromFrontToApi({ query, reactive: options?.reactive })
|
|
26910
|
+
);
|
|
26911
|
+
const parsed = OsfqlResponseFromApiToFront(response.data);
|
|
26912
|
+
if (parsed === void 0) {
|
|
26913
|
+
throw new ReasoningLayerError(
|
|
26914
|
+
"osfql/execute returned bindings that do not match the published OsfqlValue contract (expected tagged values with a lowercase `type` discriminator)"
|
|
26915
|
+
);
|
|
26916
|
+
}
|
|
26917
|
+
return parsed;
|
|
26616
26918
|
}
|
|
26617
26919
|
/**
|
|
26618
26920
|
* Diagnose an OSFQL program for contradictions and inconsistencies.
|
|
@@ -26699,7 +27001,9 @@ function ConversationMessageRequestFromFrontToApi(model) {
|
|
|
26699
27001
|
conversation_id: model.conversationId,
|
|
26700
27002
|
session_id: model.sessionId,
|
|
26701
27003
|
current_sort_context: model.currentSortContext,
|
|
26702
|
-
generate_certificate: model.generateCertificate
|
|
27004
|
+
generate_certificate: model.generateCertificate,
|
|
27005
|
+
constrained_decode: model.constrainedDecode,
|
|
27006
|
+
model: model.model
|
|
26703
27007
|
};
|
|
26704
27008
|
}
|
|
26705
27009
|
function DerivationSummaryDtoFromApiToFront(dto) {
|
|
@@ -26807,7 +27111,12 @@ function ConversationMessageResponseFromApiToFront(dto) {
|
|
|
26807
27111
|
cognitiveStrategy: dto.cognitive_strategy ? CognitiveStrategyDtoFromApiToFront(dto.cognitive_strategy) : void 0,
|
|
26808
27112
|
reasoningTrace: dto.reasoning_trace ? ReasoningTraceDtoFromApiToFront(dto.reasoning_trace) : void 0,
|
|
26809
27113
|
validityCertificateHash: dto.validity_certificate_hash ?? void 0,
|
|
26810
|
-
validityCertificateId: dto.validity_certificate_id ?? void 0
|
|
27114
|
+
validityCertificateId: dto.validity_certificate_id ?? void 0,
|
|
27115
|
+
validityCertificateRuleProgramHash: dto.validity_certificate_rule_program_hash ?? void 0,
|
|
27116
|
+
validityCertificateRuleRevision: dto.validity_certificate_rule_revision ?? void 0,
|
|
27117
|
+
modelId: dto.model_id ?? void 0,
|
|
27118
|
+
prefillMs: dto.prefill_ms ?? void 0,
|
|
27119
|
+
tokensPerSec: dto.tokens_per_sec ?? void 0
|
|
26811
27120
|
};
|
|
26812
27121
|
}
|
|
26813
27122
|
function TurnDtoFromApiToFront(dto) {
|
|
@@ -30653,12 +30962,16 @@ function PropertyGraphQueryRequestFromFrontToApi(model) {
|
|
|
30653
30962
|
};
|
|
30654
30963
|
}
|
|
30655
30964
|
function PropertyGraphExecuteResponseFromApiToFront(dto) {
|
|
30965
|
+
const bindings = OsfqlBindingsFromApiToFront(dto.bindings);
|
|
30966
|
+
if (bindings === void 0) {
|
|
30967
|
+
return void 0;
|
|
30968
|
+
}
|
|
30656
30969
|
return {
|
|
30657
30970
|
success: dto.success,
|
|
30658
30971
|
language: dto.language,
|
|
30659
30972
|
operation: dto.operation,
|
|
30660
30973
|
osfql: dto.osfql,
|
|
30661
|
-
bindings
|
|
30974
|
+
bindings,
|
|
30662
30975
|
producedTermIds: dto.produced_term_ids,
|
|
30663
30976
|
definedSortIds: dto.defined_sort_ids,
|
|
30664
30977
|
diagnostics: dto.diagnostics,
|
|
@@ -30676,13 +30989,27 @@ function PropertyGraphTranslateResponseFromApiToFront(dto) {
|
|
|
30676
30989
|
}
|
|
30677
30990
|
|
|
30678
30991
|
// src/resources/property-graph.ts
|
|
30679
|
-
var PropertyGraphClient = class {
|
|
30992
|
+
var PropertyGraphClient = class _PropertyGraphClient {
|
|
30680
30993
|
/** @internal */
|
|
30681
30994
|
api;
|
|
30682
30995
|
/** @internal */
|
|
30683
30996
|
constructor(api) {
|
|
30684
30997
|
this.api = api;
|
|
30685
30998
|
}
|
|
30999
|
+
/**
|
|
31000
|
+
* Parse an execution response, failing loudly on a contract violation.
|
|
31001
|
+
*
|
|
31002
|
+
* @internal
|
|
31003
|
+
*/
|
|
31004
|
+
static parseExecuteResponse(dto) {
|
|
31005
|
+
const parsed = PropertyGraphExecuteResponseFromApiToFront(dto);
|
|
31006
|
+
if (parsed === void 0) {
|
|
31007
|
+
throw new ReasoningLayerError(
|
|
31008
|
+
"the property-graph endpoint returned bindings that do not match the published PropertyGraphValue contract (expected tagged values with a lowercase `type` discriminator)"
|
|
31009
|
+
);
|
|
31010
|
+
}
|
|
31011
|
+
return parsed;
|
|
31012
|
+
}
|
|
30686
31013
|
/**
|
|
30687
31014
|
* Execute a Cypher query.
|
|
30688
31015
|
*
|
|
@@ -30690,6 +31017,8 @@ var PropertyGraphClient = class {
|
|
|
30690
31017
|
* @returns Execution result: bindings, the OSFQL program that ran, produced term IDs,
|
|
30691
31018
|
* defined sort IDs, diagnostics, compatibility notes, and the statement count.
|
|
30692
31019
|
* @throws {ApiError} If the query cannot be parsed, cannot be lowered to OSFQL, or fails to execute.
|
|
31020
|
+
* @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
|
|
31021
|
+
* published {@link PropertyGraphValue} contract.
|
|
30693
31022
|
*
|
|
30694
31023
|
* @remarks
|
|
30695
31024
|
* The query is parsed as Cypher, lowered to OSFQL, and executed against the
|
|
@@ -30709,7 +31038,7 @@ var PropertyGraphClient = class {
|
|
|
30709
31038
|
const response = await this.api.executeCypherPost(
|
|
30710
31039
|
PropertyGraphQueryRequestFromFrontToApi({ query })
|
|
30711
31040
|
);
|
|
30712
|
-
return
|
|
31041
|
+
return _PropertyGraphClient.parseExecuteResponse(response.data);
|
|
30713
31042
|
}
|
|
30714
31043
|
/**
|
|
30715
31044
|
* Execute a GQL (ISO/IEC 39075) query.
|
|
@@ -30718,6 +31047,8 @@ var PropertyGraphClient = class {
|
|
|
30718
31047
|
* @returns Execution result: bindings, the OSFQL program that ran, produced term IDs,
|
|
30719
31048
|
* defined sort IDs, diagnostics, compatibility notes, and the statement count.
|
|
30720
31049
|
* @throws {ApiError} If the query cannot be parsed, cannot be lowered to OSFQL, or fails to execute.
|
|
31050
|
+
* @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
|
|
31051
|
+
* published {@link PropertyGraphValue} contract.
|
|
30721
31052
|
*
|
|
30722
31053
|
* @remarks
|
|
30723
31054
|
* The query is parsed as GQL, lowered to OSFQL, and executed against the
|
|
@@ -30737,7 +31068,7 @@ var PropertyGraphClient = class {
|
|
|
30737
31068
|
const response = await this.api.executeGqlPost(
|
|
30738
31069
|
PropertyGraphQueryRequestFromFrontToApi({ query })
|
|
30739
31070
|
);
|
|
30740
|
-
return
|
|
31071
|
+
return _PropertyGraphClient.parseExecuteResponse(response.data);
|
|
30741
31072
|
}
|
|
30742
31073
|
/**
|
|
30743
31074
|
* Execute a Gremlin traversal.
|
|
@@ -30746,6 +31077,8 @@ var PropertyGraphClient = class {
|
|
|
30746
31077
|
* @returns Execution result: bindings, the OSFQL program that ran, produced term IDs,
|
|
30747
31078
|
* defined sort IDs, diagnostics, compatibility notes, and the statement count.
|
|
30748
31079
|
* @throws {ApiError} If the traversal cannot be parsed, cannot be lowered to OSFQL, or fails to execute.
|
|
31080
|
+
* @throws {ReasoningLayerError} If the server returns bindings that do not satisfy the
|
|
31081
|
+
* published {@link PropertyGraphValue} contract.
|
|
30749
31082
|
*
|
|
30750
31083
|
* @remarks
|
|
30751
31084
|
* The traversal is parsed as Gremlin, lowered to OSFQL, and executed against the
|
|
@@ -30764,7 +31097,7 @@ var PropertyGraphClient = class {
|
|
|
30764
31097
|
const response = await this.api.executeGremlinPost(
|
|
30765
31098
|
PropertyGraphQueryRequestFromFrontToApi({ query })
|
|
30766
31099
|
);
|
|
30767
|
-
return
|
|
31100
|
+
return _PropertyGraphClient.parseExecuteResponse(response.data);
|
|
30768
31101
|
}
|
|
30769
31102
|
/**
|
|
30770
31103
|
* Translate a Cypher query to OSFQL without executing it.
|
|
@@ -30850,14 +31183,14 @@ var PropertyGraphClient = class {
|
|
|
30850
31183
|
};
|
|
30851
31184
|
|
|
30852
31185
|
// src/normalizers/sparql.ts
|
|
30853
|
-
function
|
|
31186
|
+
function isRecord2(value) {
|
|
30854
31187
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30855
31188
|
}
|
|
30856
31189
|
function isString(value) {
|
|
30857
31190
|
return typeof value === "string";
|
|
30858
31191
|
}
|
|
30859
31192
|
function headVars(head) {
|
|
30860
|
-
if (!
|
|
31193
|
+
if (!isRecord2(head)) {
|
|
30861
31194
|
throw new Error('Malformed SPARQL results: "head" is not an object');
|
|
30862
31195
|
}
|
|
30863
31196
|
const vars = head["vars"];
|
|
@@ -30870,7 +31203,7 @@ function headVars(head) {
|
|
|
30870
31203
|
return vars;
|
|
30871
31204
|
}
|
|
30872
31205
|
function SparqlRdfTermFromApiToFront(raw) {
|
|
30873
|
-
if (!
|
|
31206
|
+
if (!isRecord2(raw)) {
|
|
30874
31207
|
throw new Error("Malformed SPARQL results: a solution binding is not an object");
|
|
30875
31208
|
}
|
|
30876
31209
|
const termType = raw["type"];
|
|
@@ -30895,7 +31228,7 @@ function SparqlRdfTermFromApiToFront(raw) {
|
|
|
30895
31228
|
};
|
|
30896
31229
|
}
|
|
30897
31230
|
if (termType === "triple") {
|
|
30898
|
-
if (!
|
|
31231
|
+
if (!isRecord2(value)) {
|
|
30899
31232
|
throw new Error('Malformed SPARQL results: "triple" binding has a non-object value');
|
|
30900
31233
|
}
|
|
30901
31234
|
return {
|
|
@@ -30912,7 +31245,7 @@ function SparqlRdfTermFromApiToFront(raw) {
|
|
|
30912
31245
|
);
|
|
30913
31246
|
}
|
|
30914
31247
|
function SparqlBindingSetFromApiToFront(raw) {
|
|
30915
|
-
if (!
|
|
31248
|
+
if (!isRecord2(raw)) {
|
|
30916
31249
|
throw new Error("Malformed SPARQL results: a solution is not an object");
|
|
30917
31250
|
}
|
|
30918
31251
|
const bindings = {};
|
|
@@ -30922,7 +31255,7 @@ function SparqlBindingSetFromApiToFront(raw) {
|
|
|
30922
31255
|
return bindings;
|
|
30923
31256
|
}
|
|
30924
31257
|
function bindingsFromResultSet(results) {
|
|
30925
|
-
if (!
|
|
31258
|
+
if (!isRecord2(results)) {
|
|
30926
31259
|
throw new Error('Malformed SPARQL results: "results" is not an object');
|
|
30927
31260
|
}
|
|
30928
31261
|
const bindings = results["bindings"];
|
|
@@ -30954,7 +31287,7 @@ function SparqlEntailmentRegimeFromApiToFront(entailment) {
|
|
|
30954
31287
|
}
|
|
30955
31288
|
}
|
|
30956
31289
|
function SparqlQueryResultsFromApiToFront(raw) {
|
|
30957
|
-
if (!
|
|
31290
|
+
if (!isRecord2(raw)) {
|
|
30958
31291
|
throw new Error(
|
|
30959
31292
|
"Malformed SPARQL results: the response body is not a SPARQL 1.1 Query Results JSON document (a CONSTRUCT or DESCRIBE query answers with an RDF graph document instead)"
|
|
30960
31293
|
);
|
|
@@ -30981,7 +31314,7 @@ function GraphSparqlQueryRequestFromFrontToApi(model) {
|
|
|
30981
31314
|
};
|
|
30982
31315
|
}
|
|
30983
31316
|
function GraphSparqlResultsFromApiToFront(raw) {
|
|
30984
|
-
if (!
|
|
31317
|
+
if (!isRecord2(raw)) {
|
|
30985
31318
|
throw new Error(
|
|
30986
31319
|
"Malformed SPARQL results: the co-located store response is not a SPARQL 1.1 Query Results JSON document"
|
|
30987
31320
|
);
|
|
@@ -31269,6 +31602,38 @@ var SparqlClient = class {
|
|
|
31269
31602
|
};
|
|
31270
31603
|
|
|
31271
31604
|
// src/normalizers/osf-diff.ts
|
|
31605
|
+
function TermSetSelectorFromFrontToApi(selector) {
|
|
31606
|
+
switch (selector.type) {
|
|
31607
|
+
case "document":
|
|
31608
|
+
return { type: "document", document_id: selector.documentId };
|
|
31609
|
+
case "document_version":
|
|
31610
|
+
return { type: "document_version", document_id: selector.documentId };
|
|
31611
|
+
case "collection":
|
|
31612
|
+
return { type: "collection", path: selector.path };
|
|
31613
|
+
case "term_ids":
|
|
31614
|
+
return { type: "term_ids", ids: selector.ids };
|
|
31615
|
+
case "sort":
|
|
31616
|
+
return {
|
|
31617
|
+
type: "sort",
|
|
31618
|
+
sort_name: selector.sortName,
|
|
31619
|
+
include_descendants: selector.includeDescendants
|
|
31620
|
+
};
|
|
31621
|
+
case "query":
|
|
31622
|
+
return { type: "query", osfql: selector.osfql };
|
|
31623
|
+
case "snapshot":
|
|
31624
|
+
return {
|
|
31625
|
+
type: "snapshot",
|
|
31626
|
+
snapshot_id: selector.snapshotId,
|
|
31627
|
+
filter: selector.filter === void 0 ? void 0 : TermSetSelectorFromFrontToApi(selector.filter)
|
|
31628
|
+
};
|
|
31629
|
+
case "as_of":
|
|
31630
|
+
return {
|
|
31631
|
+
type: "as_of",
|
|
31632
|
+
at: selector.at,
|
|
31633
|
+
filter: selector.filter === void 0 ? void 0 : TermSetSelectorFromFrontToApi(selector.filter)
|
|
31634
|
+
};
|
|
31635
|
+
}
|
|
31636
|
+
}
|
|
31272
31637
|
function TemporalPointFromFrontToApi(model) {
|
|
31273
31638
|
return {
|
|
31274
31639
|
at: model.at,
|
|
@@ -31277,8 +31642,8 @@ function TemporalPointFromFrontToApi(model) {
|
|
|
31277
31642
|
}
|
|
31278
31643
|
function OsfDiffRequestFromFrontToApi(model) {
|
|
31279
31644
|
return {
|
|
31280
|
-
a: model.a,
|
|
31281
|
-
b: model.b,
|
|
31645
|
+
a: TermSetSelectorFromFrontToApi(model.a),
|
|
31646
|
+
b: TermSetSelectorFromFrontToApi(model.b),
|
|
31282
31647
|
include_clause_diff: model.includeClauseDiff,
|
|
31283
31648
|
include_entity_diff: model.includeEntityDiff,
|
|
31284
31649
|
threshold: model.threshold
|
|
@@ -31292,7 +31657,7 @@ function OsfDiffResponseFromApiToFront(dto) {
|
|
|
31292
31657
|
function OsfDiffSequenceRequestFromFrontToApi(model) {
|
|
31293
31658
|
return {
|
|
31294
31659
|
document_family_id: model.documentFamilyId,
|
|
31295
|
-
selectors: model.selectors,
|
|
31660
|
+
selectors: model.selectors?.map(TermSetSelectorFromFrontToApi),
|
|
31296
31661
|
threshold: model.threshold
|
|
31297
31662
|
};
|
|
31298
31663
|
}
|
|
@@ -31303,7 +31668,7 @@ function OsfDiffSequenceResponseFromApiToFront(dto) {
|
|
|
31303
31668
|
}
|
|
31304
31669
|
function OsfDiffTemporalRequestFromFrontToApi(model) {
|
|
31305
31670
|
return {
|
|
31306
|
-
filter: model.filter,
|
|
31671
|
+
filter: model.filter === void 0 ? void 0 : TermSetSelectorFromFrontToApi(model.filter),
|
|
31307
31672
|
from: TemporalPointFromFrontToApi(model.from),
|
|
31308
31673
|
to: TemporalPointFromFrontToApi(model.to),
|
|
31309
31674
|
threshold: model.threshold
|
|
@@ -31338,13 +31703,14 @@ var OsfDiffClient = class {
|
|
|
31338
31703
|
* Entities are matched by OSF unification; `threshold` (default 0.7) is the
|
|
31339
31704
|
* minimum match degree at which two entities are considered the same. Set
|
|
31340
31705
|
* `includeClauseDiff` / `includeEntityDiff` to control which deltas the report
|
|
31341
|
-
* carries.
|
|
31706
|
+
* carries. Each side is a typed {@link OsfDiffSelector}; the report is an opaque
|
|
31707
|
+
* wire-format JSON object.
|
|
31342
31708
|
*
|
|
31343
31709
|
* @example
|
|
31344
31710
|
* ```typescript
|
|
31345
31711
|
* const result = await client.osfDiff.diff({
|
|
31346
|
-
* a: { type: 'document',
|
|
31347
|
-
* b: { type: 'document',
|
|
31712
|
+
* a: { type: 'document', documentId: 'a1b2c3d4-...' },
|
|
31713
|
+
* b: { type: 'document', documentId: 'e5f6a7b8-...' },
|
|
31348
31714
|
* includeClauseDiff: true,
|
|
31349
31715
|
* threshold: 0.8,
|
|
31350
31716
|
* });
|
|
@@ -31404,7 +31770,7 @@ var OsfDiffClient = class {
|
|
|
31404
31770
|
* const result = await client.osfDiff.diffTemporal({
|
|
31405
31771
|
* from: { at: '2026-01-01T00:00:00Z' },
|
|
31406
31772
|
* to: {}, // live
|
|
31407
|
-
* filter: { type: 'document',
|
|
31773
|
+
* filter: { type: 'document', documentId: 'a1b2c3d4-...' },
|
|
31408
31774
|
* });
|
|
31409
31775
|
* console.log(result.report);
|
|
31410
31776
|
* ```
|
|
@@ -31777,13 +32143,22 @@ function SatSolverStatsDtoFromApiToFront(dto) {
|
|
|
31777
32143
|
}
|
|
31778
32144
|
function modelFromApiToFront(raw) {
|
|
31779
32145
|
if (!Array.isArray(raw)) {
|
|
31780
|
-
|
|
32146
|
+
throw new ValidationError(
|
|
32147
|
+
"SAT solver returned a 'satisfiable' verdict without a model; the endpoint contract requires one. Refusing to report an assignment the solver did not give.",
|
|
32148
|
+
"model"
|
|
32149
|
+
);
|
|
31781
32150
|
}
|
|
32151
|
+
const entries = raw;
|
|
31782
32152
|
const model = [];
|
|
31783
|
-
for (
|
|
31784
|
-
|
|
31785
|
-
|
|
32153
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
32154
|
+
const entry = entries[index];
|
|
32155
|
+
if (typeof entry !== "boolean") {
|
|
32156
|
+
throw new ValidationError(
|
|
32157
|
+
`SAT model entry at index ${index} is ${typeof entry}, not a Boolean. The assignment vector is positional, so this entry cannot be dropped without corrupting every later variable.`,
|
|
32158
|
+
"model"
|
|
32159
|
+
);
|
|
31786
32160
|
}
|
|
32161
|
+
model.push(entry);
|
|
31787
32162
|
}
|
|
31788
32163
|
return model;
|
|
31789
32164
|
}
|
|
@@ -31834,12 +32209,19 @@ var SatClient = class {
|
|
|
31834
32209
|
* Solver statistics are attached to every branch.
|
|
31835
32210
|
* @throws {ApiError} If the request fails (e.g. a literal references a variable
|
|
31836
32211
|
* index `>= numVars`, or a clause is empty).
|
|
32212
|
+
* @throws {ValidationError} If a `satisfiable` verdict arrives without a
|
|
32213
|
+
* well-formed Boolean model, which violates the endpoint contract.
|
|
31837
32214
|
*
|
|
31838
32215
|
* @remarks
|
|
31839
32216
|
* Narrow on `result` to reach the model — it exists only on the `satisfiable`
|
|
31840
32217
|
* branch. `maxConflicts: 0` (the default) means an unlimited budget, in which
|
|
31841
32218
|
* case `unknown` cannot be returned.
|
|
31842
32219
|
*
|
|
32220
|
+
* The model is index-aligned with the variables (`model[i]` is the value of
|
|
32221
|
+
* variable `i`). A `satisfiable` response whose model is missing or holds a
|
|
32222
|
+
* non-Boolean is reported as a {@link ValidationError} rather than silently
|
|
32223
|
+
* shortened — dropping an entry would shift every later variable's assignment.
|
|
32224
|
+
*
|
|
31843
32225
|
* Plain JSON serialization: literals are `{ var, negated }` objects and the
|
|
31844
32226
|
* model is a `boolean[]` indexed by variable number. No tagged `ValueDto` or
|
|
31845
32227
|
* untagged `FeatureValueDto` encoding is used.
|
|
@@ -31891,12 +32273,12 @@ function EqLiteralDtoFromFrontToApi(model) {
|
|
|
31891
32273
|
negated: model.negated
|
|
31892
32274
|
};
|
|
31893
32275
|
}
|
|
31894
|
-
function
|
|
32276
|
+
function isRecord3(value) {
|
|
31895
32277
|
return typeof value === "object" && value !== null;
|
|
31896
32278
|
}
|
|
31897
32279
|
function assignmentsFromApiToFront(raw) {
|
|
31898
32280
|
const assignments = {};
|
|
31899
|
-
if (!
|
|
32281
|
+
if (!isRecord3(raw)) {
|
|
31900
32282
|
return assignments;
|
|
31901
32283
|
}
|
|
31902
32284
|
for (const [key, value] of Object.entries(raw)) {
|
|
@@ -32098,7 +32480,9 @@ var ChaseClient = class {
|
|
|
32098
32480
|
* ```
|
|
32099
32481
|
*/
|
|
32100
32482
|
async run(request) {
|
|
32101
|
-
const response = await this.api.runChase(ChaseRunRequestFromFrontToApi(request)
|
|
32483
|
+
const response = await this.api.runChase(ChaseRunRequestFromFrontToApi(request), {
|
|
32484
|
+
headers: { [RAW_BODY_HEADER]: "1" }
|
|
32485
|
+
});
|
|
32102
32486
|
return ChaseRunResponseFromApiToFront(response.data);
|
|
32103
32487
|
}
|
|
32104
32488
|
};
|
|
@@ -32228,7 +32612,7 @@ var ConformanceClient = class {
|
|
|
32228
32612
|
};
|
|
32229
32613
|
|
|
32230
32614
|
// src/normalizers/temporal.ts
|
|
32231
|
-
function
|
|
32615
|
+
function isRecord4(value) {
|
|
32232
32616
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32233
32617
|
}
|
|
32234
32618
|
function asNumber(value) {
|
|
@@ -32288,38 +32672,6 @@ function TemporalModelCheckResponseFromApiToFront(dto) {
|
|
|
32288
32672
|
counterexample
|
|
32289
32673
|
};
|
|
32290
32674
|
}
|
|
32291
|
-
function TermSetSelectorFromFrontToApi(selector) {
|
|
32292
|
-
switch (selector.type) {
|
|
32293
|
-
case "document":
|
|
32294
|
-
return { type: "document", document_id: selector.documentId };
|
|
32295
|
-
case "document_version":
|
|
32296
|
-
return { type: "document_version", document_id: selector.documentId };
|
|
32297
|
-
case "collection":
|
|
32298
|
-
return { type: "collection", path: selector.path };
|
|
32299
|
-
case "term_ids":
|
|
32300
|
-
return { type: "term_ids", ids: selector.ids };
|
|
32301
|
-
case "sort":
|
|
32302
|
-
return {
|
|
32303
|
-
type: "sort",
|
|
32304
|
-
sort_name: selector.sortName,
|
|
32305
|
-
include_descendants: selector.includeDescendants
|
|
32306
|
-
};
|
|
32307
|
-
case "query":
|
|
32308
|
-
return { type: "query", osfql: selector.osfql };
|
|
32309
|
-
case "snapshot":
|
|
32310
|
-
return {
|
|
32311
|
-
type: "snapshot",
|
|
32312
|
-
snapshot_id: selector.snapshotId,
|
|
32313
|
-
filter: selector.filter === void 0 ? void 0 : TermSetSelectorFromFrontToApi(selector.filter)
|
|
32314
|
-
};
|
|
32315
|
-
case "as_of":
|
|
32316
|
-
return {
|
|
32317
|
-
type: "as_of",
|
|
32318
|
-
at: selector.at,
|
|
32319
|
-
filter: selector.filter === void 0 ? void 0 : TermSetSelectorFromFrontToApi(selector.filter)
|
|
32320
|
-
};
|
|
32321
|
-
}
|
|
32322
|
-
}
|
|
32323
32675
|
function TemporalSeriesSpecFromFrontToApi(spec) {
|
|
32324
32676
|
const time = spec.time.kind === "date_time_feature" ? { kind: "date_time_feature", name: spec.time.name } : { kind: "epoch_feature", name: spec.time.name, unit: spec.time.unit };
|
|
32325
32677
|
const value = spec.value.kind === "feature" ? { kind: "feature", name: spec.value.name } : { kind: "count" };
|
|
@@ -32356,7 +32708,7 @@ function TemporalSeriesRequestFromFrontToApi(model) {
|
|
|
32356
32708
|
};
|
|
32357
32709
|
}
|
|
32358
32710
|
function TemporalSeriesPointFromApiToFront(value) {
|
|
32359
|
-
if (!
|
|
32711
|
+
if (!isRecord4(value)) {
|
|
32360
32712
|
return void 0;
|
|
32361
32713
|
}
|
|
32362
32714
|
const bucketStart = asNumber(value["bucket_start"]);
|
|
@@ -32374,7 +32726,7 @@ function TemporalSeriesPointFromApiToFront(value) {
|
|
|
32374
32726
|
};
|
|
32375
32727
|
}
|
|
32376
32728
|
function TemporalTrendSummaryFromApiToFront(value) {
|
|
32377
|
-
if (!
|
|
32729
|
+
if (!isRecord4(value)) {
|
|
32378
32730
|
return void 0;
|
|
32379
32731
|
}
|
|
32380
32732
|
const slopePerMs = asNumber(value["slope_per_ms"]);
|
|
@@ -32389,7 +32741,7 @@ function TemporalTrendSummaryFromApiToFront(value) {
|
|
|
32389
32741
|
return { slopePerMs, intercept, first, last, delta, n };
|
|
32390
32742
|
}
|
|
32391
32743
|
function TemporalSeriesFromApiToFront(value) {
|
|
32392
|
-
if (!
|
|
32744
|
+
if (!isRecord4(value)) {
|
|
32393
32745
|
return void 0;
|
|
32394
32746
|
}
|
|
32395
32747
|
const rawPoints = value["points"];
|
|
@@ -32536,7 +32888,7 @@ var TemporalClient = class {
|
|
|
32536
32888
|
};
|
|
32537
32889
|
|
|
32538
32890
|
// src/normalizers/forecast.ts
|
|
32539
|
-
function
|
|
32891
|
+
function isRecord5(value) {
|
|
32540
32892
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
32541
32893
|
}
|
|
32542
32894
|
function asNumber2(value) {
|
|
@@ -32589,7 +32941,7 @@ function ForecastRequestFromFrontToApi(model) {
|
|
|
32589
32941
|
};
|
|
32590
32942
|
}
|
|
32591
32943
|
function CompetitorForecastFromApiToFront(value) {
|
|
32592
|
-
if (!
|
|
32944
|
+
if (!isRecord5(value)) {
|
|
32593
32945
|
return void 0;
|
|
32594
32946
|
}
|
|
32595
32947
|
const id = asString(value["id"]);
|
|
@@ -32601,7 +32953,7 @@ function CompetitorForecastFromApiToFront(value) {
|
|
|
32601
32953
|
return { id, pWin, pTopK };
|
|
32602
32954
|
}
|
|
32603
32955
|
function OrderedComboFromApiToFront(value) {
|
|
32604
|
-
if (!
|
|
32956
|
+
if (!isRecord5(value)) {
|
|
32605
32957
|
return void 0;
|
|
32606
32958
|
}
|
|
32607
32959
|
const members = asStringArray(value["members"]);
|
|
@@ -32612,7 +32964,7 @@ function OrderedComboFromApiToFront(value) {
|
|
|
32612
32964
|
return { members, probability };
|
|
32613
32965
|
}
|
|
32614
32966
|
function ForecastCoveringSetFromApiToFront(value) {
|
|
32615
|
-
if (!
|
|
32967
|
+
if (!isRecord5(value)) {
|
|
32616
32968
|
return void 0;
|
|
32617
32969
|
}
|
|
32618
32970
|
const members = asStringArray(value["members"]);
|
|
@@ -32625,7 +32977,7 @@ function ForecastCoveringSetFromApiToFront(value) {
|
|
|
32625
32977
|
return { members, alpha, slice, sliceFallback };
|
|
32626
32978
|
}
|
|
32627
32979
|
function RankedInstrumentFromApiToFront(value) {
|
|
32628
|
-
if (!
|
|
32980
|
+
if (!isRecord5(value)) {
|
|
32629
32981
|
return void 0;
|
|
32630
32982
|
}
|
|
32631
32983
|
const id = asString(value["id"]);
|
|
@@ -32645,7 +32997,7 @@ function RankedInstrumentFromApiToFront(value) {
|
|
|
32645
32997
|
return { id, score, rank, interval };
|
|
32646
32998
|
}
|
|
32647
32999
|
function ForecastBodyFromApiToFront(value) {
|
|
32648
|
-
if (!
|
|
33000
|
+
if (!isRecord5(value)) {
|
|
32649
33001
|
return void 0;
|
|
32650
33002
|
}
|
|
32651
33003
|
const shape = value["shape"];
|
|
@@ -32699,7 +33051,7 @@ function ForecastBodyFromApiToFront(value) {
|
|
|
32699
33051
|
return void 0;
|
|
32700
33052
|
}
|
|
32701
33053
|
function ForecastCertificateFromApiToFront(value) {
|
|
32702
|
-
if (!
|
|
33054
|
+
if (!isRecord5(value)) {
|
|
32703
33055
|
return void 0;
|
|
32704
33056
|
}
|
|
32705
33057
|
const modelFingerprint = asString(value["model_fingerprint"]);
|
|
@@ -32718,7 +33070,7 @@ function ForecastCertificateFromApiToFront(value) {
|
|
|
32718
33070
|
};
|
|
32719
33071
|
}
|
|
32720
33072
|
function CertifiedForecastFromApiToFront(value) {
|
|
32721
|
-
if (!
|
|
33073
|
+
if (!isRecord5(value)) {
|
|
32722
33074
|
return void 0;
|
|
32723
33075
|
}
|
|
32724
33076
|
const outcome = value["outcome"];
|
|
@@ -32995,7 +33347,9 @@ var DlClient = class {
|
|
|
32995
33347
|
* ```
|
|
32996
33348
|
*/
|
|
32997
33349
|
async satisfiable(request) {
|
|
32998
|
-
const response = await this.api.satisfiable(DlSatisfiableRequestFromFrontToApi(request)
|
|
33350
|
+
const response = await this.api.satisfiable(DlSatisfiableRequestFromFrontToApi(request), {
|
|
33351
|
+
headers: { [RAW_BODY_HEADER]: "1" }
|
|
33352
|
+
});
|
|
32999
33353
|
return DlSatisfiableResponseFromApiToFront(response.data);
|
|
33000
33354
|
}
|
|
33001
33355
|
/**
|
|
@@ -33031,7 +33385,9 @@ var DlClient = class {
|
|
|
33031
33385
|
* ```
|
|
33032
33386
|
*/
|
|
33033
33387
|
async subsumes(request) {
|
|
33034
|
-
const response = await this.api.subsumes(DlSubsumesRequestFromFrontToApi(request)
|
|
33388
|
+
const response = await this.api.subsumes(DlSubsumesRequestFromFrontToApi(request), {
|
|
33389
|
+
headers: { [RAW_BODY_HEADER]: "1" }
|
|
33390
|
+
});
|
|
33035
33391
|
return DlSubsumesResponseFromApiToFront(response.data);
|
|
33036
33392
|
}
|
|
33037
33393
|
};
|
|
@@ -33788,21 +34144,50 @@ var OntologyExportClient = class {
|
|
|
33788
34144
|
constructor(api) {
|
|
33789
34145
|
this.api = api;
|
|
33790
34146
|
}
|
|
34147
|
+
/**
|
|
34148
|
+
* Issue a content-negotiated export request and project the response.
|
|
34149
|
+
*
|
|
34150
|
+
* @internal
|
|
34151
|
+
* @remarks
|
|
34152
|
+
* Goes through the transport directly rather than through the generated route
|
|
34153
|
+
* methods: `root` is repeatable server-side (`?root=a&root=b`), but utoipa
|
|
34154
|
+
* cannot express a repeated query parameter, so the generated routes type it as
|
|
34155
|
+
* a lone `root?: string` — narrower than the endpoint each route's own
|
|
34156
|
+
* "(repeatable)" doc comment describes. The transport's query serializer
|
|
34157
|
+
* already branches on `Array.isArray` and emits the repeats correctly.
|
|
34158
|
+
*/
|
|
34159
|
+
async requestExport(path, options) {
|
|
34160
|
+
const response = await this.api.http.request({
|
|
34161
|
+
path,
|
|
34162
|
+
method: "GET",
|
|
34163
|
+
query: OntologyExportQueryFromFrontToApi(options),
|
|
34164
|
+
secure: true,
|
|
34165
|
+
headers: { Accept: OntologyExportAcceptFromFrontToApi(options?.format) }
|
|
34166
|
+
});
|
|
34167
|
+
const document = await response.text();
|
|
34168
|
+
return OntologyExportDocumentFromApiToFront(
|
|
34169
|
+
response.headers.get("content-type"),
|
|
34170
|
+
document
|
|
34171
|
+
);
|
|
34172
|
+
}
|
|
33791
34173
|
/**
|
|
33792
34174
|
* Export the tenant's sort lattice (or a sub-lattice) as an OWL ontology.
|
|
33793
34175
|
*
|
|
33794
34176
|
* @param options - Export options: the base IRI for synthesized IRIs, the root
|
|
33795
|
-
* sort to restrict the export to, and the serialization to
|
|
34177
|
+
* sort (or sorts) to restrict the export to, and the serialization to
|
|
34178
|
+
* negotiate on.
|
|
33796
34179
|
* @returns The exported document, verbatim, with the media type the server
|
|
33797
34180
|
* answered with.
|
|
33798
34181
|
* @throws {BadRequestError} If the base IRI is invalid or the query is malformed.
|
|
33799
|
-
* @throws {NotFoundError} If
|
|
34182
|
+
* @throws {NotFoundError} If a requested root sort does not exist.
|
|
33800
34183
|
* @throws {ApiError} If the request otherwise fails.
|
|
33801
34184
|
*
|
|
33802
34185
|
* @remarks
|
|
33803
34186
|
* Omit `root` to export the whole tenant schema. Omit `base` to let the backend
|
|
33804
34187
|
* synthesize IRIs under `urn:osfkb:tenant:{tenant_id}`.
|
|
33805
34188
|
*
|
|
34189
|
+
* `root` is repeatable: pass an array to export several sub-lattices at once.
|
|
34190
|
+
*
|
|
33806
34191
|
* `format` selects the `Accept` header: an RDF serialization yields an RDF
|
|
33807
34192
|
* document, and the default (`'json'`) yields the backend's JSON rendering as
|
|
33808
34193
|
* JSON text — parse it with `JSON.parse` when you need the object.
|
|
@@ -33815,36 +34200,35 @@ var OntologyExportClient = class {
|
|
|
33815
34200
|
* format: 'turtle',
|
|
33816
34201
|
* });
|
|
33817
34202
|
*
|
|
33818
|
-
* console.log(owl.contentType); // 'text/turtle'
|
|
34203
|
+
* console.log(owl.contentType); // 'text/turtle; charset=utf-8'
|
|
33819
34204
|
* console.log(owl.document); // '@prefix : <https://example.org/ontology#> ...'
|
|
34205
|
+
*
|
|
34206
|
+
* // Several sub-lattices in one export -> ?root=clinical_entity&root=administrative_entity
|
|
34207
|
+
* const both = await client.ontologyExport.exportOwl({
|
|
34208
|
+
* root: ['clinical_entity', 'administrative_entity'],
|
|
34209
|
+
* });
|
|
33820
34210
|
* ```
|
|
33821
34211
|
*/
|
|
33822
34212
|
async exportOwl(options) {
|
|
33823
|
-
|
|
33824
|
-
OntologyExportQueryFromFrontToApi(options),
|
|
33825
|
-
{ headers: { Accept: OntologyExportAcceptFromFrontToApi(options?.format) } }
|
|
33826
|
-
);
|
|
33827
|
-
const document = await response.text();
|
|
33828
|
-
return OntologyExportDocumentFromApiToFront(
|
|
33829
|
-
response.headers.get("content-type"),
|
|
33830
|
-
document
|
|
33831
|
-
);
|
|
34213
|
+
return this.requestExport("/api/v1/ontology/export/owl", options);
|
|
33832
34214
|
}
|
|
33833
34215
|
/**
|
|
33834
34216
|
* Export the tenant's schema constraints (or those of a sub-lattice) as SHACL
|
|
33835
34217
|
* shapes.
|
|
33836
34218
|
*
|
|
33837
34219
|
* @param options - Export options: the base IRI for synthesized IRIs, the root
|
|
33838
|
-
* sort to restrict the export to, and the serialization to
|
|
34220
|
+
* sort (or sorts) to restrict the export to, and the serialization to
|
|
34221
|
+
* negotiate on.
|
|
33839
34222
|
* @returns The exported document, verbatim, with the media type the server
|
|
33840
34223
|
* answered with.
|
|
33841
34224
|
* @throws {BadRequestError} If the base IRI is invalid or the query is malformed.
|
|
33842
|
-
* @throws {NotFoundError} If
|
|
34225
|
+
* @throws {NotFoundError} If a requested root sort does not exist.
|
|
33843
34226
|
* @throws {ApiError} If the request otherwise fails.
|
|
33844
34227
|
*
|
|
33845
34228
|
* @remarks
|
|
33846
34229
|
* Each exported shape targets one sort and constrains its features. Omit `root`
|
|
33847
|
-
* to export the whole tenant schema
|
|
34230
|
+
* to export the whole tenant schema; pass an array to export the shapes of
|
|
34231
|
+
* several sub-lattices at once.
|
|
33848
34232
|
*
|
|
33849
34233
|
* `format` selects the `Accept` header: an RDF serialization yields an RDF
|
|
33850
34234
|
* document, and the default (`'json'`) yields the backend's JSON rendering of
|
|
@@ -33854,20 +34238,12 @@ var OntologyExportClient = class {
|
|
|
33854
34238
|
* ```typescript
|
|
33855
34239
|
* const shacl = await client.ontologyExport.exportShacl({ format: 'turtle' });
|
|
33856
34240
|
*
|
|
33857
|
-
* console.log(shacl.contentType); // 'text/turtle'
|
|
34241
|
+
* console.log(shacl.contentType); // 'text/turtle; charset=utf-8'
|
|
33858
34242
|
* console.log(shacl.document); // '... sh:NodeShape ...'
|
|
33859
34243
|
* ```
|
|
33860
34244
|
*/
|
|
33861
34245
|
async exportShacl(options) {
|
|
33862
|
-
|
|
33863
|
-
OntologyExportQueryFromFrontToApi(options),
|
|
33864
|
-
{ headers: { Accept: OntologyExportAcceptFromFrontToApi(options?.format) } }
|
|
33865
|
-
);
|
|
33866
|
-
const document = await response.text();
|
|
33867
|
-
return OntologyExportDocumentFromApiToFront(
|
|
33868
|
-
response.headers.get("content-type"),
|
|
33869
|
-
document
|
|
33870
|
-
);
|
|
34246
|
+
return this.requestExport("/api/v1/ontology/export/shacl", options);
|
|
33871
34247
|
}
|
|
33872
34248
|
};
|
|
33873
34249
|
|