@x12i/memorix-scoper-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/catalog/catalog.v1.json +83 -0
- package/dist/addressing.d.ts +20 -0
- package/dist/addressing.d.ts.map +1 -0
- package/dist/addressing.js +20 -0
- package/dist/addressing.js.map +1 -0
- package/dist/budget-errors.d.ts +4 -0
- package/dist/budget-errors.d.ts.map +1 -0
- package/dist/budget-errors.js +12 -0
- package/dist/budget-errors.js.map +1 -0
- package/dist/budgets.d.ts +28 -0
- package/dist/budgets.d.ts.map +1 -0
- package/dist/budgets.js +52 -0
- package/dist/budgets.js.map +1 -0
- package/dist/catalog/catalog.v1.json +83 -0
- package/dist/catalog.d.ts +12 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +55 -0
- package/dist/catalog.js.map +1 -0
- package/dist/client.d.ts +96 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +315 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +77 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -0
- package/dist/decoder.d.ts +21 -0
- package/dist/decoder.d.ts.map +1 -0
- package/dist/decoder.js +145 -0
- package/dist/decoder.js.map +1 -0
- package/dist/decoders.d.ts +32 -0
- package/dist/decoders.d.ts.map +1 -0
- package/dist/decoders.js +65 -0
- package/dist/decoders.js.map +1 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -0
- package/dist/estate.d.ts +15 -0
- package/dist/estate.d.ts.map +1 -0
- package/dist/estate.js +15 -0
- package/dist/estate.js.map +1 -0
- package/dist/evidence-refs.d.ts +6 -0
- package/dist/evidence-refs.d.ts.map +1 -0
- package/dist/evidence-refs.js +16 -0
- package/dist/evidence-refs.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/pagination.d.ts +3 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +16 -0
- package/dist/pagination.js.map +1 -0
- package/dist/subject-data.d.ts +9 -0
- package/dist/subject-data.d.ts.map +1 -0
- package/dist/subject-data.js +76 -0
- package/dist/subject-data.js.map +1 -0
- package/dist/subjects.d.ts +2 -0
- package/dist/subjects.d.ts.map +1 -0
- package/dist/subjects.js +2 -0
- package/dist/subjects.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoders.d.ts","sourceRoot":"","sources":["../src/decoders.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,QAAQ,CAAC;AAErD,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,OAAO,sBAAsB,CAAC;QAC/C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,wBAAgB,kCAAkC,IAAI,IAAI,CAczD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB,CAG1E;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,OAAO,GAAG,yBAAyB,CAoC3F"}
|
package/dist/decoders.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ScoperError } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
export const NEXUM_PERSIST_CONTRACT = "memorix-nexum-persist/1";
|
|
3
|
+
/**
|
|
4
|
+
* Production decoder remains unavailable until these locked artifacts exist:
|
|
5
|
+
* - docs/nexum-persistence-schema.md
|
|
6
|
+
* - docs/fixtures/nexum-persist-roundtrip.json
|
|
7
|
+
* Searched x12i org; neither file nor the string `memorix-nexum-persist` was found.
|
|
8
|
+
*/
|
|
9
|
+
export const NEXUM_PERSIST_DECODER_AVAILABLE = false;
|
|
10
|
+
export function assertNexumPersistDecoderAvailable() {
|
|
11
|
+
if (!NEXUM_PERSIST_DECODER_AVAILABLE) {
|
|
12
|
+
throw new ScoperError("UPSTREAM_CONTRACT_MISMATCH", "memorix-nexum-persist/1 decoder unavailable: normative schema/fixtures are not locked under contracts/upstream", {
|
|
13
|
+
requiredArtifacts: [
|
|
14
|
+
"docs/nexum-persistence-schema.md",
|
|
15
|
+
"docs/fixtures/nexum-persist-roundtrip.json",
|
|
16
|
+
],
|
|
17
|
+
contractId: NEXUM_PERSIST_CONTRACT,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Structural envelope gate used only after normative schema is unlocked.
|
|
23
|
+
* Does NOT invent domain fields. Currently blocked via assertNexumPersistDecoderAvailable().
|
|
24
|
+
*/
|
|
25
|
+
export function decodeNexumPersist(raw) {
|
|
26
|
+
assertNexumPersistDecoderAvailable();
|
|
27
|
+
return decodeNexumPersistEnvelopeUnchecked(raw);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @internal TEST/scaffold only — not a substitute for the missing normative schema.
|
|
31
|
+
* Rejects unknown contract versions; does not claim full memorix-nexum-persist/1 compliance.
|
|
32
|
+
*/
|
|
33
|
+
export function decodeNexumPersistEnvelopeUnchecked(raw) {
|
|
34
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
35
|
+
throw new ScoperError("UPSTREAM_CONTRACT_MISMATCH", "Nexum persist record must be an object");
|
|
36
|
+
}
|
|
37
|
+
const rec = raw;
|
|
38
|
+
const data = rec.data;
|
|
39
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
40
|
+
throw new ScoperError("UPSTREAM_CONTRACT_MISMATCH", "Missing data object on Nexum persist record");
|
|
41
|
+
}
|
|
42
|
+
const d = data;
|
|
43
|
+
const version = d.contractVersion;
|
|
44
|
+
if (version !== NEXUM_PERSIST_CONTRACT) {
|
|
45
|
+
throw new ScoperError("UNSUPPORTED_CONTRACT_VERSION", `Unsupported contractVersion: ${String(version)}`, { expected: NEXUM_PERSIST_CONTRACT, actual: version });
|
|
46
|
+
}
|
|
47
|
+
if (typeof d.serviceId !== "string" || !d.serviceId.trim()) {
|
|
48
|
+
throw new ScoperError("UPSTREAM_CONTRACT_MISMATCH", "data.serviceId must be a non-empty string");
|
|
49
|
+
}
|
|
50
|
+
const recordId = String(rec.recordId ?? rec.id ?? "").trim();
|
|
51
|
+
if (!recordId) {
|
|
52
|
+
throw new ScoperError("UPSTREAM_CONTRACT_MISMATCH", "recordId is required");
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
format: typeof rec.format === "string" ? rec.format : undefined,
|
|
56
|
+
recordId,
|
|
57
|
+
objectType: typeof rec.objectType === "string" ? rec.objectType : undefined,
|
|
58
|
+
contentType: typeof rec.contentType === "string" ? rec.contentType : undefined,
|
|
59
|
+
data: d,
|
|
60
|
+
_system: rec._system && typeof rec._system === "object" && !Array.isArray(rec._system)
|
|
61
|
+
? rec._system
|
|
62
|
+
: undefined,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=decoders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoders.js","sourceRoot":"","sources":["../src/decoders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GA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,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,gCAAgC,CAAC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAwB,MAAM,gCAAgC,CAAC"}
|
package/dist/estate.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TrustedExecutionContext } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
import type { EstateTransport } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Estate / map-store path remains unavailable this pass.
|
|
5
|
+
* Production consumers must inject `estateTransport` only when locked map-store docs exist.
|
|
6
|
+
*/
|
|
7
|
+
export declare function requireEstateTransport(transport: EstateTransport | undefined, featureEnabled: boolean | undefined): EstateTransport;
|
|
8
|
+
export type { EstateTransport };
|
|
9
|
+
export declare function startEstateSession(transport: EstateTransport, input: {
|
|
10
|
+
context: TrustedExecutionContext;
|
|
11
|
+
bootstrap?: unknown;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
sessionId: string;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=estate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estate.d.ts","sourceRoot":"","sources":["../src/estate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,eAAe,GAAG,SAAS,EACtC,cAAc,EAAE,OAAO,GAAG,SAAS,GAClC,eAAe,CAQjB;AAED,YAAY,EAAE,eAAe,EAAE,CAAC;AAEhC,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE;IAAE,OAAO,EAAE,uBAAuB,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/D,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhC"}
|
package/dist/estate.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScoperError } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
/**
|
|
3
|
+
* Estate / map-store path remains unavailable this pass.
|
|
4
|
+
* Production consumers must inject `estateTransport` only when locked map-store docs exist.
|
|
5
|
+
*/
|
|
6
|
+
export function requireEstateTransport(transport, featureEnabled) {
|
|
7
|
+
if (!featureEnabled || !transport) {
|
|
8
|
+
throw new ScoperError("ESTATE_PATH_UNAVAILABLE", "Estate/map-store path is unavailable; excluded until durable upstream artifacts arrive");
|
|
9
|
+
}
|
|
10
|
+
return transport;
|
|
11
|
+
}
|
|
12
|
+
export async function startEstateSession(transport, input) {
|
|
13
|
+
return transport.startSession(input);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=estate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estate.js","sourceRoot":"","sources":["../src/estate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgC,MAAM,gCAAgC,CAAC;AAG3F;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAsC,EACtC,cAAmC;IAEnC,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,WAAW,CACnB,yBAAyB,EACzB,wFAAwF,CACzF,CAAC;IACJ,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAID,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,SAA0B,EAC1B,KAAgE;IAEhE,OAAO,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EvidenceRef, SubjectEvidenceRef, EstateBagEvidenceRef, KnowledgeExploreEvidenceRef } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
export declare function subjectRef(input: Omit<SubjectEvidenceRef, "kind">): SubjectEvidenceRef;
|
|
3
|
+
export declare function estateBagRef(input: Omit<EstateBagEvidenceRef, "kind">): EstateBagEvidenceRef;
|
|
4
|
+
export declare function knowledgeExploreRef(input: Omit<KnowledgeExploreEvidenceRef, "kind">): KnowledgeExploreEvidenceRef;
|
|
5
|
+
export declare function isEvidenceRef(value: unknown): value is EvidenceRef;
|
|
6
|
+
//# sourceMappingURL=evidence-refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-refs.d.ts","sourceRoot":"","sources":["../src/evidence-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;AAExC,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,GAAG,kBAAkB,CAEtF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG,oBAAoB,CAE5F;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,IAAI,CAAC,2BAA2B,EAAE,MAAM,CAAC,GAC/C,2BAA2B,CAE7B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAIlE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function subjectRef(input) {
|
|
2
|
+
return { kind: "subject", ...input };
|
|
3
|
+
}
|
|
4
|
+
export function estateBagRef(input) {
|
|
5
|
+
return { kind: "estate-bag", ...input };
|
|
6
|
+
}
|
|
7
|
+
export function knowledgeExploreRef(input) {
|
|
8
|
+
return { kind: "knowledge-explore", ...input };
|
|
9
|
+
}
|
|
10
|
+
export function isEvidenceRef(value) {
|
|
11
|
+
if (!value || typeof value !== "object")
|
|
12
|
+
return false;
|
|
13
|
+
const kind = value.kind;
|
|
14
|
+
return kind === "subject" || kind === "estate-bag" || kind === "knowledge-explore";
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=evidence-refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-refs.js","sourceRoot":"","sources":["../src/evidence-refs.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,UAAU,CAAC,KAAuC;IAChE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAyC;IACpE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAgD;IAEhD,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,KAAK,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,IAAI,GAAI,KAA2B,CAAC,IAAI,CAAC;IAC/C,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,mBAAmB,CAAC;AACrF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createMemorixScoperClient, type ContextualSdk, type MemorixScoperClient } from "./client.js";
|
|
2
|
+
export { requireContentAddress, requireContentTypePair, } from "./addressing.js";
|
|
3
|
+
export { type TrustedSdkConfig, type CredentialsProvider, type EstateTransport, type MemorixTransport, resolveBaseUrl, resolveHostBudgets, } from "./config.js";
|
|
4
|
+
export { BudgetAccountant } from "./budgets.js";
|
|
5
|
+
export { decodeNexumPersistEnvelope, decodeNexumPersistOrThrow, decodeNexumPersistRecord, decodeNexumPersistExpectedStored, } from "./decoder.js";
|
|
6
|
+
export { readSubjectData } from "./subject-data.js";
|
|
7
|
+
export { clampPageLimit } from "./pagination.js";
|
|
8
|
+
export { describeCatalog, getCatalog, requireCatalogEntry } from "./catalog.js";
|
|
9
|
+
export { subjectRef, estateBagRef, knowledgeExploreRef, isEvidenceRef } from "./evidence-refs.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createMemorixScoperClient } from "./client.js";
|
|
2
|
+
export { requireContentAddress, requireContentTypePair, } from "./addressing.js";
|
|
3
|
+
export { resolveBaseUrl, resolveHostBudgets, } from "./config.js";
|
|
4
|
+
export { BudgetAccountant } from "./budgets.js";
|
|
5
|
+
export { decodeNexumPersistEnvelope, decodeNexumPersistOrThrow, decodeNexumPersistRecord, decodeNexumPersistExpectedStored, } from "./decoder.js";
|
|
6
|
+
export { readSubjectData } from "./subject-data.js";
|
|
7
|
+
export { clampPageLimit } from "./pagination.js";
|
|
8
|
+
export { describeCatalog, getCatalog, requireCatalogEntry } from "./catalog.js";
|
|
9
|
+
export { subjectRef, estateBagRef, knowledgeExploreRef, isEvidenceRef } from "./evidence-refs.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAgD,MAAM,aAAa,CAAC;AACtG,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAKL,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAMA,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAazD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MEMORIX_PAGE_DEFAULT, MEMORIX_PAGE_MAX, } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
import { ScoperError } from "@x12i/memorix-scoper-contracts";
|
|
3
|
+
/** Clamp list/query page size: default 50, max 200 (schema §7). Never silently truncate results. */
|
|
4
|
+
export function clampPageLimit(requested) {
|
|
5
|
+
if (requested == null || !Number.isFinite(requested))
|
|
6
|
+
return MEMORIX_PAGE_DEFAULT;
|
|
7
|
+
const n = Math.floor(requested);
|
|
8
|
+
if (n < 1) {
|
|
9
|
+
throw new ScoperError("INVALID_REQUEST", "limit must be >= 1");
|
|
10
|
+
}
|
|
11
|
+
if (n > MEMORIX_PAGE_MAX) {
|
|
12
|
+
throw new ScoperError("INVALID_REQUEST", `limit ${n} exceeds Memorix page maximum ${MEMORIX_PAGE_MAX}`);
|
|
13
|
+
}
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,oGAAoG;AACpG,MAAM,UAAU,cAAc,CAAC,SAAkB;IAC/C,IAAI,SAAS,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,oBAAoB,CAAC;IAClF,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAChC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACV,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,CAAC,GAAG,gBAAgB,EAAE,CAAC;QACzB,MAAM,IAAI,WAAW,CACnB,iBAAiB,EACjB,SAAS,CAAC,iCAAiC,gBAAgB,EAAE,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SubjectDataRequest, type SubjectDataResponse } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
import type { ContextualSdk } from "./client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Return stored Memorix subject pieces for one recordId.
|
|
5
|
+
* Requires objectType + contentType (land v2 product read). Does not resolve names
|
|
6
|
+
* and does not fetch graph neighbors.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readSubjectData(ctx: ContextualSdk, input: SubjectDataRequest): Promise<SubjectDataResponse>;
|
|
9
|
+
//# sourceMappingURL=subject-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subject-data.d.ts","sourceRoot":"","sources":["../src/subject-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAqC9B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ScoperError, SubjectDataRequestSchema, SubjectDataResponseSchema, NEXUM_PERSIST_CONTENT_TYPE, NEXUM_PERSIST_OBJECT_TYPE, } from "@x12i/memorix-scoper-contracts";
|
|
2
|
+
import { decodeNexumPersistRecord } from "./decoder.js";
|
|
3
|
+
/**
|
|
4
|
+
* Return stored Memorix subject pieces for one recordId.
|
|
5
|
+
* Requires objectType + contentType (land v2 product read). Does not resolve names
|
|
6
|
+
* and does not fetch graph neighbors.
|
|
7
|
+
*/
|
|
8
|
+
export async function readSubjectData(ctx, input) {
|
|
9
|
+
const request = SubjectDataRequestSchema.parse(input);
|
|
10
|
+
const contentTypes = uniqueContentTypes(request.contentType, request.alsoContentTypes);
|
|
11
|
+
const pieces = [];
|
|
12
|
+
for (const contentType of contentTypes) {
|
|
13
|
+
const res = await ctx.subjects.get({
|
|
14
|
+
objectType: request.objectType,
|
|
15
|
+
contentType,
|
|
16
|
+
id: request.recordId,
|
|
17
|
+
});
|
|
18
|
+
const isAnchor = contentType === request.contentType;
|
|
19
|
+
if (isAnchor && !res.record) {
|
|
20
|
+
throw new ScoperError("READ_NOT_FOUND", `subject not found: ${request.objectType}/${contentType}/${request.recordId}`);
|
|
21
|
+
}
|
|
22
|
+
pieces.push({
|
|
23
|
+
recordId: request.recordId,
|
|
24
|
+
objectType: request.objectType,
|
|
25
|
+
contentType,
|
|
26
|
+
found: Boolean(res.record),
|
|
27
|
+
record: res.record,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const observedLinks = linksFromPieces(pieces);
|
|
31
|
+
return SubjectDataResponseSchema.parse({
|
|
32
|
+
anchor: {
|
|
33
|
+
recordId: request.recordId,
|
|
34
|
+
objectType: request.objectType,
|
|
35
|
+
contentType: request.contentType,
|
|
36
|
+
},
|
|
37
|
+
pieces,
|
|
38
|
+
...(observedLinks ? { observedLinks } : {}),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function uniqueContentTypes(primary, extra) {
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const raw of [primary, ...(extra ?? [])]) {
|
|
44
|
+
const contentType = raw.trim();
|
|
45
|
+
if (!contentType || out.includes(contentType))
|
|
46
|
+
continue;
|
|
47
|
+
out.push(contentType);
|
|
48
|
+
}
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
function linksFromPieces(pieces) {
|
|
52
|
+
for (const piece of pieces) {
|
|
53
|
+
if (piece.objectType !== NEXUM_PERSIST_OBJECT_TYPE ||
|
|
54
|
+
piece.contentType !== NEXUM_PERSIST_CONTENT_TYPE ||
|
|
55
|
+
!piece.record) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
const decoded = decodeNexumPersistRecord(piece.record);
|
|
60
|
+
const nodeIds = decoded.data.proposedGraph.nodes
|
|
61
|
+
.map((node) => {
|
|
62
|
+
if (!node || typeof node !== "object" || Array.isArray(node))
|
|
63
|
+
return "";
|
|
64
|
+
const id = node.id;
|
|
65
|
+
return typeof id === "string" ? id.trim() : "";
|
|
66
|
+
})
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
return { sourceRefs: decoded.data.sourceRefs, nodeIds };
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=subject-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subject-data.js","sourceRoot":"","sources":["../src/subject-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,GAG1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAkB,EAClB,KAAyB;IAEzB,MAAM,OAAO,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvF,MAAM,MAAM,GAAG,EAAE,CAAC;IAElB,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,MAAM,GAAG,GA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],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/subjects.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subjects.js","sourceRoot":"","sources":["../src/subjects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x12i/memorix-scoper-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Trusted Memorix Scoper data SDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"catalog",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "restricted",
|
|
21
|
+
"registry": "https://registry.npmjs.org/",
|
|
22
|
+
"tag": "dev"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc -p tsconfig.json && node ../../scripts/copy-sdk-catalog.mjs",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
|
+
"test": "vitest run"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@x12i/memorix-client": "^3.8.0",
|
|
31
|
+
"@x12i/memorix-scoper-contracts": "^1.0.0",
|
|
32
|
+
"zod": "^3.25.67"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@x12i/memorix-scoper-testing": "workspace:*",
|
|
36
|
+
"typescript": "^5.8.3",
|
|
37
|
+
"vitest": "^3.2.4"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=22"
|
|
41
|
+
},
|
|
42
|
+
"license": "MIT"
|
|
43
|
+
}
|