@semiont/core 0.1.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.
Files changed (95) hide show
  1. package/README.md +265 -0
  2. package/dist/annotation-history-utils.d.ts +42 -0
  3. package/dist/annotation-history-utils.d.ts.map +1 -0
  4. package/dist/annotation-history-utils.js +258 -0
  5. package/dist/annotation-history-utils.js.map +1 -0
  6. package/dist/annotation-types.d.ts +15 -0
  7. package/dist/annotation-types.d.ts.map +1 -0
  8. package/dist/annotation-types.js +6 -0
  9. package/dist/annotation-types.js.map +1 -0
  10. package/dist/annotation-utils.d.ts +18 -0
  11. package/dist/annotation-utils.d.ts.map +1 -0
  12. package/dist/annotation-utils.js +70 -0
  13. package/dist/annotation-utils.js.map +1 -0
  14. package/dist/auth-types.d.ts +8 -0
  15. package/dist/auth-types.d.ts.map +1 -0
  16. package/dist/auth-types.js +6 -0
  17. package/dist/auth-types.js.map +1 -0
  18. package/dist/config/config-validator.d.ts +25 -0
  19. package/dist/config/config-validator.d.ts.map +1 -0
  20. package/dist/config/config-validator.js +112 -0
  21. package/dist/config/config-validator.js.map +1 -0
  22. package/dist/config/config.schema.json +678 -0
  23. package/dist/config/config.types.d.ts +574 -0
  24. package/dist/config/config.types.d.ts.map +1 -0
  25. package/dist/config/config.types.js +4 -0
  26. package/dist/config/config.types.js.map +1 -0
  27. package/dist/config/configuration-error.d.ts +17 -0
  28. package/dist/config/configuration-error.d.ts.map +1 -0
  29. package/dist/config/configuration-error.js +36 -0
  30. package/dist/config/configuration-error.js.map +1 -0
  31. package/dist/config/environment-loader.d.ts +98 -0
  32. package/dist/config/environment-loader.d.ts.map +1 -0
  33. package/dist/config/environment-loader.js +229 -0
  34. package/dist/config/environment-loader.js.map +1 -0
  35. package/dist/config/environment-validator.d.ts +22 -0
  36. package/dist/config/environment-validator.d.ts.map +1 -0
  37. package/dist/config/environment-validator.js +50 -0
  38. package/dist/config/environment-validator.js.map +1 -0
  39. package/dist/config/platform-types.d.ts +26 -0
  40. package/dist/config/platform-types.d.ts.map +1 -0
  41. package/dist/config/platform-types.js +28 -0
  42. package/dist/config/platform-types.js.map +1 -0
  43. package/dist/config/project-discovery.d.ts +35 -0
  44. package/dist/config/project-discovery.d.ts.map +1 -0
  45. package/dist/config/project-discovery.js +99 -0
  46. package/dist/config/project-discovery.js.map +1 -0
  47. package/dist/config/validate-config.d.ts +56 -0
  48. package/dist/config/validate-config.d.ts.map +1 -0
  49. package/dist/config/validate-config.js +114 -0
  50. package/dist/config/validate-config.js.map +1 -0
  51. package/dist/creation-methods.d.ts +19 -0
  52. package/dist/creation-methods.d.ts.map +1 -0
  53. package/dist/creation-methods.js +18 -0
  54. package/dist/creation-methods.js.map +1 -0
  55. package/dist/crypto.d.ts +32 -0
  56. package/dist/crypto.d.ts.map +1 -0
  57. package/dist/crypto.js +52 -0
  58. package/dist/crypto.js.map +1 -0
  59. package/dist/did-utils.d.ts +51 -0
  60. package/dist/did-utils.d.ts.map +1 -0
  61. package/dist/did-utils.js +62 -0
  62. package/dist/did-utils.js.map +1 -0
  63. package/dist/errors.d.ts +51 -0
  64. package/dist/errors.d.ts.map +1 -0
  65. package/dist/errors.js +89 -0
  66. package/dist/errors.js.map +1 -0
  67. package/dist/events.d.ts +223 -0
  68. package/dist/events.d.ts.map +1 -0
  69. package/dist/events.js +45 -0
  70. package/dist/events.js.map +1 -0
  71. package/dist/graph.d.ts +31 -0
  72. package/dist/graph.d.ts.map +1 -0
  73. package/dist/graph.js +6 -0
  74. package/dist/graph.js.map +1 -0
  75. package/dist/http-client.d.ts +32 -0
  76. package/dist/http-client.d.ts.map +1 -0
  77. package/dist/http-client.js +56 -0
  78. package/dist/http-client.js.map +1 -0
  79. package/dist/identifiers.d.ts +24 -0
  80. package/dist/identifiers.d.ts.map +1 -0
  81. package/dist/identifiers.js +40 -0
  82. package/dist/identifiers.js.map +1 -0
  83. package/dist/index.d.ts +33 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/index.js +80 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/resource-types.d.ts +15 -0
  88. package/dist/resource-types.d.ts.map +1 -0
  89. package/dist/resource-types.js +6 -0
  90. package/dist/resource-types.js.map +1 -0
  91. package/dist/type-guards.d.ts +44 -0
  92. package/dist/type-guards.d.ts.map +1 -0
  93. package/dist/type-guards.js +76 -0
  94. package/dist/type-guards.js.map +1 -0
  95. package/package.json +49 -0
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Resource Event Types
3
+ *
4
+ * Event-sourced architecture for resource state management
5
+ * Events are stored in an append-only log (JSONL format)
6
+ *
7
+ * Federation-ready design:
8
+ * - resourceId uses content hashes (doc-sha256:...)
9
+ * - userId uses DID format (did:web:org.com:users:alice)
10
+ * - prevEventHash creates tamper-evident chains
11
+ * - Optional signatures for cross-org verification
12
+ */
13
+ import type { CreationMethod } from './creation-methods';
14
+ import type { components, AnnotationUri, JobId } from '@semiont/api-client';
15
+ import type { ResourceId, AnnotationId, UserId } from './identifiers';
16
+ type Annotation = components['schemas']['Annotation'];
17
+ type ContentFormat = components['schemas']['ContentFormat'];
18
+ export interface BaseEvent {
19
+ id: string;
20
+ timestamp: string;
21
+ resourceId?: ResourceId;
22
+ userId: UserId;
23
+ version: number;
24
+ }
25
+ export interface ResourceCreatedEvent extends BaseEvent {
26
+ type: 'resource.created';
27
+ payload: {
28
+ name: string;
29
+ format: ContentFormat;
30
+ contentChecksum: string;
31
+ contentByteSize?: number;
32
+ creationMethod: CreationMethod;
33
+ entityTypes?: string[];
34
+ language?: string;
35
+ isDraft?: boolean;
36
+ generatedFrom?: string;
37
+ generationPrompt?: string;
38
+ };
39
+ }
40
+ export interface ResourceClonedEvent extends BaseEvent {
41
+ type: 'resource.cloned';
42
+ payload: {
43
+ name: string;
44
+ format: ContentFormat;
45
+ contentChecksum: string;
46
+ contentByteSize?: number;
47
+ parentResourceId: string;
48
+ creationMethod: CreationMethod;
49
+ entityTypes?: string[];
50
+ language?: string;
51
+ };
52
+ }
53
+ export interface ResourceArchivedEvent extends BaseEvent {
54
+ type: 'resource.archived';
55
+ payload: {
56
+ reason?: string;
57
+ };
58
+ }
59
+ export interface ResourceUnarchivedEvent extends BaseEvent {
60
+ type: 'resource.unarchived';
61
+ payload: Record<string, never>;
62
+ }
63
+ export interface AnnotationAddedEvent extends BaseEvent {
64
+ type: 'annotation.added';
65
+ payload: {
66
+ annotation: Omit<Annotation, 'creator' | 'created'>;
67
+ };
68
+ }
69
+ export interface AnnotationRemovedEvent extends BaseEvent {
70
+ type: 'annotation.removed';
71
+ payload: {
72
+ annotationId: AnnotationId;
73
+ };
74
+ }
75
+ export type BodyItem = {
76
+ type: 'TextualBody';
77
+ value: string;
78
+ purpose: 'tagging' | 'commenting' | 'describing' | 'classifying';
79
+ format?: string;
80
+ language?: string;
81
+ } | {
82
+ type: 'SpecificResource';
83
+ source: string;
84
+ purpose: 'linking';
85
+ };
86
+ export type BodyOperation = {
87
+ op: 'add';
88
+ item: BodyItem;
89
+ } | {
90
+ op: 'remove';
91
+ item: BodyItem;
92
+ } | {
93
+ op: 'replace';
94
+ oldItem: BodyItem;
95
+ newItem: BodyItem;
96
+ };
97
+ export interface AnnotationBodyUpdatedEvent extends BaseEvent {
98
+ type: 'annotation.body.updated';
99
+ payload: {
100
+ annotationId: AnnotationId;
101
+ operations: BodyOperation[];
102
+ };
103
+ }
104
+ export interface JobStartedEvent extends BaseEvent {
105
+ type: 'job.started';
106
+ resourceId: ResourceId;
107
+ payload: {
108
+ jobId: JobId;
109
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
110
+ totalSteps?: number;
111
+ };
112
+ }
113
+ export interface JobProgressEvent extends BaseEvent {
114
+ type: 'job.progress';
115
+ resourceId: ResourceId;
116
+ payload: {
117
+ jobId: JobId;
118
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
119
+ percentage: number;
120
+ currentStep?: string;
121
+ processedSteps?: number;
122
+ totalSteps?: number;
123
+ foundCount?: number;
124
+ message?: string;
125
+ progress?: any;
126
+ };
127
+ }
128
+ export interface JobCompletedEvent extends BaseEvent {
129
+ type: 'job.completed';
130
+ resourceId: ResourceId;
131
+ payload: {
132
+ jobId: JobId;
133
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
134
+ totalSteps?: number;
135
+ foundCount?: number;
136
+ resultResourceId?: ResourceId;
137
+ annotationUri?: AnnotationUri;
138
+ message?: string;
139
+ result?: any;
140
+ };
141
+ }
142
+ export interface JobFailedEvent extends BaseEvent {
143
+ type: 'job.failed';
144
+ resourceId: ResourceId;
145
+ payload: {
146
+ jobId: JobId;
147
+ jobType: 'detection' | 'generation' | 'highlight-detection' | 'assessment-detection' | 'comment-detection' | 'tag-detection';
148
+ error: string;
149
+ details?: string;
150
+ };
151
+ }
152
+ export interface EntityTagAddedEvent extends BaseEvent {
153
+ type: 'entitytag.added';
154
+ resourceId: ResourceId;
155
+ payload: {
156
+ entityType: string;
157
+ };
158
+ }
159
+ export interface EntityTagRemovedEvent extends BaseEvent {
160
+ type: 'entitytag.removed';
161
+ resourceId: ResourceId;
162
+ payload: {
163
+ entityType: string;
164
+ };
165
+ }
166
+ export interface EntityTypeAddedEvent extends BaseEvent {
167
+ type: 'entitytype.added';
168
+ resourceId?: undefined;
169
+ payload: {
170
+ entityType: string;
171
+ };
172
+ }
173
+ export type ResourceEvent = ResourceCreatedEvent | ResourceClonedEvent | ResourceArchivedEvent | ResourceUnarchivedEvent | AnnotationAddedEvent | AnnotationRemovedEvent | AnnotationBodyUpdatedEvent | JobStartedEvent | JobProgressEvent | JobCompletedEvent | JobFailedEvent | EntityTagAddedEvent | EntityTagRemovedEvent | EntityTypeAddedEvent;
174
+ export type ResourceEventType = ResourceEvent['type'];
175
+ export type SystemEvent = EntityTypeAddedEvent;
176
+ export type ResourceScopedEvent = Exclude<ResourceEvent, SystemEvent>;
177
+ export declare function isResourceEvent(event: any): event is ResourceEvent;
178
+ /**
179
+ * Type guard: Check if event is system-level (no resourceId)
180
+ * System events affect global state, not individual resources
181
+ */
182
+ export declare function isSystemEvent(event: ResourceEvent): event is SystemEvent;
183
+ /**
184
+ * Type guard: Check if event is resource-scoped (has resourceId)
185
+ * Resource events affect a specific resource's state
186
+ */
187
+ export declare function isResourceScopedEvent(event: ResourceEvent): event is ResourceScopedEvent;
188
+ export declare function getEventType<T extends ResourceEvent>(event: ResourceEvent): T['type'];
189
+ export interface EventMetadata {
190
+ sequenceNumber: number;
191
+ streamPosition: number;
192
+ timestamp: string;
193
+ prevEventHash?: string;
194
+ checksum?: string;
195
+ }
196
+ export interface EventSignature {
197
+ algorithm: 'ed25519';
198
+ publicKey: string;
199
+ signature: string;
200
+ keyId?: string;
201
+ }
202
+ export interface StoredEvent<T extends ResourceEvent = ResourceEvent> {
203
+ event: T;
204
+ metadata: EventMetadata;
205
+ signature?: EventSignature;
206
+ }
207
+ export interface EventQuery {
208
+ resourceId?: ResourceId;
209
+ userId?: string;
210
+ eventTypes?: ResourceEvent['type'][];
211
+ fromTimestamp?: string;
212
+ toTimestamp?: string;
213
+ fromSequence?: number;
214
+ limit?: number;
215
+ }
216
+ export interface ResourceAnnotations {
217
+ resourceId: ResourceId;
218
+ annotations: Annotation[];
219
+ version: number;
220
+ updatedAt: string;
221
+ }
222
+ export {};
223
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGtE,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AC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/events.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /**
3
+ * Resource Event Types
4
+ *
5
+ * Event-sourced architecture for resource state management
6
+ * Events are stored in an append-only log (JSONL format)
7
+ *
8
+ * Federation-ready design:
9
+ * - resourceId uses content hashes (doc-sha256:...)
10
+ * - userId uses DID format (did:web:org.com:users:alice)
11
+ * - prevEventHash creates tamper-evident chains
12
+ * - Optional signatures for cross-org verification
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.isResourceEvent = isResourceEvent;
16
+ exports.isSystemEvent = isSystemEvent;
17
+ exports.isResourceScopedEvent = isResourceScopedEvent;
18
+ exports.getEventType = getEventType;
19
+ // Type guards
20
+ function isResourceEvent(event) {
21
+ return event &&
22
+ typeof event.id === 'string' &&
23
+ typeof event.timestamp === 'string' &&
24
+ (event.resourceId === undefined || typeof event.resourceId === 'string') && // resourceId now optional
25
+ typeof event.type === 'string' &&
26
+ event.type.includes('.');
27
+ }
28
+ /**
29
+ * Type guard: Check if event is system-level (no resourceId)
30
+ * System events affect global state, not individual resources
31
+ */
32
+ function isSystemEvent(event) {
33
+ return event.type === 'entitytype.added';
34
+ }
35
+ /**
36
+ * Type guard: Check if event is resource-scoped (has resourceId)
37
+ * Resource events affect a specific resource's state
38
+ */
39
+ function isResourceScopedEvent(event) {
40
+ return !isSystemEvent(event);
41
+ }
42
+ function getEventType(event) {
43
+ return event.type;
44
+ }
45
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AA+MH,0CAOC;AAMD,sCAEC;AAMD,sDAEC;AAED,oCAIC;AA9BD,cAAc;AACd,SAAgB,eAAe,CAAC,KAAU;IACxC,OAAO,KAAK;QACV,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;QAC5B,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QACnC,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,UAAU,KAAK,QAAQ,CAAC,IAAK,0BAA0B;QACvG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,KAAoB;IAChD,OAAO,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,KAAoB;IACxD,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAgB,YAAY,CAC1B,KAAoB;IAEpB,OAAO,KAAK,CAAC,IAAiB,CAAC;AACjC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Graph types - Models for graph connections and relationships
3
+ */
4
+ import type { components } from '@semiont/api-client';
5
+ type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
6
+ type Annotation = components['schemas']['Annotation'];
7
+ /**
8
+ * Represents a connection between resources through annotations
9
+ */
10
+ export interface GraphConnection {
11
+ targetResource: ResourceDescriptor;
12
+ annotations: Annotation[];
13
+ relationshipType?: string;
14
+ bidirectional: boolean;
15
+ }
16
+ /**
17
+ * Represents a path through the graph
18
+ */
19
+ export interface GraphPath {
20
+ resources: ResourceDescriptor[];
21
+ annotations: Annotation[];
22
+ }
23
+ /**
24
+ * Statistics about entity types in the graph
25
+ */
26
+ export interface EntityTypeStats {
27
+ type: string;
28
+ count: number;
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,KAAK,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AACtE,KAAK,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,kBAAkB,CAAC;IACnC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
package/dist/graph.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Graph types - Models for graph connections and relationships
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * HTTP Client Utilities
3
+ *
4
+ * Reusable fetch wrapper for making authenticated HTTP requests.
5
+ * Used by both frontend (via TanStack Query) and backend (direct calls).
6
+ */
7
+ /**
8
+ * Configuration for HTTP client
9
+ */
10
+ export interface HttpClientConfig {
11
+ baseUrl: string;
12
+ token?: string;
13
+ }
14
+ /**
15
+ * Fetch helper with authentication and error handling
16
+ *
17
+ * @param endpoint - API endpoint (e.g., '/api/resources')
18
+ * @param options - Standard fetch options
19
+ * @param token - Optional authentication token
20
+ * @returns Typed response data
21
+ * @throws APIError on HTTP errors
22
+ */
23
+ export declare function fetchAPI<T>(endpoint: string, options?: RequestInit, token?: string, baseUrl?: string): Promise<T>;
24
+ /**
25
+ * Create a configured fetch function with a base URL
26
+ * Useful for creating client-specific fetch instances
27
+ *
28
+ * @param baseUrl - Base URL for all requests (e.g., 'http://localhost:4000')
29
+ * @returns Configured fetch function
30
+ */
31
+ export declare function createFetchAPI(baseUrl: string): <T>(endpoint: string, options?: RequestInit, token?: string) => Promise<T>;
32
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,WAAgB,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,OAAO,GAAE,MAAW,GACnB,OAAO,CAAC,CAAC,CAAC,CA4BZ;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,IAC3B,CAAC,EAChB,UAAU,MAAM,EAChB,UAAS,WAAgB,EACzB,QAAQ,MAAM,KACb,OAAO,CAAC,CAAC,CAAC,CAGd"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /**
3
+ * HTTP Client Utilities
4
+ *
5
+ * Reusable fetch wrapper for making authenticated HTTP requests.
6
+ * Used by both frontend (via TanStack Query) and backend (direct calls).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.fetchAPI = fetchAPI;
10
+ exports.createFetchAPI = createFetchAPI;
11
+ const errors_1 = require("./errors");
12
+ /**
13
+ * Fetch helper with authentication and error handling
14
+ *
15
+ * @param endpoint - API endpoint (e.g., '/api/resources')
16
+ * @param options - Standard fetch options
17
+ * @param token - Optional authentication token
18
+ * @returns Typed response data
19
+ * @throws APIError on HTTP errors
20
+ */
21
+ async function fetchAPI(endpoint, options = {}, token, baseUrl = '') {
22
+ const headers = {
23
+ 'Content-Type': 'application/json',
24
+ ...(options.headers || {}),
25
+ };
26
+ if (token) {
27
+ headers['Authorization'] = `Bearer ${token}`;
28
+ }
29
+ const url = baseUrl ? `${baseUrl}${endpoint}` : endpoint;
30
+ const response = await fetch(url, {
31
+ ...options,
32
+ headers,
33
+ });
34
+ if (!response.ok) {
35
+ const errorData = await response.json().catch(() => ({}));
36
+ throw new errors_1.APIError(response.status, errorData, errorData.message);
37
+ }
38
+ // Handle 204 No Content responses
39
+ if (response.status === 204 || response.headers.get('content-length') === '0') {
40
+ return {};
41
+ }
42
+ return response.json();
43
+ }
44
+ /**
45
+ * Create a configured fetch function with a base URL
46
+ * Useful for creating client-specific fetch instances
47
+ *
48
+ * @param baseUrl - Base URL for all requests (e.g., 'http://localhost:4000')
49
+ * @returns Configured fetch function
50
+ */
51
+ function createFetchAPI(baseUrl) {
52
+ return function (endpoint, options = {}, token) {
53
+ return fetchAPI(endpoint, options, token, baseUrl);
54
+ };
55
+ }
56
+ //# sourceMappingURL=http-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.js","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqBH,4BAiCC;AASD,wCAQC;AArED,qCAAoC;AAUpC;;;;;;;;GAQG;AACI,KAAK,UAAU,QAAQ,CAC5B,QAAgB,EAChB,UAAuB,EAAE,EACzB,KAAc,EACd,UAAkB,EAAE;IAEpB,MAAM,OAAO,GAA2B;QACtC,cAA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
+ * at compile time while having zero runtime overhead.
6
+ *
7
+ * URI types (ResourceUri, AnnotationUri) are in @semiont/api-client
8
+ * since they deal with HTTP URIs returned by the API.
9
+ */
10
+ export type ResourceId = string & {
11
+ readonly __brand: 'ResourceId';
12
+ };
13
+ export type AnnotationId = string & {
14
+ readonly __brand: 'AnnotationId';
15
+ };
16
+ export type UserId = string & {
17
+ readonly __brand: 'UserId';
18
+ };
19
+ export declare function isResourceId(value: string): value is ResourceId;
20
+ export declare function isAnnotationId(value: string): value is AnnotationId;
21
+ export declare function resourceId(id: string): ResourceId;
22
+ export declare function annotationId(id: string): AnnotationId;
23
+ export declare function userId(id: string): UserId;
24
+ //# sourceMappingURL=identifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AACzE,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAG7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAE/D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE;AAGD,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAKjD;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,CAKrD;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * Branded identifier types for compile-time type safety.
4
+ *
5
+ * These types prevent mixing up resource IDs, annotation IDs, and user IDs
6
+ * at compile time while having zero runtime overhead.
7
+ *
8
+ * URI types (ResourceUri, AnnotationUri) are in @semiont/api-client
9
+ * since they deal with HTTP URIs returned by the API.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isResourceId = isResourceId;
13
+ exports.isAnnotationId = isAnnotationId;
14
+ exports.resourceId = resourceId;
15
+ exports.annotationId = annotationId;
16
+ exports.userId = userId;
17
+ // Type guards with runtime validation
18
+ function isResourceId(value) {
19
+ return !value.includes('/');
20
+ }
21
+ function isAnnotationId(value) {
22
+ return !value.includes('/');
23
+ }
24
+ // Factory functions with runtime validation
25
+ function resourceId(id) {
26
+ if (id.includes('/')) {
27
+ throw new TypeError(`Expected ResourceId, got URI: ${id}`);
28
+ }
29
+ return id;
30
+ }
31
+ function annotationId(id) {
32
+ if (id.includes('/')) {
33
+ throw new TypeError(`Expected AnnotationId, got URI: ${id}`);
34
+ }
35
+ return id;
36
+ }
37
+ function userId(id) {
38
+ return id;
39
+ }
40
+ //# sourceMappingURL=identifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAQH,oCAEC;AAED,wCAEC;AAGD,gCAKC;AAED,oCAKC;AAED,wBAEC;AA1BD,sCAAsC;AACtC,SAAgB,YAAY,CAAC,KAAa;IACxC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,4CAA4C;AAC5C,SAAgB,UAAU,CAAC,EAAU;IACnC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,iCAAiC,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,EAAgB,CAAC;AAC1B,CAAC;AAED,SAAgB,YAAY,CAAC,EAAU;IACrC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,EAAkB,CAAC;AAC5B,CAAC;AAED,SAAgB,MAAM,CAAC,EAAU;IAC/B,OAAO,EAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @semiont/core
3
+ *
4
+ * Core domain logic and utilities for the Semiont semantic knowledge platform.
5
+ * For OpenAPI types, import directly from @semiont/api-client.
6
+ */
7
+ export { CREATION_METHODS } from './creation-methods';
8
+ export type { CreationMethod } from './creation-methods';
9
+ export type { ResourceId, AnnotationId, UserId } from './identifiers';
10
+ export { resourceId, annotationId, userId, isResourceId, isAnnotationId, } from './identifiers';
11
+ export type { GraphConnection, GraphPath, EntityTypeStats, } from './graph';
12
+ export type { BaseEvent, ResourceEvent, ResourceEventType, SystemEvent, ResourceScopedEvent, ResourceCreatedEvent, ResourceClonedEvent, ResourceArchivedEvent, ResourceUnarchivedEvent, AnnotationAddedEvent, AnnotationRemovedEvent, AnnotationBodyUpdatedEvent, JobStartedEvent, JobProgressEvent, JobCompletedEvent, JobFailedEvent, BodyOperation, BodyItem, EntityTagAddedEvent, EntityTagRemovedEvent, EventMetadata, EventSignature, StoredEvent, EventQuery, ResourceAnnotations, } from './events';
13
+ export { isResourceEvent, isSystemEvent, isResourceScopedEvent, getEventType, } from './events';
14
+ export { bodyItemsMatch, findBodyItem } from './annotation-utils';
15
+ export type { UpdateResourceInput, ResourceFilter } from './resource-types';
16
+ export type { AnnotationCategory, CreateAnnotationInternal } from './annotation-types';
17
+ export type { GoogleAuthRequest } from './auth-types';
18
+ export * from './type-guards';
19
+ export * from './crypto';
20
+ export * from './errors';
21
+ export * from './http-client';
22
+ export * from './annotation-history-utils';
23
+ export * from './did-utils';
24
+ export { loadEnvironmentConfig, getAvailableEnvironments, getNodeEnvForEnvironment, type EnvironmentConfig, type ServiceConfig, type AWSConfig, type SiteConfig, type AppConfig, } from './config/environment-loader';
25
+ export { isValidEnvironment, parseEnvironment, validateEnvironment, type Environment, } from './config/environment-validator';
26
+ export { ConfigurationError } from './config/configuration-error';
27
+ export { findProjectRoot, isProjectRoot, getEnvironmentsPath, getSemiontConfigPath, } from './config/project-discovery';
28
+ export { type PlatformType, isValidPlatformType, getAllPlatformTypes, } from './config/platform-types';
29
+ export type { BackendServiceConfig, FrontendServiceConfig, DatabaseServiceConfig, GraphServiceConfig, FilesystemServiceConfig, InferenceServiceConfig, McpServiceConfig, ServicesConfig, SemiontConfig, GraphDatabaseType, ServicePlatformConfig } from './config/config.types';
30
+ export { validateSemiontConfig, validateEnvironmentConfig, validateSiteConfig, type ValidationResult, } from './config/config-validator';
31
+ export declare const CORE_TYPES_VERSION = "0.1.0";
32
+ export declare const SDK_VERSION = "0.1.0";
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,UAAU,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,eAAe,EACf,SAAS,EACT,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,mBAAmB,E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AmB,GACpB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC;AAGnC,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,eAAO,MAAM,WAAW,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /**
3
+ * @semiont/core
4
+ *
5
+ * Core domain logic and utilities for the Semiont semantic knowledge platform.
6
+ * For OpenAPI types, import directly from @semiont/api-client.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.SDK_VERSION = exports.CORE_TYPES_VERSION = exports.validateSiteConfig = exports.validateEnvironmentConfig = exports.validateSemiontConfig = exports.getAllPlatformTypes = exports.isValidPlatformType = exports.getSemiontConfigPath = exports.getEnvironmentsPath = exports.isProjectRoot = exports.findProjectRoot = exports.ConfigurationError = exports.validateEnvironment = exports.parseEnvironment = exports.isValidEnvironment = exports.getNodeEnvForEnvironment = exports.getAvailableEnvironments = exports.loadEnvironmentConfig = exports.findBodyItem = exports.bodyItemsMatch = exports.getEventType = exports.isResourceScopedEvent = exports.isSystemEvent = exports.isResourceEvent = exports.isAnnotationId = exports.isResourceId = exports.userId = exports.annotationId = exports.resourceId = exports.CREATION_METHODS = void 0;
24
+ // NOTE: OpenAPI types are NOT re-exported from @semiont/core.
25
+ // Import types directly from @semiont/api-client where needed:
26
+ // import type { components } from '@semiont/api-client';
27
+ // type Annotation = components['schemas']['Annotation'];
28
+ // Creation methods
29
+ var creation_methods_1 = require("./creation-methods");
30
+ Object.defineProperty(exports, "CREATION_METHODS", { enumerable: true, get: function () { return creation_methods_1.CREATION_METHODS; } });
31
+ var identifiers_1 = require("./identifiers");
32
+ Object.defineProperty(exports, "resourceId", { enumerable: true, get: function () { return identifiers_1.resourceId; } });
33
+ Object.defineProperty(exports, "annotationId", { enumerable: true, get: function () { return identifiers_1.annotationId; } });
34
+ Object.defineProperty(exports, "userId", { enumerable: true, get: function () { return identifiers_1.userId; } });
35
+ Object.defineProperty(exports, "isResourceId", { enumerable: true, get: function () { return identifiers_1.isResourceId; } });
36
+ Object.defineProperty(exports, "isAnnotationId", { enumerable: true, get: function () { return identifiers_1.isAnnotationId; } });
37
+ var events_1 = require("./events");
38
+ Object.defineProperty(exports, "isResourceEvent", { enumerable: true, get: function () { return events_1.isResourceEvent; } });
39
+ Object.defineProperty(exports, "isSystemEvent", { enumerable: true, get: function () { return events_1.isSystemEvent; } });
40
+ Object.defineProperty(exports, "isResourceScopedEvent", { enumerable: true, get: function () { return events_1.isResourceScopedEvent; } });
41
+ Object.defineProperty(exports, "getEventType", { enumerable: true, get: function () { return events_1.getEventType; } });
42
+ // Backend-specific annotation utilities
43
+ var annotation_utils_1 = require("./annotation-utils");
44
+ Object.defineProperty(exports, "bodyItemsMatch", { enumerable: true, get: function () { return annotation_utils_1.bodyItemsMatch; } });
45
+ Object.defineProperty(exports, "findBodyItem", { enumerable: true, get: function () { return annotation_utils_1.findBodyItem; } });
46
+ // Utility functions
47
+ __exportStar(require("./type-guards"), exports);
48
+ __exportStar(require("./crypto"), exports);
49
+ __exportStar(require("./errors"), exports);
50
+ __exportStar(require("./http-client"), exports);
51
+ __exportStar(require("./annotation-history-utils"), exports);
52
+ __exportStar(require("./did-utils"), exports);
53
+ // Configuration loading
54
+ var environment_loader_1 = require("./config/environment-loader");
55
+ Object.defineProperty(exports, "loadEnvironmentConfig", { enumerable: true, get: function () { return environment_loader_1.loadEnvironmentConfig; } });
56
+ Object.defineProperty(exports, "getAvailableEnvironments", { enumerable: true, get: function () { return environment_loader_1.getAvailableEnvironments; } });
57
+ Object.defineProperty(exports, "getNodeEnvForEnvironment", { enumerable: true, get: function () { return environment_loader_1.getNodeEnvForEnvironment; } });
58
+ var environment_validator_1 = require("./config/environment-validator");
59
+ Object.defineProperty(exports, "isValidEnvironment", { enumerable: true, get: function () { return environment_validator_1.isValidEnvironment; } });
60
+ Object.defineProperty(exports, "parseEnvironment", { enumerable: true, get: function () { return environment_validator_1.parseEnvironment; } });
61
+ Object.defineProperty(exports, "validateEnvironment", { enumerable: true, get: function () { return environment_validator_1.validateEnvironment; } });
62
+ var configuration_error_1 = require("./config/configuration-error");
63
+ Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return configuration_error_1.ConfigurationError; } });
64
+ var project_discovery_1 = require("./config/project-discovery");
65
+ Object.defineProperty(exports, "findProjectRoot", { enumerable: true, get: function () { return project_discovery_1.findProjectRoot; } });
66
+ Object.defineProperty(exports, "isProjectRoot", { enumerable: true, get: function () { return project_discovery_1.isProjectRoot; } });
67
+ Object.defineProperty(exports, "getEnvironmentsPath", { enumerable: true, get: function () { return project_discovery_1.getEnvironmentsPath; } });
68
+ Object.defineProperty(exports, "getSemiontConfigPath", { enumerable: true, get: function () { return project_discovery_1.getSemiontConfigPath; } });
69
+ var platform_types_1 = require("./config/platform-types");
70
+ Object.defineProperty(exports, "isValidPlatformType", { enumerable: true, get: function () { return platform_types_1.isValidPlatformType; } });
71
+ Object.defineProperty(exports, "getAllPlatformTypes", { enumerable: true, get: function () { return platform_types_1.getAllPlatformTypes; } });
72
+ // Configuration validation
73
+ var config_validator_1 = require("./config/config-validator");
74
+ Object.defineProperty(exports, "validateSemiontConfig", { enumerable: true, get: function () { return config_validator_1.validateSemiontConfig; } });
75
+ Object.defineProperty(exports, "validateEnvironmentConfig", { enumerable: true, get: function () { return config_validator_1.validateEnvironmentConfig; } });
76
+ Object.defineProperty(exports, "validateSiteConfig", { enumerable: true, get: function () { return config_validator_1.validateSiteConfig; } });
77
+ // Version information
78
+ exports.CORE_TYPES_VERSION = '0.1.0';
79
+ exports.SDK_VERSION = '0.1.0';
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,8DAA8D;AAC9D,+DAA+D;AAC/D,2DAA2D;AAC3D,2DAA2D;AAE3D,mBAAmB;AACnB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAKzB,6CAMuB;AALrB,yGAAA,UAAU,OAAA;AACV,2GAAA,YAAY,OAAA;AACZ,qGAAA,MAAM,OAAA;AACN,2GAAA,YAAY,OAAA;AACZ,6GAAA,cAAc,OAAA;AAsChB,mCAKkB;AAJhB,yGAAA,eAAe,OAAA;AACf,uGAAA,aAAa,OAAA;AACb,+GAAA,qBAAqB,OAAA;AACrB,sGAAA,YAAY,OAAA;AAGd,wCAAwC;AACxC,uDAAkE;AAAzD,kHAAA,cAAc,OAAA;AAAE,gHAAA,YAAY,OAAA;AAWrC,oBAAoB;AACpB,gDAA8B;AAC9B,2CAAyB;AACzB,2CAAyB;AACzB,gDAA8B;AAC9B,6DAA2C;AAC3C,8CAA4B;AAE5B,wBAAwB;AACxB,kEASqC;AARnC,2HAAA,qBAAqB,OAAA;AACrB,8HAAA,wBAAwB,OAAA;AACxB,8HAAA,wBAAwB,OAAA;AAO1B,wEAKwC;AAJtC,2HAAA,kBAAkB,OAAA;AAClB,yHAAA,gBAAgB,OAAA;AAChB,4HAAA,mBAAmB,OAAA;AAGrB,oEAAkE;AAAzD,yHAAA,kBAAkB,OAAA;AAC3B,gEAKoC;AAJlC,oHAAA,eAAe,OAAA;AACf,kHAAA,aAAa,OAAA;AACb,wHAAA,mBAAmB,OAAA;AACnB,yHAAA,oBAAoB,OAAA;AAEtB,0DAIiC;AAF/B,qHAAA,mBAAmB,OAAA;AACnB,qHAAA,mBAAmB,OAAA;AAkBrB,2BAA2B;AAC3B,8DAKmC;AAJjC,yHAAA,qBAAqB,OAAA;AACrB,6HAAA,yBAAyB,OAAA;AACzB,sHAAA,kBAAkB,OAAA;AAIpB,sBAAsB;AACT,QAAA,kBAAkB,GAAG,OAAO,CAAC;AAC7B,QAAA,WAAW,GAAG,OAAO,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Resource input/output types
3
+ */
4
+ export interface UpdateResourceInput {
5
+ name?: string;
6
+ entityTypes?: string[];
7
+ archived?: boolean;
8
+ }
9
+ export interface ResourceFilter {
10
+ entityTypes?: string[];
11
+ search?: string;
12
+ limit?: number;
13
+ offset?: number;
14
+ }
15
+ //# sourceMappingURL=resource-types.d.ts.map