@party-stack/ontology-backend 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +148 -2
- package/lib/actions.d.ts +47 -0
- package/lib/actions.d.ts.map +1 -0
- package/lib/actions.js +306 -0
- package/lib/actions.js.map +1 -0
- package/lib/clients.d.ts +236 -0
- package/lib/clients.d.ts.map +1 -0
- package/lib/clients.js +211 -0
- package/lib/clients.js.map +1 -0
- package/lib/delivery.d.ts +746 -0
- package/lib/delivery.d.ts.map +1 -0
- package/lib/delivery.js +863 -0
- package/lib/delivery.js.map +1 -0
- package/lib/description.d.ts +29 -0
- package/lib/description.d.ts.map +1 -0
- package/lib/description.js +28 -0
- package/lib/description.js.map +1 -0
- package/lib/encrypted.d.ts +41 -0
- package/lib/encrypted.d.ts.map +1 -0
- package/lib/encrypted.js +111 -0
- package/lib/encrypted.js.map +1 -0
- package/lib/errors.d.ts +106 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +275 -0
- package/lib/errors.js.map +1 -0
- package/lib/fulfillment.d.ts +25 -0
- package/lib/fulfillment.d.ts.map +1 -0
- package/lib/fulfillment.js +99 -0
- package/lib/fulfillment.js.map +1 -0
- package/lib/index.d.ts +297 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +91 -0
- package/lib/index.js.map +1 -0
- package/lib/maintenance.d.ts +11 -0
- package/lib/maintenance.d.ts.map +1 -0
- package/lib/maintenance.js +24 -0
- package/lib/maintenance.js.map +1 -0
- package/lib/meta.d.ts +26 -0
- package/lib/meta.d.ts.map +1 -0
- package/lib/meta.js +213 -0
- package/lib/meta.js.map +1 -0
- package/lib/owned.d.ts +74 -0
- package/lib/owned.d.ts.map +1 -0
- package/lib/owned.js +593 -0
- package/lib/owned.js.map +1 -0
- package/lib/policy/indexes.d.ts +12 -0
- package/lib/policy/indexes.d.ts.map +1 -0
- package/lib/policy/indexes.js +113 -0
- package/lib/policy/indexes.js.map +1 -0
- package/lib/policy/planner.d.ts +10 -0
- package/lib/policy/planner.d.ts.map +1 -0
- package/lib/policy/planner.js +118 -0
- package/lib/policy/planner.js.map +1 -0
- package/lib/policy/view.d.ts +31 -0
- package/lib/policy/view.d.ts.map +1 -0
- package/lib/policy/view.js +173 -0
- package/lib/policy/view.js.map +1 -0
- package/lib/policy.d.ts +47 -0
- package/lib/policy.d.ts.map +1 -0
- package/lib/policy.js +100 -0
- package/lib/policy.js.map +1 -0
- package/lib/protocol.d.ts +570 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +144 -0
- package/lib/protocol.js.map +1 -0
- package/lib/query.d.ts +33 -0
- package/lib/query.d.ts.map +1 -0
- package/lib/query.js +51 -0
- package/lib/query.js.map +1 -0
- package/lib/references.d.ts +8 -0
- package/lib/references.d.ts.map +1 -0
- package/lib/references.js +41 -0
- package/lib/references.js.map +1 -0
- package/lib/storage.d.ts +55 -0
- package/lib/storage.d.ts.map +1 -0
- package/lib/storage.js +168 -0
- package/lib/storage.js.map +1 -0
- package/lib/subset.d.ts +19 -0
- package/lib/subset.d.ts.map +1 -0
- package/lib/subset.js +150 -0
- package/lib/subset.js.map +1 -0
- package/lib/subsetSchema.d.ts +10 -0
- package/lib/subsetSchema.d.ts.map +1 -0
- package/lib/subsetSchema.js +20 -0
- package/lib/subsetSchema.js.map +1 -0
- package/package.json +72 -3
package/lib/subset.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BackendError } from "./errors.js";
|
|
2
|
+
import { ObjectSelectionSchema, ObjectSubsetSchema } from "./subsetSchema.js";
|
|
3
|
+
import { coversSubset, resolveSubsetSnapshot } from "./fulfillment.js";
|
|
4
|
+
import { ObjectSubset } from "@party-stack/ontology-spec/query";
|
|
5
|
+
import { Query } from "@party-stack/ontology-storage";
|
|
6
|
+
import { Effect } from "effect";
|
|
7
|
+
import { OntologyIR } from "@party-stack/ontology-spec";
|
|
8
|
+
//#region src/subset.d.ts
|
|
9
|
+
export interface CompiledSubset {
|
|
10
|
+
readonly objectType: string;
|
|
11
|
+
readonly query?: Query;
|
|
12
|
+
}
|
|
13
|
+
/** Infrastructure adapter for existing physical provider/transaction readers. */
|
|
14
|
+
export declare const objectSubset: (objectType: string, scan?: Query, binding?: string) => ObjectSubset;
|
|
15
|
+
/** Lower a source-bound spec subset at the engine/provider boundary, never at the public demand API. */
|
|
16
|
+
export declare const compileObjectSubset: (ir: OntologyIR, subset: ObjectSubset, context?: Record<string, unknown> | undefined) => Effect.Effect<CompiledSubset, BackendError<"Conflict" | "Forbidden" | "HistoryExpired" | "Internal" | "InvalidConfiguration" | "InvalidRequest" | "InvalidResponse" | "NotFound" | "NotImplemented" | "RateLimited" | "ResultExpired" | "SchemaMismatch" | "SessionExpired" | "SessionReplaced" | "SourceMismatch" | "Unauthenticated" | "Unavailable" | "ValidationFailed" | "ViewReplaced">, never>;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ObjectSelectionSchema, ObjectSubsetSchema, coversSubset, resolveSubsetSnapshot };
|
|
19
|
+
//# sourceMappingURL=subset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subset.d.ts","names":[],"sources":["../src/subset.ts"],"mappings":";;;;;;;;iBAUiB;WACJ;WACA,QAAQ;;;qBAKR,eAAY,oBAAsB,OAAQ,OAAK,qBAAyB;;qBAmCxE,sBAAmB,IAAA,YAAA,QAAA,cAAA,UAAA,wCAAA,OAAA,OAAA,gBAAA"}
|
package/lib/subset.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { BackendError } from "./errors.js";
|
|
2
|
+
import { ObjectSelectionSchema, ObjectSubsetSchema } from "./subsetSchema.js";
|
|
3
|
+
import { coversSubset, resolveSubsetSnapshot } from "./fulfillment.js";
|
|
4
|
+
import { queryExecutor } from "./query.js";
|
|
5
|
+
import * as q from "@party-stack/ontology-spec/query";
|
|
6
|
+
import { QuerySchema } from "@party-stack/ontology-storage";
|
|
7
|
+
import { Effect, Predicate, Schema } from "effect";
|
|
8
|
+
import { QueryDocumentSchema } from "@party-stack/ontology-spec/effect";
|
|
9
|
+
//#region src/subset.ts
|
|
10
|
+
/** Infrastructure adapter for existing physical provider/transaction readers. */
|
|
11
|
+
const objectSubset = (objectType, scan = {}, binding = "row") => {
|
|
12
|
+
const operand = (v) => v && typeof v === "object" && "_tag" in v && v._tag === "Field" ? q.field(binding, ...v.path) : q.literal(v);
|
|
13
|
+
const predicate = (p) => {
|
|
14
|
+
if (p.op === "and" || p.op === "or") return q[p.op](...p.predicates.map(predicate));
|
|
15
|
+
if (p.op === "not") return q.not(predicate(p.predicate));
|
|
16
|
+
if (p.op === "in") return q.inArray(operand(p.left), q.literal([...p.values]));
|
|
17
|
+
return q[p.op](operand(p.left), operand(p.right));
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
from: {
|
|
21
|
+
source: { objectType },
|
|
22
|
+
binding
|
|
23
|
+
},
|
|
24
|
+
...scan.where ? { where: predicate(scan.where) } : {},
|
|
25
|
+
...scan.orderBy ? { orderBy: scan.orderBy.map((o) => ({
|
|
26
|
+
expression: operand(o.field),
|
|
27
|
+
direction: o.direction,
|
|
28
|
+
nulls: o.nulls
|
|
29
|
+
})) } : {},
|
|
30
|
+
...scan.limit !== void 0 || scan.offset !== void 0 || scan.after !== void 0 ? { page: {
|
|
31
|
+
limit: scan.limit,
|
|
32
|
+
offset: scan.offset,
|
|
33
|
+
after: scan.after ? {
|
|
34
|
+
values: [...scan.after.values],
|
|
35
|
+
key: scan.after.key
|
|
36
|
+
} : void 0
|
|
37
|
+
} } : {}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/** Lower a source-bound spec subset at the engine/provider boundary, never at the public demand API. */
|
|
41
|
+
const compileObjectSubset = Effect.fnUntraced(function* (ir, subset, context) {
|
|
42
|
+
if (Predicate.isObject(subset) && Object.hasOwn(subset, "select")) return yield* new BackendError({
|
|
43
|
+
operation: "subset.compile",
|
|
44
|
+
kind: "NotImplemented",
|
|
45
|
+
retryable: false,
|
|
46
|
+
message: "Query selections require query-result demand, which is not implemented yet."
|
|
47
|
+
});
|
|
48
|
+
const document = yield* Schema.decodeUnknownEffect(QueryDocumentSchema)({ select: [q.sub("objects", {
|
|
49
|
+
...subset,
|
|
50
|
+
select: []
|
|
51
|
+
})] }).pipe(Effect.mapError((cause) => new BackendError({
|
|
52
|
+
operation: "subset.compile",
|
|
53
|
+
kind: "InvalidRequest",
|
|
54
|
+
retryable: false,
|
|
55
|
+
message: "Invalid object subset.",
|
|
56
|
+
cause
|
|
57
|
+
})));
|
|
58
|
+
const selection = document.select[0];
|
|
59
|
+
if (selection.kind !== "sub") return yield* new BackendError({
|
|
60
|
+
operation: "subset.compile",
|
|
61
|
+
kind: "InvalidRequest",
|
|
62
|
+
retryable: false,
|
|
63
|
+
message: "Invalid object subset selection."
|
|
64
|
+
});
|
|
65
|
+
const decoded = selection.value.query;
|
|
66
|
+
if (!decoded.from.source.objectType || decoded.from.source.related) return yield* new BackendError({
|
|
67
|
+
operation: "subset.compile",
|
|
68
|
+
kind: "InvalidRequest",
|
|
69
|
+
retryable: false,
|
|
70
|
+
message: "An object subset requires an explicit object type."
|
|
71
|
+
});
|
|
72
|
+
subset = {
|
|
73
|
+
...decoded,
|
|
74
|
+
from: {
|
|
75
|
+
...decoded.from,
|
|
76
|
+
source: {
|
|
77
|
+
ontology: decoded.from.source.ontology,
|
|
78
|
+
objectType: decoded.from.source.objectType
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const unsupported = () => new BackendError({
|
|
83
|
+
operation: "subset.compile",
|
|
84
|
+
kind: "NotImplemented",
|
|
85
|
+
retryable: false,
|
|
86
|
+
message: "This subset requires query-result demand; only exact object predicates and field ordering can be demanded directly."
|
|
87
|
+
});
|
|
88
|
+
const issues = yield* Effect.try({
|
|
89
|
+
try: () => q.validateQueryDocument(ir, document),
|
|
90
|
+
catch: (cause) => new BackendError({
|
|
91
|
+
operation: "subset.compile",
|
|
92
|
+
kind: "InvalidConfiguration",
|
|
93
|
+
retryable: false,
|
|
94
|
+
message: "Invalid ontology query environment.",
|
|
95
|
+
cause
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
if (issues.length || subset.from.source.ontology) return yield* new BackendError({
|
|
99
|
+
operation: "subset.compile",
|
|
100
|
+
kind: "InvalidRequest",
|
|
101
|
+
retryable: false,
|
|
102
|
+
message: "Invalid object subset.",
|
|
103
|
+
issues
|
|
104
|
+
});
|
|
105
|
+
const executor = queryExecutor({
|
|
106
|
+
reader: {
|
|
107
|
+
ir,
|
|
108
|
+
loadSubset: () => Effect.fail(unsupported())
|
|
109
|
+
},
|
|
110
|
+
context
|
|
111
|
+
});
|
|
112
|
+
let where;
|
|
113
|
+
if (subset.where) {
|
|
114
|
+
const lowered = yield* executor.lower(subset.where, subset.from, /* @__PURE__ */ new Map());
|
|
115
|
+
if (!lowered.exact) return yield* unsupported();
|
|
116
|
+
where = lowered.where;
|
|
117
|
+
}
|
|
118
|
+
const orderBy = [];
|
|
119
|
+
for (const order of subset.orderBy ?? []) {
|
|
120
|
+
const e = order.expression;
|
|
121
|
+
if (e.kind !== "getAt" || e.value.source.kind !== "localReference" || e.value.source.value.name !== subset.from.binding) return yield* unsupported();
|
|
122
|
+
orderBy.push({
|
|
123
|
+
field: {
|
|
124
|
+
_tag: "Field",
|
|
125
|
+
path: e.value.path
|
|
126
|
+
},
|
|
127
|
+
direction: order.direction,
|
|
128
|
+
nulls: order.nulls
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const query = yield* Schema.decodeUnknownEffect(QuerySchema)({
|
|
132
|
+
where,
|
|
133
|
+
...orderBy.length ? { orderBy } : {},
|
|
134
|
+
...subset.page
|
|
135
|
+
}).pipe(Effect.mapError((cause) => new BackendError({
|
|
136
|
+
operation: "subset.compile",
|
|
137
|
+
kind: "InvalidRequest",
|
|
138
|
+
retryable: false,
|
|
139
|
+
message: "Invalid subset window or operands.",
|
|
140
|
+
cause
|
|
141
|
+
})));
|
|
142
|
+
return {
|
|
143
|
+
objectType: subset.from.source.objectType,
|
|
144
|
+
...Object.values(query).some((value) => value !== void 0) ? { query } : {}
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
//#endregion
|
|
148
|
+
export { ObjectSelectionSchema, ObjectSubsetSchema, compileObjectSubset, coversSubset, objectSubset, resolveSubsetSnapshot };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=subset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subset.js","names":["EffectPredicate"],"sources":["../src/subset.ts"],"sourcesContent":["import { QueryDocumentSchema } from \"@party-stack/ontology-spec/effect\";\nimport * as q from \"@party-stack/ontology-spec/query\";\nimport { QuerySchema } from \"@party-stack/ontology-storage\";\nimport { Effect, Predicate as EffectPredicate, Schema } from \"effect\";\nimport { BackendError } from \"./errors.js\";\nimport { queryExecutor } from \"./query.js\";\nimport type { OntologyIR, Expression } from \"@party-stack/ontology-spec\";\nimport type { ObjectSubset } from \"@party-stack/ontology-spec/query\";\nimport type { Operand, Predicate, Query, Field } from \"@party-stack/ontology-storage\";\n\nexport interface CompiledSubset {\n readonly objectType: string;\n readonly query?: Query;\n}\nexport { ObjectSubsetSchema, ObjectSelectionSchema } from \"./subsetSchema.js\";\n\n/** Infrastructure adapter for existing physical provider/transaction readers. */\nexport const objectSubset = (objectType: string, scan: Query = {}, binding = \"row\"): ObjectSubset => {\n const operand = (v: Operand): Expression =>\n v && typeof v === \"object\" && \"_tag\" in v && v._tag === \"Field\"\n ? q.field(binding, ...(v as Field).path)\n : q.literal(v);\n const predicate = (p: Predicate): Expression => {\n if (p.op === \"and\" || p.op === \"or\") return q[p.op](...p.predicates.map(predicate));\n if (p.op === \"not\") return q.not(predicate(p.predicate));\n if (p.op === \"in\") return q.inArray(operand(p.left), q.literal([...p.values]));\n return q[p.op](operand(p.left), operand(p.right));\n };\n return {\n from: { source: { objectType }, binding },\n ...(scan.where ? { where: predicate(scan.where) } : {}),\n ...(scan.orderBy\n ? {\n orderBy: scan.orderBy.map((o) => ({\n expression: operand(o.field),\n direction: o.direction,\n nulls: o.nulls,\n })),\n }\n : {}),\n ...(scan.limit !== undefined || scan.offset !== undefined || scan.after !== undefined\n ? {\n page: {\n limit: scan.limit,\n offset: scan.offset,\n after: scan.after ? { values: [...scan.after.values], key: scan.after.key } : undefined,\n },\n }\n : {}),\n };\n};\n/** Lower a source-bound spec subset at the engine/provider boundary, never at the public demand API. */\nexport const compileObjectSubset = Effect.fnUntraced(function* (\n ir: OntologyIR,\n subset: ObjectSubset,\n context?: Record<string, unknown>\n): Effect.fn.Return<CompiledSubset, BackendError> {\n if (EffectPredicate.isObject(subset) && Object.hasOwn(subset, \"select\"))\n return yield* new BackendError({\n operation: \"subset.compile\",\n kind: \"NotImplemented\",\n retryable: false,\n message: \"Query selections require query-result demand, which is not implemented yet.\",\n });\n const document = yield* Schema.decodeUnknownEffect(QueryDocumentSchema)({\n select: [q.sub(\"objects\", { ...subset, select: [] })],\n }).pipe(\n Effect.mapError(\n (cause) =>\n new BackendError({\n operation: \"subset.compile\",\n kind: \"InvalidRequest\",\n retryable: false,\n message: \"Invalid object subset.\",\n cause,\n })\n )\n );\n const selection = document.select[0]!;\n if (selection.kind !== \"sub\")\n return yield* new BackendError({\n operation: \"subset.compile\",\n kind: \"InvalidRequest\",\n retryable: false,\n message: \"Invalid object subset selection.\",\n });\n const decoded = selection.value.query;\n if (!decoded.from.source.objectType || decoded.from.source.related)\n return yield* new BackendError({\n operation: \"subset.compile\",\n kind: \"InvalidRequest\",\n retryable: false,\n message: \"An object subset requires an explicit object type.\",\n });\n subset = {\n ...decoded,\n from: {\n ...decoded.from,\n source: { ontology: decoded.from.source.ontology, objectType: decoded.from.source.objectType },\n },\n };\n const unsupported = () =>\n new BackendError({\n operation: \"subset.compile\",\n kind: \"NotImplemented\",\n retryable: false,\n message:\n \"This subset requires query-result demand; only exact object predicates and field ordering can be demanded directly.\",\n });\n const issues = yield* Effect.try({\n try: () => q.validateQueryDocument(ir, document),\n catch: (cause) =>\n new BackendError({\n operation: \"subset.compile\",\n kind: \"InvalidConfiguration\",\n retryable: false,\n message: \"Invalid ontology query environment.\",\n cause,\n }),\n });\n if (issues.length || subset.from.source.ontology)\n return yield* new BackendError({\n operation: \"subset.compile\",\n kind: \"InvalidRequest\",\n retryable: false,\n message: \"Invalid object subset.\",\n issues,\n });\n const reader = { ir, loadSubset: () => Effect.fail(unsupported()) };\n const executor = queryExecutor({ reader, context });\n let where;\n if (subset.where) {\n const lowered = yield* executor.lower(subset.where, subset.from, new Map());\n if (!lowered.exact) return yield* unsupported();\n where = lowered.where;\n }\n const orderBy = [];\n for (const order of subset.orderBy ?? []) {\n const e = order.expression;\n if (\n e.kind !== \"getAt\" ||\n e.value.source.kind !== \"localReference\" ||\n e.value.source.value.name !== subset.from.binding\n )\n return yield* unsupported();\n orderBy.push({\n field: { _tag: \"Field\" as const, path: e.value.path },\n direction: order.direction,\n nulls: order.nulls,\n });\n }\n const query = yield* Schema.decodeUnknownEffect(QuerySchema)({\n where,\n ...(orderBy.length ? { orderBy } : {}),\n ...subset.page,\n }).pipe(\n Effect.mapError(\n (cause) =>\n new BackendError({\n operation: \"subset.compile\",\n kind: \"InvalidRequest\",\n retryable: false,\n message: \"Invalid subset window or operands.\",\n cause,\n })\n )\n );\n return {\n objectType: subset.from.source.objectType,\n ...(Object.values(query).some((value) => value !== undefined) ? { query } : {}),\n };\n});\n\nexport { resolveSubsetSnapshot, coversSubset } from \"./fulfillment.js\";\n"],"mappings":";;;;;;;;;;AAiBA,MAAa,gBAAgB,YAAoB,OAAc,CAAC,GAAG,UAAU,UAAwB;CACjG,MAAM,WAAW,MACb,KAAK,OAAO,MAAM,YAAY,UAAU,KAAK,EAAE,SAAS,UAClD,EAAE,MAAM,SAAS,GAAI,EAAY,IAAI,IACrC,EAAE,QAAQ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AAI,OAAO,OAAO;EACd,MAAM,UAAU,OAAO,SAAS,MAAM,OAAO,OAAO,OAAO,sBAAM,IAAI,IAAI,CAAC;EAC1E,IAAI,CAAC,QAAQ,OAAO,OAAO,OAAO,YAAY;EAC9C,QAAQ,QAAQ;CACpB;CACA,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,SAAS,OAAO,WAAW,CAAC,GAAG;EACtC,MAAM,IAAI,MAAM;EAChB,IACI,EAAE,SAAS,WACX,EAAE,MAAM,OAAO,SAAS,oBACxB,EAAE,MAAM,OAAO,MAAM,SAAS,OAAO,KAAK,SAE1C,OAAO,OAAO,YAAY;EAC9B,QAAQ,KAAK;GACT,OAAO;IAAE,MAAM;IAAkB,MAAM,EAAE,MAAM;GAAK;GACpD,WAAW,MAAM;GACjB,OAAO,MAAM;EACjB,CAAC;CACL;CACA,MAAM,QAAQ,OAAO,OAAO,oBAAoB,WAAW,CAAC,CAAC;EACzD;EACA,GAAI,QAAQ,SAAS,EAAE,QAAQ,IAAI,CAAC;EACpC,GAAG,OAAO;CACd,CAAC,CAAC,CAAC,KACC,OAAO,UACF,UACG,IAAI,aAAa;EACb,WAAW;EACX,MAAM;EACN,WAAW;EACX,SAAS;EACT;CACJ,CAAC,CACT,CACJ;CACA,OAAO;EACH,YAAY,OAAO,KAAK,OAAO;EAC/B,GAAI,OAAO,OAAO,KAAK,CAAC,CAAC,MAAM,UAAU,UAAU,KAAA,CAAS,IAAI,EAAE,MAAM,IAAI,CAAC;CACjF;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ObjectSubset } from "@party-stack/ontology-spec/query";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region src/subsetSchema.d.ts
|
|
4
|
+
/** Portable provider input. Full selections are rejected instead of silently discarded. */
|
|
5
|
+
export declare const ObjectSubsetSchema: Schema.declare<ObjectSubset, ObjectSubset>;
|
|
6
|
+
export declare const ObjectSelectionSchema: Schema.Struct<{
|
|
7
|
+
readonly subsets: Schema.$Array<Schema.declare<ObjectSubset, ObjectSubset>>;
|
|
8
|
+
}>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=subsetSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subsetSchema.d.ts","names":[],"sources":["../src/subsetSchema.ts"],"mappings":";;;;qBAKa,oBAAkB,OAAA,QAAA,cAAA;qBAalB,uBAAqB,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Predicate, Schema } from "effect";
|
|
2
|
+
import { QueryDocumentSchema } from "@party-stack/ontology-spec/effect";
|
|
3
|
+
//#region src/subsetSchema.ts
|
|
4
|
+
/** Portable provider input. Full selections are rejected instead of silently discarded. */
|
|
5
|
+
const ObjectSubsetSchema = Schema.declare((input) => Predicate.isObject(input) && !Object.hasOwn(input, "select") && Schema.is(QueryDocumentSchema)({ select: [{
|
|
6
|
+
kind: "sub",
|
|
7
|
+
value: {
|
|
8
|
+
name: "objects",
|
|
9
|
+
cardinality: "many",
|
|
10
|
+
query: {
|
|
11
|
+
...input,
|
|
12
|
+
select: []
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}] }));
|
|
16
|
+
const ObjectSelectionSchema = Schema.Struct({ subsets: Schema.Array(ObjectSubsetSchema) });
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ObjectSelectionSchema, ObjectSubsetSchema };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=subsetSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subsetSchema.js","names":["EffectPredicate"],"sources":["../src/subsetSchema.ts"],"sourcesContent":["import { QueryDocumentSchema } from \"@party-stack/ontology-spec/effect\";\nimport { Predicate as EffectPredicate, Schema } from \"effect\";\nimport type { ObjectSubset } from \"@party-stack/ontology-spec/query\";\n\n/** Portable provider input. Full selections are rejected instead of silently discarded. */\nexport const ObjectSubsetSchema = Schema.declare<ObjectSubset>(\n (input): input is ObjectSubset =>\n EffectPredicate.isObject(input) &&\n !Object.hasOwn(input, \"select\") &&\n Schema.is(QueryDocumentSchema)({\n select: [\n {\n kind: \"sub\",\n value: { name: \"objects\", cardinality: \"many\", query: { ...input, select: [] } },\n },\n ],\n })\n);\nexport const ObjectSelectionSchema = Schema.Struct({ subsets: Schema.Array(ObjectSubsetSchema) });\n"],"mappings":";;;;AAKA,MAAa,qBAAqB,OAAO,SACpC,UACGA,UAAgB,SAAS,KAAK,KAC9B,CAAC,OAAO,OAAO,OAAO,QAAQ,KAC9B,OAAO,GAAG,mBAAmB,CAAC,CAAC,EAC3B,QAAQ,CACJ;CACI,MAAM;CACN,OAAO;EAAE,MAAM;EAAW,aAAa;EAAQ,OAAO;GAAE,GAAG;GAAO,QAAQ,CAAC;EAAE;CAAE;AACnF,CACJ,EACJ,CAAC,CACT;AACA,MAAa,wBAAwB,OAAO,OAAO,EAAE,SAAS,OAAO,MAAM,kBAAkB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@party-stack/ontology-backend",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"files": [
|
|
5
|
+
"lib"
|
|
6
|
+
],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./clients": {
|
|
14
|
+
"types": "./lib/clients.d.ts",
|
|
15
|
+
"default": "./lib/clients.js"
|
|
16
|
+
},
|
|
17
|
+
"./protocol": {
|
|
18
|
+
"types": "./lib/protocol.d.ts",
|
|
19
|
+
"default": "./lib/protocol.js"
|
|
20
|
+
},
|
|
21
|
+
"./description": {
|
|
22
|
+
"types": "./lib/description.d.ts",
|
|
23
|
+
"default": "./lib/description.js"
|
|
24
|
+
},
|
|
25
|
+
"./delivery": {
|
|
26
|
+
"types": "./lib/delivery.d.ts",
|
|
27
|
+
"default": "./lib/delivery.js"
|
|
28
|
+
},
|
|
29
|
+
"./owned": {
|
|
30
|
+
"types": "./lib/owned.d.ts",
|
|
31
|
+
"default": "./lib/owned.js"
|
|
32
|
+
},
|
|
33
|
+
"./query": {
|
|
34
|
+
"types": "./lib/query.d.ts",
|
|
35
|
+
"default": "./lib/query.js"
|
|
36
|
+
},
|
|
37
|
+
"./policy": {
|
|
38
|
+
"types": "./lib/policy.d.ts",
|
|
39
|
+
"default": "./lib/policy.js"
|
|
40
|
+
},
|
|
41
|
+
"./actions": {
|
|
42
|
+
"types": "./lib/actions.d.ts",
|
|
43
|
+
"default": "./lib/actions.js"
|
|
44
|
+
},
|
|
45
|
+
"./subset": {
|
|
46
|
+
"types": "./lib/subset.d.ts",
|
|
47
|
+
"default": "./lib/subset.js"
|
|
48
|
+
},
|
|
49
|
+
"./storage": {
|
|
50
|
+
"types": "./lib/storage.d.ts",
|
|
51
|
+
"default": "./lib/storage.js"
|
|
52
|
+
},
|
|
53
|
+
"./meta": {
|
|
54
|
+
"types": "./lib/meta.d.ts",
|
|
55
|
+
"default": "./lib/meta.js"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"temporal-polyfill": "^0.3.0",
|
|
60
|
+
"@party-stack/ontology-spec": "0.3.0",
|
|
61
|
+
"@party-stack/ontology-storage": "0.2.1"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@effect/vitest": "^4.0.5",
|
|
65
|
+
"effect": "^4.0.5",
|
|
66
|
+
"typescript": "~7.0.2",
|
|
67
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.2.0",
|
|
68
|
+
"vite-plus": "1.2.0",
|
|
69
|
+
"vitest": "5.0.4",
|
|
70
|
+
"@party-stack/build-config": "0.2.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"effect": "^4.0.5"
|
|
74
|
+
}
|
|
6
75
|
}
|