@frontal-labs/ontology 0.0.1 → 1.0.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/dist/keys.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare const env: Readonly<{
2
- FRONTAL_API_URL?: string | undefined;
3
- FRONTAL_API_KEY?: string | undefined;
4
- NODE_ENV: "production" | "development" | "test";
5
- }>;
6
- //# sourceMappingURL=keys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG;;;;EAyBd,CAAC"}
package/dist/service.d.ts DELETED
@@ -1,139 +0,0 @@
1
- import { type HttpClient, type PageResult } from "@frontal-labs/core";
2
- import type { z } from "zod";
3
- import * as S from "./schemas";
4
- export declare class OntologyService {
5
- private readonly http;
6
- constructor(http: HttpClient);
7
- use(name: string): ModelAccessor;
8
- list(opts?: {
9
- status?: z.infer<typeof S.ModelSchema>["status"];
10
- substrate?: string;
11
- limit?: number;
12
- cursor?: string;
13
- }): Promise<PageResult<S.Model>>;
14
- create(definition: S.ModelDefinition): Promise<S.Model>;
15
- validate(definition: S.ModelDefinition): Promise<{
16
- valid: boolean;
17
- errors?: unknown[];
18
- warnings?: unknown[];
19
- }>;
20
- checkIntegrity(): Promise<{
21
- valid: boolean;
22
- violations?: unknown[];
23
- }>;
24
- readonly migrations: MigrationsNamespace;
25
- readonly rules: RulesNamespace;
26
- readonly mixins: MixinsNamespace;
27
- readonly generation: GenerationNamespace;
28
- }
29
- export declare class ModelAccessor {
30
- readonly _name: string;
31
- private readonly http;
32
- constructor(_name: string, http: HttpClient);
33
- get(version?: number): Promise<S.Model>;
34
- update(definition: Partial<S.ModelDefinition>): Promise<S.Model>;
35
- delete(force?: boolean): Promise<void>;
36
- relationships(): Promise<{
37
- data: S.RelationshipDefinition[];
38
- }>;
39
- addRelationship(definition: S.RelationshipDefinition): Promise<S.RelationshipDefinition>;
40
- removeRelationship(relationshipId: string): Promise<void>;
41
- validateData(): Promise<{
42
- entityType: string;
43
- totalChecked: number;
44
- violations: unknown[];
45
- }>;
46
- versions(): Promise<{
47
- data: Array<{
48
- version: number;
49
- createdAt: string;
50
- changedBy: string;
51
- changesSummary: string;
52
- migrationId?: string;
53
- }>;
54
- }>;
55
- }
56
- export declare class MigrationsNamespace {
57
- private readonly http;
58
- constructor(http: HttpClient);
59
- plan(request: {
60
- modelId?: string;
61
- changes?: S.ModelDefinition[];
62
- }): Promise<S.MigrationPlan>;
63
- apply(planId: string, strategy?: string): Promise<{
64
- id: string;
65
- status: string;
66
- appliedAt: string;
67
- }>;
68
- rollback(_migrationId: string): Promise<{
69
- id: string;
70
- status: string;
71
- rolledBackAt: string;
72
- }>;
73
- history(opts?: {
74
- limit?: number;
75
- cursor?: string;
76
- }): Promise<PageResult<{
77
- id: string;
78
- modelId: string;
79
- fromVersion: number;
80
- toVersion: number;
81
- status: string;
82
- createdAt: string;
83
- }>>;
84
- }
85
- export declare class RulesNamespace {
86
- private readonly http;
87
- constructor(http: HttpClient);
88
- list(): Promise<{
89
- data: S.RuleDefinition[];
90
- }>;
91
- create(definition: S.RuleDefinition): Promise<S.RuleDefinition>;
92
- update(_ruleId: string, definition: Partial<S.RuleDefinition>): Promise<S.RuleDefinition>;
93
- delete(ruleId: string): Promise<void>;
94
- evaluate(opts: {
95
- entityType?: string;
96
- ruleIds?: string[];
97
- sample?: number;
98
- }): Promise<{
99
- results: unknown[];
100
- summary: unknown;
101
- }>;
102
- }
103
- export declare class MixinsNamespace {
104
- private readonly http;
105
- constructor(http: HttpClient);
106
- list(): Promise<{
107
- data: S.MixinDefinition[];
108
- }>;
109
- create(definition: S.MixinDefinition): Promise<S.MixinDefinition>;
110
- }
111
- export declare class GenerationNamespace {
112
- private readonly http;
113
- constructor(http: HttpClient);
114
- generate(description: string, opts: {
115
- context?: {
116
- existingModels?: string[];
117
- };
118
- substrates?: string[];
119
- }): Promise<{
120
- proposal: S.ModelDefinition;
121
- confidence: number;
122
- reasoning: string;
123
- }>;
124
- infer(opts: {
125
- substrates?: string[];
126
- confidence?: "low" | "medium" | "high";
127
- merge?: boolean;
128
- }): Promise<{
129
- proposals: unknown[];
130
- }>;
131
- suggestions(opts?: {
132
- status?: "pending" | "accepted" | "rejected";
133
- }): Promise<{
134
- data: unknown[];
135
- }>;
136
- acceptSuggestion(_suggestionId: string): Promise<unknown>;
137
- rejectSuggestion(_suggestionId: string, reason?: string): Promise<unknown>;
138
- }
139
- //# sourceMappingURL=service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAe/B,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa;IAI1B,IAAI,CACR,IAAI,GAAE;QACJ,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;QACjD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACZ,GACL,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAOzB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAKvD,QAAQ,CACZ,UAAU,EAAE,CAAC,CAAC,eAAe,GAC5B,OAAO,CAAC;QAAE,KAAK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,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAOI,KAAK,CAAC,IAAI,EAAE;QAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;QACvC,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAI/B,WAAW,CACf,IAAI,GAAE;QAAE,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAA;KAAO,GAC1D,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAIzB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIzD,gBAAgB,CACpB,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;CAKpB"}
package/src/keys.ts DELETED
@@ -1,29 +0,0 @@
1
- import { createEnv } from "@t3-oss/env-core";
2
- import { z } from "zod";
3
-
4
- export const env = createEnv({
5
- server: {
6
- NODE_ENV: z
7
- .enum(["development", "test", "production"])
8
- .default("development"),
9
- FRONTAL_API_URL: z
10
- .url()
11
- .optional()
12
- .refine((val) => !(process.env.NODE_ENV === "production") || !!val, {
13
- message: "FRONTAL_API_URL is required in production",
14
- }),
15
- FRONTAL_API_KEY: z
16
- .string()
17
- .min(1)
18
- .optional()
19
- .refine((val) => !(process.env.NODE_ENV === "production") || !!val, {
20
- message: "FRONTAL_API_KEY is required in production",
21
- }),
22
- },
23
- runtimeEnv: {
24
- NODE_ENV: process.env.NODE_ENV,
25
- FRONTAL_API_URL: process.env.FRONTAL_API_URL,
26
- FRONTAL_API_KEY: process.env.FRONTAL_API_KEY,
27
- },
28
- emptyStringAsUndefined: true,
29
- });
package/src/service.ts DELETED
@@ -1,269 +0,0 @@
1
- import {
2
- createPageResult,
3
- type HttpClient,
4
- type PageResult,
5
- type PaginationMeta,
6
- } from "@frontal-labs/core";
7
- import type { z } from "zod";
8
- import * as S from "./schemas";
9
-
10
- const asPagePayload = <T>(
11
- raw: unknown
12
- ): {
13
- data: T[];
14
- pagination: PaginationMeta;
15
- meta?: unknown;
16
- } =>
17
- raw as {
18
- data: T[];
19
- pagination: PaginationMeta;
20
- meta?: unknown;
21
- };
22
-
23
- export class OntologyService {
24
- constructor(private readonly http: HttpClient) {}
25
-
26
- use(name: string): ModelAccessor {
27
- return new ModelAccessor(name, this.http);
28
- }
29
-
30
- async list(
31
- opts: {
32
- status?: z.infer<typeof S.ModelSchema>["status"];
33
- substrate?: string;
34
- limit?: number;
35
- cursor?: string;
36
- } = {}
37
- ): Promise<PageResult<S.Model>> {
38
- const raw = await this.http.get("/ontology/engine/runs", opts);
39
- return createPageResult(asPagePayload<S.Model>(raw), (cursor) =>
40
- this.list({ ...opts, cursor })
41
- );
42
- }
43
-
44
- async create(definition: S.ModelDefinition): Promise<S.Model> {
45
- const body = S.ModelDefinitionSchema.parse(definition);
46
- return this.http.post("/ontology/engine/runs", body);
47
- }
48
-
49
- async validate(
50
- definition: S.ModelDefinition
51
- ): Promise<{ valid: boolean; errors?: unknown[]; warnings?: unknown[] }> {
52
- const body = S.ModelDefinitionSchema.parse(definition);
53
- return this.http.post("/ontology/engine/ontologies/validate", body);
54
- }
55
-
56
- async checkIntegrity(): Promise<{ valid: boolean; violations?: unknown[] }> {
57
- return this.http.get("/ontology/engine/health");
58
- }
59
-
60
- readonly migrations = new MigrationsNamespace(this.http);
61
- readonly rules = new RulesNamespace(this.http);
62
- readonly mixins = new MixinsNamespace(this.http);
63
- readonly generation = new GenerationNamespace(this.http);
64
- }
65
-
66
- export class ModelAccessor {
67
- constructor(
68
- readonly _name: string,
69
- private readonly http: HttpClient
70
- ) {}
71
-
72
- async get(version?: number): Promise<S.Model> {
73
- const params = version ? { version } : undefined;
74
- return this.http.get("/ontology/engine/runs", params);
75
- }
76
-
77
- async update(definition: Partial<S.ModelDefinition>): Promise<S.Model> {
78
- return this.http.post("/ontology/engine/runs", definition);
79
- }
80
-
81
- async delete(force = false): Promise<void> {
82
- return this.http.post("/ontology/engine/runs", {
83
- action: "delete-model",
84
- force,
85
- });
86
- }
87
-
88
- async relationships(): Promise<{ data: S.RelationshipDefinition[] }> {
89
- return this.http.get("/ontology/engine/runs");
90
- }
91
-
92
- async addRelationship(
93
- definition: S.RelationshipDefinition
94
- ): Promise<S.RelationshipDefinition> {
95
- const body = S.RelationshipDefinitionSchema.parse(definition);
96
- return this.http.post("/ontology/engine/runs", body);
97
- }
98
-
99
- async removeRelationship(relationshipId: string): Promise<void> {
100
- return this.http.post("/ontology/engine/runs", {
101
- action: "delete-relationship",
102
- relationshipId,
103
- });
104
- }
105
-
106
- async validateData(): Promise<{
107
- entityType: string;
108
- totalChecked: number;
109
- violations: unknown[];
110
- }> {
111
- return this.http.post("/ontology/engine/ontologies/validate");
112
- }
113
-
114
- async versions(): Promise<{
115
- data: Array<{
116
- version: number;
117
- createdAt: string;
118
- changedBy: string;
119
- changesSummary: string;
120
- migrationId?: string;
121
- }>;
122
- }> {
123
- return this.http.get("/ontology/engine/runs");
124
- }
125
- }
126
-
127
- export class MigrationsNamespace {
128
- constructor(private readonly http: HttpClient) {}
129
-
130
- async plan(request: {
131
- modelId?: string;
132
- changes?: S.ModelDefinition[];
133
- }): Promise<S.MigrationPlan> {
134
- return this.http.post(
135
- "/ontology/engine/ontologies/compare-versions",
136
- request
137
- );
138
- }
139
-
140
- async apply(
141
- planId: string,
142
- strategy = "zero-downtime"
143
- ): Promise<{ id: string; status: string; appliedAt: string }> {
144
- return this.http.post("/ontology/engine/runs", { planId, strategy });
145
- }
146
-
147
- async rollback(
148
- _migrationId: string
149
- ): Promise<{ id: string; status: string; rolledBackAt: string }> {
150
- return this.http.post("/ontology/engine/runs");
151
- }
152
-
153
- async history(opts: { limit?: number; cursor?: string } = {}): Promise<
154
- PageResult<{
155
- id: string;
156
- modelId: string;
157
- fromVersion: number;
158
- toVersion: number;
159
- status: string;
160
- createdAt: string;
161
- }>
162
- > {
163
- const raw = await this.http.get("/ontology/engine/runs", opts);
164
- return createPageResult(
165
- asPagePayload<{
166
- id: string;
167
- modelId: string;
168
- fromVersion: number;
169
- toVersion: number;
170
- status: string;
171
- createdAt: string;
172
- }>(raw),
173
- (cursor) => this.history({ ...opts, cursor })
174
- );
175
- }
176
- }
177
-
178
- export class RulesNamespace {
179
- constructor(private readonly http: HttpClient) {}
180
-
181
- async list(): Promise<{ data: S.RuleDefinition[] }> {
182
- return this.http.get("/ontology/engine/runs");
183
- }
184
-
185
- async create(definition: S.RuleDefinition): Promise<S.RuleDefinition> {
186
- const body = S.RuleDefinitionSchema.parse(definition);
187
- return this.http.post("/ontology/engine/runs", body);
188
- }
189
-
190
- async update(
191
- _ruleId: string,
192
- definition: Partial<S.RuleDefinition>
193
- ): Promise<S.RuleDefinition> {
194
- return this.http.post("/ontology/engine/runs", definition);
195
- }
196
-
197
- async delete(ruleId: string): Promise<void> {
198
- return this.http.post("/ontology/engine/runs", {
199
- action: "delete-rule",
200
- ruleId,
201
- });
202
- }
203
-
204
- async evaluate(opts: {
205
- entityType?: string;
206
- ruleIds?: string[];
207
- sample?: number;
208
- }): Promise<{ results: unknown[]; summary: unknown }> {
209
- return this.http.post("/ontology/engine/ontologies/validate", opts);
210
- }
211
- }
212
-
213
- export class MixinsNamespace {
214
- constructor(private readonly http: HttpClient) {}
215
-
216
- async list(): Promise<{ data: S.MixinDefinition[] }> {
217
- return this.http.get("/ontology/engine/runs");
218
- }
219
-
220
- async create(definition: S.MixinDefinition): Promise<S.MixinDefinition> {
221
- const body = S.MixinDefinitionSchema.parse(definition);
222
- return this.http.post("/ontology/engine/runs", body);
223
- }
224
- }
225
-
226
- export class GenerationNamespace {
227
- constructor(private readonly http: HttpClient) {}
228
-
229
- async generate(
230
- description: string,
231
- opts: { context?: { existingModels?: string[] }; substrates?: string[] }
232
- ): Promise<{
233
- proposal: S.ModelDefinition;
234
- confidence: number;
235
- reasoning: string;
236
- }> {
237
- return this.http.post("/ontology/engine/ontologies/generate", {
238
- description,
239
- ...opts,
240
- });
241
- }
242
-
243
- async infer(opts: {
244
- substrates?: string[];
245
- confidence?: "low" | "medium" | "high";
246
- merge?: boolean;
247
- }): Promise<{ proposals: unknown[] }> {
248
- return this.http.post("/ontology/engine/ontologies/infer-classes", opts);
249
- }
250
-
251
- async suggestions(
252
- opts: { status?: "pending" | "accepted" | "rejected" } = {}
253
- ): Promise<{ data: unknown[] }> {
254
- return this.http.get("/ontology/engine/runs", opts);
255
- }
256
-
257
- async acceptSuggestion(_suggestionId: string): Promise<unknown> {
258
- return this.http.post("/ontology/engine/runs");
259
- }
260
-
261
- async rejectSuggestion(
262
- _suggestionId: string,
263
- reason?: string
264
- ): Promise<unknown> {
265
- return this.http.post("/ontology/engine/runs", {
266
- reason,
267
- });
268
- }
269
- }