@semiont/core 0.2.1 → 0.2.2-build.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1367 -27
- package/dist/index.js +1455 -78
- package/dist/index.js.map +1 -1
- package/package.json +18 -8
- package/dist/annotation-history-utils.d.ts +0 -42
- package/dist/annotation-history-utils.d.ts.map +0 -1
- package/dist/annotation-history-utils.js +0 -258
- package/dist/annotation-history-utils.js.map +0 -1
- package/dist/annotation-types.d.ts +0 -15
- package/dist/annotation-types.d.ts.map +0 -1
- package/dist/annotation-types.js +0 -6
- package/dist/annotation-types.js.map +0 -1
- package/dist/annotation-utils.d.ts +0 -18
- package/dist/annotation-utils.d.ts.map +0 -1
- package/dist/annotation-utils.js +0 -70
- package/dist/annotation-utils.js.map +0 -1
- package/dist/auth-types.d.ts +0 -8
- package/dist/auth-types.d.ts.map +0 -1
- package/dist/auth-types.js +0 -6
- package/dist/auth-types.js.map +0 -1
- package/dist/config/config-validator.d.ts +0 -25
- package/dist/config/config-validator.d.ts.map +0 -1
- package/dist/config/config-validator.js +0 -112
- package/dist/config/config-validator.js.map +0 -1
- package/dist/config/config.schema.json +0 -678
- package/dist/config/config.types.d.ts +0 -574
- package/dist/config/config.types.d.ts.map +0 -1
- package/dist/config/config.types.js +0 -4
- package/dist/config/config.types.js.map +0 -1
- package/dist/config/configuration-error.d.ts +0 -17
- package/dist/config/configuration-error.d.ts.map +0 -1
- package/dist/config/configuration-error.js +0 -36
- package/dist/config/configuration-error.js.map +0 -1
- package/dist/config/environment-loader.d.ts +0 -98
- package/dist/config/environment-loader.d.ts.map +0 -1
- package/dist/config/environment-loader.js +0 -229
- package/dist/config/environment-loader.js.map +0 -1
- package/dist/config/environment-validator.d.ts +0 -22
- package/dist/config/environment-validator.d.ts.map +0 -1
- package/dist/config/environment-validator.js +0 -50
- package/dist/config/environment-validator.js.map +0 -1
- package/dist/config/platform-types.d.ts +0 -26
- package/dist/config/platform-types.d.ts.map +0 -1
- package/dist/config/platform-types.js +0 -28
- package/dist/config/platform-types.js.map +0 -1
- package/dist/config/project-discovery.d.ts +0 -35
- package/dist/config/project-discovery.d.ts.map +0 -1
- package/dist/config/project-discovery.js +0 -99
- package/dist/config/project-discovery.js.map +0 -1
- package/dist/creation-methods.d.ts +0 -19
- package/dist/creation-methods.d.ts.map +0 -1
- package/dist/creation-methods.js +0 -18
- package/dist/creation-methods.js.map +0 -1
- package/dist/crypto.d.ts +0 -32
- package/dist/crypto.d.ts.map +0 -1
- package/dist/crypto.js +0 -52
- package/dist/crypto.js.map +0 -1
- package/dist/did-utils.d.ts +0 -51
- package/dist/did-utils.d.ts.map +0 -1
- package/dist/did-utils.js +0 -62
- package/dist/did-utils.js.map +0 -1
- package/dist/errors.d.ts +0 -51
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -89
- package/dist/errors.js.map +0 -1
- package/dist/events.d.ts +0 -223
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -45
- package/dist/events.js.map +0 -1
- package/dist/graph.d.ts +0 -31
- package/dist/graph.d.ts.map +0 -1
- package/dist/graph.js +0 -6
- package/dist/graph.js.map +0 -1
- package/dist/http-client.d.ts +0 -32
- package/dist/http-client.d.ts.map +0 -1
- package/dist/http-client.js +0 -56
- package/dist/http-client.js.map +0 -1
- package/dist/identifiers.d.ts +0 -24
- package/dist/identifiers.d.ts.map +0 -1
- package/dist/identifiers.js +0 -40
- package/dist/identifiers.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/resource-types.d.ts +0 -15
- package/dist/resource-types.d.ts.map +0 -1
- package/dist/resource-types.js +0 -6
- package/dist/resource-types.js.map +0 -1
- package/dist/type-guards.d.ts +0 -44
- package/dist/type-guards.d.ts.map +0 -1
- package/dist/type-guards.js +0 -76
- package/dist/type-guards.js.map +0 -1
package/dist/creation-methods.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Resource creation methods - How resources are created in the system
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CREATION_METHODS = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Enumeration of all possible resource creation methods
|
|
9
|
-
*/
|
|
10
|
-
exports.CREATION_METHODS = {
|
|
11
|
-
API: 'api',
|
|
12
|
-
UPLOAD: 'upload',
|
|
13
|
-
UI: 'ui',
|
|
14
|
-
REFERENCE: 'reference',
|
|
15
|
-
CLONE: 'clone',
|
|
16
|
-
GENERATED: 'generated',
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=creation-methods.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"creation-methods.js","sourceRoot":"","sources":["../src/creation-methods.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC9B,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,IAAI;IACR,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;CACd,CAAC"}
|
package/dist/crypto.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cryptographic utilities
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Calculate SHA-256 checksum of content
|
|
6
|
-
* @param content The content to hash
|
|
7
|
-
* @returns Hex-encoded SHA-256 hash
|
|
8
|
-
*/
|
|
9
|
-
export declare function calculateChecksum(content: string | Buffer): string;
|
|
10
|
-
/**
|
|
11
|
-
* Verify content against a checksum
|
|
12
|
-
* @param content The content to verify
|
|
13
|
-
* @param checksum The expected checksum
|
|
14
|
-
* @returns True if content matches checksum
|
|
15
|
-
*/
|
|
16
|
-
export declare function verifyChecksum(content: string | Buffer, checksum: string): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Generate a random ID (12 character hex string)
|
|
19
|
-
* Similar to MongoDB ObjectId but simpler
|
|
20
|
-
*/
|
|
21
|
-
export declare function generateId(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Generate a UUID v4-like ID (without dashes)
|
|
24
|
-
*/
|
|
25
|
-
export declare function generateUuid(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Generate a secure random token
|
|
28
|
-
* @param bytes Number of random bytes (default 32)
|
|
29
|
-
* @returns Base64 encoded random token
|
|
30
|
-
*/
|
|
31
|
-
export declare function generateToken(bytes?: number): string;
|
|
32
|
-
//# sourceMappingURL=crypto.d.ts.map
|
package/dist/crypto.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAIlE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAElF;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,MAAW,GAAG,MAAM,CAExD"}
|
package/dist/crypto.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Cryptographic utilities
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.calculateChecksum = calculateChecksum;
|
|
7
|
-
exports.verifyChecksum = verifyChecksum;
|
|
8
|
-
exports.generateId = generateId;
|
|
9
|
-
exports.generateUuid = generateUuid;
|
|
10
|
-
exports.generateToken = generateToken;
|
|
11
|
-
const crypto_1 = require("crypto");
|
|
12
|
-
/**
|
|
13
|
-
* Calculate SHA-256 checksum of content
|
|
14
|
-
* @param content The content to hash
|
|
15
|
-
* @returns Hex-encoded SHA-256 hash
|
|
16
|
-
*/
|
|
17
|
-
function calculateChecksum(content) {
|
|
18
|
-
const hash = (0, crypto_1.createHash)('sha256');
|
|
19
|
-
hash.update(content);
|
|
20
|
-
return hash.digest('hex');
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Verify content against a checksum
|
|
24
|
-
* @param content The content to verify
|
|
25
|
-
* @param checksum The expected checksum
|
|
26
|
-
* @returns True if content matches checksum
|
|
27
|
-
*/
|
|
28
|
-
function verifyChecksum(content, checksum) {
|
|
29
|
-
return calculateChecksum(content) === checksum;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Generate a random ID (12 character hex string)
|
|
33
|
-
* Similar to MongoDB ObjectId but simpler
|
|
34
|
-
*/
|
|
35
|
-
function generateId() {
|
|
36
|
-
return (0, crypto_1.randomBytes)(6).toString('hex');
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Generate a UUID v4-like ID (without dashes)
|
|
40
|
-
*/
|
|
41
|
-
function generateUuid() {
|
|
42
|
-
return (0, crypto_1.randomBytes)(16).toString('hex');
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Generate a secure random token
|
|
46
|
-
* @param bytes Number of random bytes (default 32)
|
|
47
|
-
* @returns Base64 encoded random token
|
|
48
|
-
*/
|
|
49
|
-
function generateToken(bytes = 32) {
|
|
50
|
-
return (0, crypto_1.randomBytes)(bytes).toString('base64url');
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=crypto.js.map
|
package/dist/crypto.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";AAAA;;GAEG;;AASH,8CAIC;AAQD,wCAEC;AAMD,gCAEC;AAKD,oCAEC;AAOD,sCAEC;AA7CD,mCAAiD;AAEjD;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,OAAwB;IACxD,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,OAAwB,EAAE,QAAgB;IACvE,OAAO,iBAAiB,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU;IACxB,OAAO,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,IAAA,oBAAW,EAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAAgB,EAAE;IAC9C,OAAO,IAAA,oBAAW,EAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/did-utils.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DID (Decentralized Identifier) and W3C Agent utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides utilities for working with DID:WEB identifiers and converting
|
|
5
|
-
* between user representations and W3C Web Annotation Agent objects.
|
|
6
|
-
*/
|
|
7
|
-
import type { components } from '@semiont/api-client';
|
|
8
|
-
type Agent = components['schemas']['Agent'];
|
|
9
|
-
/**
|
|
10
|
-
* Convert a user object to a DID:WEB identifier
|
|
11
|
-
*
|
|
12
|
-
* Format: did:web:domain.com:users:userId
|
|
13
|
-
* Example: did:web:example.com:users:abc123
|
|
14
|
-
*
|
|
15
|
-
* This is used for W3C Web Annotation compliance and federation readiness.
|
|
16
|
-
*
|
|
17
|
-
* @param user - User object with id and domain
|
|
18
|
-
* @returns DID:WEB identifier string
|
|
19
|
-
*/
|
|
20
|
-
export declare function userToDid(user: {
|
|
21
|
-
id: string;
|
|
22
|
-
domain: string;
|
|
23
|
-
}): string;
|
|
24
|
-
/**
|
|
25
|
-
* Convert a user object to a W3C Agent object with DID:WEB identifier
|
|
26
|
-
*
|
|
27
|
-
* Creates a full Agent object for W3C Web Annotation compliance.
|
|
28
|
-
* Includes DID:WEB identifier, type, and name.
|
|
29
|
-
*
|
|
30
|
-
* @param user - User object with id, domain, name, and email
|
|
31
|
-
* @returns W3C Agent object
|
|
32
|
-
*/
|
|
33
|
-
export declare function userToAgent(user: {
|
|
34
|
-
id: string;
|
|
35
|
-
domain: string;
|
|
36
|
-
name: string | null;
|
|
37
|
-
email: string;
|
|
38
|
-
}): Agent;
|
|
39
|
-
/**
|
|
40
|
-
* Convert a DID string to a minimal W3C Agent object
|
|
41
|
-
*
|
|
42
|
-
* Used when reconstructing annotations from events where only the DID is available.
|
|
43
|
-
* Creates a minimal Agent with just the required fields (id, type).
|
|
44
|
-
* Name is derived from the DID for display purposes.
|
|
45
|
-
*
|
|
46
|
-
* @param did - DID:WEB identifier string
|
|
47
|
-
* @returns Minimal W3C Agent object
|
|
48
|
-
*/
|
|
49
|
-
export declare function didToAgent(did: string): Agent;
|
|
50
|
-
export {};
|
|
51
|
-
//# sourceMappingURL=did-utils.d.ts.map
|
package/dist/did-utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-utils.d.ts","sourceRoot":"","sources":["../src/did-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,KAAK,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,KAAK,CAMR;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAU7C"}
|
package/dist/did-utils.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* DID (Decentralized Identifier) and W3C Agent utilities
|
|
4
|
-
*
|
|
5
|
-
* Provides utilities for working with DID:WEB identifiers and converting
|
|
6
|
-
* between user representations and W3C Web Annotation Agent objects.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.userToDid = userToDid;
|
|
10
|
-
exports.userToAgent = userToAgent;
|
|
11
|
-
exports.didToAgent = didToAgent;
|
|
12
|
-
/**
|
|
13
|
-
* Convert a user object to a DID:WEB identifier
|
|
14
|
-
*
|
|
15
|
-
* Format: did:web:domain.com:users:userId
|
|
16
|
-
* Example: did:web:example.com:users:abc123
|
|
17
|
-
*
|
|
18
|
-
* This is used for W3C Web Annotation compliance and federation readiness.
|
|
19
|
-
*
|
|
20
|
-
* @param user - User object with id and domain
|
|
21
|
-
* @returns DID:WEB identifier string
|
|
22
|
-
*/
|
|
23
|
-
function userToDid(user) {
|
|
24
|
-
return `did:web:${user.domain}:users:${user.id}`;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Convert a user object to a W3C Agent object with DID:WEB identifier
|
|
28
|
-
*
|
|
29
|
-
* Creates a full Agent object for W3C Web Annotation compliance.
|
|
30
|
-
* Includes DID:WEB identifier, type, and name.
|
|
31
|
-
*
|
|
32
|
-
* @param user - User object with id, domain, name, and email
|
|
33
|
-
* @returns W3C Agent object
|
|
34
|
-
*/
|
|
35
|
-
function userToAgent(user) {
|
|
36
|
-
return {
|
|
37
|
-
type: 'Person',
|
|
38
|
-
id: userToDid(user),
|
|
39
|
-
name: user.name || user.email,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Convert a DID string to a minimal W3C Agent object
|
|
44
|
-
*
|
|
45
|
-
* Used when reconstructing annotations from events where only the DID is available.
|
|
46
|
-
* Creates a minimal Agent with just the required fields (id, type).
|
|
47
|
-
* Name is derived from the DID for display purposes.
|
|
48
|
-
*
|
|
49
|
-
* @param did - DID:WEB identifier string
|
|
50
|
-
* @returns Minimal W3C Agent object
|
|
51
|
-
*/
|
|
52
|
-
function didToAgent(did) {
|
|
53
|
-
// Extract user ID from DID format: did:web:domain.com:users:userId
|
|
54
|
-
const parts = did.split(':');
|
|
55
|
-
const userId = parts[parts.length - 1] || 'unknown';
|
|
56
|
-
return {
|
|
57
|
-
type: 'Person',
|
|
58
|
-
id: did,
|
|
59
|
-
name: userId, // Use user ID as name since we don't have full user data
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=did-utils.js.map
|
package/dist/did-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-utils.js","sourceRoot":"","sources":["../src/did-utils.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiBH,8BAEC;AAWD,kCAWC;AAYD,gCAUC;AAzDD;;;;;;;;;;GAUG;AACH,SAAgB,SAAS,CAAC,IAAoC;IAC5D,OAAO,WAAW,IAAI,CAAC,MAAM,UAAU,IAAI,CAAC,EAAE,EAAE,CAAC;AACnD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAC,IAK3B;IACC,OAAO;QACL,IAAI,EAAE,QAAiB;QACvB,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,mEAAmE;IACnE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC;IAEpD,OAAO;QACL,IAAI,EAAE,QAAiB;QACvB,EAAE,EAAE,GAAG;QACP,IAAI,EAAE,MAAM,EAAE,yDAAyD;KACxE,CAAC;AACJ,CAAC"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common error classes
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Base error class for Semiont applications
|
|
6
|
-
*/
|
|
7
|
-
export declare class SemiontError extends Error {
|
|
8
|
-
code: string;
|
|
9
|
-
details?: Record<string, any> | undefined;
|
|
10
|
-
constructor(message: string, code: string, details?: Record<string, any> | undefined);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Error thrown when validation fails
|
|
14
|
-
*/
|
|
15
|
-
export declare class ValidationError extends SemiontError {
|
|
16
|
-
constructor(message: string, details?: Record<string, any>);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Error thrown by scripts
|
|
20
|
-
*/
|
|
21
|
-
export declare class ScriptError extends SemiontError {
|
|
22
|
-
constructor(message: string, code?: string, details?: Record<string, any>);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Error thrown when a resource is not found
|
|
26
|
-
*/
|
|
27
|
-
export declare class NotFoundError extends SemiontError {
|
|
28
|
-
constructor(resource: string, id?: string);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Error thrown when user is not authorized
|
|
32
|
-
*/
|
|
33
|
-
export declare class UnauthorizedError extends SemiontError {
|
|
34
|
-
constructor(message?: string, details?: Record<string, any>);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Error thrown when operation would conflict with existing data
|
|
38
|
-
*/
|
|
39
|
-
export declare class ConflictError extends SemiontError {
|
|
40
|
-
constructor(message: string, details?: Record<string, any>);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* API Error class for handling HTTP errors
|
|
44
|
-
* Used by API clients to represent failed HTTP requests
|
|
45
|
-
*/
|
|
46
|
-
export declare class APIError extends Error {
|
|
47
|
-
status: number;
|
|
48
|
-
data: any;
|
|
49
|
-
constructor(status: number, data: any, message?: string);
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAG5B,IAAI,EAAE,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;gBAFpC,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAA;CAMvC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAI3D;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,YAAY;gBAC/B,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAuB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAI1F;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM;CAK1C;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,GAAE,MAAuB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAI5E;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAI3D;AAED;;;GAGG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAExB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,GAAG;gBADT,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EAChB,OAAO,CAAC,EAAE,MAAM;CAMnB"}
|
package/dist/errors.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Common error classes
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.APIError = exports.ConflictError = exports.UnauthorizedError = exports.NotFoundError = exports.ScriptError = exports.ValidationError = exports.SemiontError = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Base error class for Semiont applications
|
|
9
|
-
*/
|
|
10
|
-
class SemiontError extends Error {
|
|
11
|
-
code;
|
|
12
|
-
details;
|
|
13
|
-
constructor(message, code, details) {
|
|
14
|
-
super(message);
|
|
15
|
-
this.code = code;
|
|
16
|
-
this.details = details;
|
|
17
|
-
this.name = 'SemiontError';
|
|
18
|
-
Error.captureStackTrace(this, this.constructor);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.SemiontError = SemiontError;
|
|
22
|
-
/**
|
|
23
|
-
* Error thrown when validation fails
|
|
24
|
-
*/
|
|
25
|
-
class ValidationError extends SemiontError {
|
|
26
|
-
constructor(message, details) {
|
|
27
|
-
super(message, 'VALIDATION_ERROR', details);
|
|
28
|
-
this.name = 'ValidationError';
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.ValidationError = ValidationError;
|
|
32
|
-
/**
|
|
33
|
-
* Error thrown by scripts
|
|
34
|
-
*/
|
|
35
|
-
class ScriptError extends SemiontError {
|
|
36
|
-
constructor(message, code = 'SCRIPT_ERROR', details) {
|
|
37
|
-
super(message, code, details);
|
|
38
|
-
this.name = 'ScriptError';
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.ScriptError = ScriptError;
|
|
42
|
-
/**
|
|
43
|
-
* Error thrown when a resource is not found
|
|
44
|
-
*/
|
|
45
|
-
class NotFoundError extends SemiontError {
|
|
46
|
-
constructor(resource, id) {
|
|
47
|
-
const message = id ? `${resource} with id '${id}' not found` : `${resource} not found`;
|
|
48
|
-
super(message, 'NOT_FOUND', { resource, id });
|
|
49
|
-
this.name = 'NotFoundError';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.NotFoundError = NotFoundError;
|
|
53
|
-
/**
|
|
54
|
-
* Error thrown when user is not authorized
|
|
55
|
-
*/
|
|
56
|
-
class UnauthorizedError extends SemiontError {
|
|
57
|
-
constructor(message = 'Unauthorized', details) {
|
|
58
|
-
super(message, 'UNAUTHORIZED', details);
|
|
59
|
-
this.name = 'UnauthorizedError';
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.UnauthorizedError = UnauthorizedError;
|
|
63
|
-
/**
|
|
64
|
-
* Error thrown when operation would conflict with existing data
|
|
65
|
-
*/
|
|
66
|
-
class ConflictError extends SemiontError {
|
|
67
|
-
constructor(message, details) {
|
|
68
|
-
super(message, 'CONFLICT', details);
|
|
69
|
-
this.name = 'ConflictError';
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.ConflictError = ConflictError;
|
|
73
|
-
/**
|
|
74
|
-
* API Error class for handling HTTP errors
|
|
75
|
-
* Used by API clients to represent failed HTTP requests
|
|
76
|
-
*/
|
|
77
|
-
class APIError extends Error {
|
|
78
|
-
status;
|
|
79
|
-
data;
|
|
80
|
-
constructor(status, data, message) {
|
|
81
|
-
super(message || `API Error: ${status}`);
|
|
82
|
-
this.status = status;
|
|
83
|
-
this.data = data;
|
|
84
|
-
this.name = 'APIError';
|
|
85
|
-
Error.captureStackTrace(this, this.constructor);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.APIError = APIError;
|
|
89
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IAG5B;IACA;IAHT,YACE,OAAe,EACR,IAAY,EACZ,OAA6B;QAEpC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAsB;QAGpC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF;AAVD,oCAUC;AAED;;GAEG;AACH,MAAa,eAAgB,SAAQ,YAAY;IAC/C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED;;GAEG;AACH,MAAa,WAAY,SAAQ,YAAY;IAC3C,YAAY,OAAe,EAAE,OAAe,cAAc,EAAE,OAA6B;QACvF,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,G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0,0 @@
|
|
|
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
|
package/dist/events.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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,UAA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AAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,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
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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
|
package/dist/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|