@jotx-labs/core 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/__tests__/events.test.d.ts +2 -0
- package/dist/__tests__/events.test.d.ts.map +1 -0
- package/dist/__tests__/events.test.js +63 -0
- package/dist/__tests__/events.test.js.map +1 -0
- package/dist/__tests__/idGenerator.test.d.ts +5 -0
- package/dist/__tests__/idGenerator.test.d.ts.map +1 -0
- package/dist/__tests__/idGenerator.test.js +98 -0
- package/dist/__tests__/idGenerator.test.js.map +1 -0
- package/dist/__tests__/platform.test.d.ts +2 -0
- package/dist/__tests__/platform.test.d.ts.map +1 -0
- package/dist/__tests__/platform.test.js +37 -0
- package/dist/__tests__/platform.test.js.map +1 -0
- package/dist/__tests__/plugin.test.d.ts +2 -0
- package/dist/__tests__/plugin.test.d.ts.map +1 -0
- package/dist/__tests__/plugin.test.js +72 -0
- package/dist/__tests__/plugin.test.js.map +1 -0
- package/dist/converters/MarkdownConverter.d.ts +15 -0
- package/dist/converters/MarkdownConverter.d.ts.map +1 -0
- package/dist/converters/MarkdownConverter.js +519 -0
- package/dist/converters/MarkdownConverter.js.map +1 -0
- package/dist/document/index.d.ts +4 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +8 -0
- package/dist/document/index.js.map +1 -0
- package/dist/events/EventEmitter.d.ts +20 -0
- package/dist/events/EventEmitter.d.ts.map +1 -0
- package/dist/events/EventEmitter.js +51 -0
- package/dist/events/EventEmitter.js.map +1 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +18 -0
- package/dist/events/index.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/__tests__/parser.test.d.ts +2 -0
- package/dist/parser/__tests__/parser.test.d.ts.map +1 -0
- package/dist/parser/__tests__/parser.test.js +72 -0
- package/dist/parser/__tests__/parser.test.js.map +1 -0
- package/dist/parser/__tests__/serializer.test.d.ts +2 -0
- package/dist/parser/__tests__/serializer.test.d.ts.map +1 -0
- package/dist/parser/__tests__/serializer.test.js +60 -0
- package/dist/parser/__tests__/serializer.test.js.map +1 -0
- package/dist/parser/__tests__/tokenizer.test.d.ts +2 -0
- package/dist/parser/__tests__/tokenizer.test.d.ts.map +1 -0
- package/dist/parser/__tests__/tokenizer.test.js +76 -0
- package/dist/parser/__tests__/tokenizer.test.js.map +1 -0
- package/dist/parser/__tests__/validator.test.d.ts +2 -0
- package/dist/parser/__tests__/validator.test.d.ts.map +1 -0
- package/dist/parser/__tests__/validator.test.js +281 -0
- package/dist/parser/__tests__/validator.test.js.map +1 -0
- package/dist/parser/serializer.d.ts +28 -0
- package/dist/parser/serializer.d.ts.map +1 -0
- package/dist/parser/serializer.js +157 -0
- package/dist/parser/serializer.js.map +1 -0
- package/dist/parser/tokenizer.new.d.ts +31 -0
- package/dist/parser/tokenizer.new.d.ts.map +1 -0
- package/dist/parser/tokenizer.new.js +181 -0
- package/dist/parser/tokenizer.new.js.map +1 -0
- package/dist/parser/v3/BlockParser.d.ts +11 -0
- package/dist/parser/v3/BlockParser.d.ts.map +1 -0
- package/dist/parser/v3/BlockParser.js +93 -0
- package/dist/parser/v3/BlockParser.js.map +1 -0
- package/dist/parser/v3/DocumentParser.d.ts +8 -0
- package/dist/parser/v3/DocumentParser.d.ts.map +1 -0
- package/dist/parser/v3/DocumentParser.js +109 -0
- package/dist/parser/v3/DocumentParser.js.map +1 -0
- package/dist/parser/v3/Parser.d.ts +11 -0
- package/dist/parser/v3/Parser.d.ts.map +1 -0
- package/dist/parser/v3/Parser.js +25 -0
- package/dist/parser/v3/Parser.js.map +1 -0
- package/dist/parser/validator.d.ts +24 -0
- package/dist/parser/validator.d.ts.map +1 -0
- package/dist/parser/validator.js +177 -0
- package/dist/parser/validator.js.map +1 -0
- package/dist/platform/NullPlatformAdapter.d.ts +18 -0
- package/dist/platform/NullPlatformAdapter.d.ts.map +1 -0
- package/dist/platform/NullPlatformAdapter.js +41 -0
- package/dist/platform/NullPlatformAdapter.js.map +1 -0
- package/dist/platform/PlatformAdapter.d.ts +22 -0
- package/dist/platform/PlatformAdapter.d.ts.map +1 -0
- package/dist/platform/PlatformAdapter.js +7 -0
- package/dist/platform/PlatformAdapter.js.map +1 -0
- package/dist/platform/index.d.ts +3 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +19 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/plugin/PluginSystem.d.ts +46 -0
- package/dist/plugin/PluginSystem.d.ts.map +1 -0
- package/dist/plugin/PluginSystem.js +58 -0
- package/dist/plugin/PluginSystem.js.map +1 -0
- package/dist/plugin/index.d.ts +2 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +18 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/types/ast.d.ts +118 -0
- package/dist/types/ast.d.ts.map +1 -0
- package/dist/types/ast.js +331 -0
- package/dist/types/ast.js.map +1 -0
- package/dist/types/enums.d.ts +67 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/enums.js +278 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/utils/idGenerator.d.ts +34 -0
- package/dist/utils/idGenerator.d.ts.map +1 -0
- package/dist/utils/idGenerator.js +105 -0
- package/dist/utils/idGenerator.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +10 -0
- package/dist/version.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Validator = void 0;
|
|
4
|
+
exports.createValidator = createValidator;
|
|
5
|
+
const registry_1 = require("@jotx/registry");
|
|
6
|
+
const enums_1 = require("../types/enums");
|
|
7
|
+
/**
|
|
8
|
+
* Jotx Validator
|
|
9
|
+
* Validates AST against Registry Schema
|
|
10
|
+
*/
|
|
11
|
+
class Validator {
|
|
12
|
+
validate(doc) {
|
|
13
|
+
const errors = [];
|
|
14
|
+
// Validate document-level schema (which blocks are allowed)
|
|
15
|
+
this.validateDocumentSchema(doc, errors);
|
|
16
|
+
// Validate document metadata
|
|
17
|
+
this.validateDocumentMetadata(doc, errors);
|
|
18
|
+
// Validate individual blocks
|
|
19
|
+
this.validateBlocks(doc.blocks, errors);
|
|
20
|
+
return errors;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Validate that all blocks in the document are allowed for this document type
|
|
24
|
+
*/
|
|
25
|
+
validateDocumentSchema(doc, errors) {
|
|
26
|
+
const allowedBlocks = enums_1.DOCUMENT_SCHEMAS[doc.type];
|
|
27
|
+
if (!allowedBlocks) {
|
|
28
|
+
errors.push({
|
|
29
|
+
type: 'invalid_document_type',
|
|
30
|
+
message: `Unknown document type: '${doc.type}'`,
|
|
31
|
+
severity: 'error',
|
|
32
|
+
line: 1
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Check all blocks recursively
|
|
37
|
+
this.checkBlocksAgainstSchema(doc.blocks, allowedBlocks, doc.type, errors);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate document metadata (e.g. type enum)
|
|
41
|
+
*/
|
|
42
|
+
validateDocumentMetadata(doc, errors) {
|
|
43
|
+
// Validate type
|
|
44
|
+
if (doc.metadata.type) {
|
|
45
|
+
if (!(0, enums_1.isValidDocumentKind)(doc.metadata.type)) {
|
|
46
|
+
errors.push({
|
|
47
|
+
type: 'invalid_metadata',
|
|
48
|
+
message: `Invalid document type '${doc.metadata.type}'. Expected one of: ${enums_1.DOCUMENT_KINDS.join(', ')}`,
|
|
49
|
+
severity: 'error',
|
|
50
|
+
line: 1
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Recursively check if blocks are allowed in this document type
|
|
57
|
+
*/
|
|
58
|
+
checkBlocksAgainstSchema(blocks, allowedBlocks, docType, errors) {
|
|
59
|
+
if (!blocks || !Array.isArray(blocks))
|
|
60
|
+
return;
|
|
61
|
+
for (const block of blocks) {
|
|
62
|
+
// Check if block type is allowed in this document type
|
|
63
|
+
if (!allowedBlocks.includes(block.type)) {
|
|
64
|
+
const lineNum = block.line || 1;
|
|
65
|
+
errors.push({
|
|
66
|
+
type: 'schema_violation',
|
|
67
|
+
message: `Block type '${block.type}' is not allowed in '${docType}' documents (line ${lineNum})`,
|
|
68
|
+
severity: 'error',
|
|
69
|
+
line: lineNum,
|
|
70
|
+
column: 1,
|
|
71
|
+
blockId: block.id
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// Do not recursively check children against document schema.
|
|
75
|
+
// Children validation should be handled by the parent block definition (if implemented)
|
|
76
|
+
// or simply allowed. Document schema only restricts ROOT blocks.
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
validateBlocks(blocks, errors) {
|
|
80
|
+
if (!blocks || !Array.isArray(blocks))
|
|
81
|
+
return;
|
|
82
|
+
for (const block of blocks) {
|
|
83
|
+
this.validateBlock(block, errors);
|
|
84
|
+
if (block.children) {
|
|
85
|
+
this.validateBlocks(block.children, errors);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
validateBlock(block, errors) {
|
|
90
|
+
const line = block.line || 0;
|
|
91
|
+
const def = registry_1.registry.get(block.type);
|
|
92
|
+
// 1. Check for Unknown Block Type
|
|
93
|
+
if (!def) {
|
|
94
|
+
errors.push({
|
|
95
|
+
type: 'invalid_block_type',
|
|
96
|
+
message: `Unknown block type: '${block.type}'`,
|
|
97
|
+
severity: 'error',
|
|
98
|
+
line: line,
|
|
99
|
+
blockId: block.id
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (!def.schema)
|
|
104
|
+
return; // No schema, strict validation skipped
|
|
105
|
+
const schema = def.schema.properties;
|
|
106
|
+
// 2. Check Required Properties
|
|
107
|
+
for (const [key, propSchema] of Object.entries(schema)) {
|
|
108
|
+
if (propSchema.required) {
|
|
109
|
+
if (block.properties[key] === undefined || block.properties[key] === null) {
|
|
110
|
+
errors.push({
|
|
111
|
+
type: 'missing_required',
|
|
112
|
+
message: `Block '${block.type}' is missing required property: '${key}'`,
|
|
113
|
+
severity: 'error',
|
|
114
|
+
line: line,
|
|
115
|
+
blockId: block.id,
|
|
116
|
+
propertyName: key
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// 3. Check Property Types & Enums
|
|
122
|
+
for (const [key, value] of Object.entries(block.properties)) {
|
|
123
|
+
const propSchema = schema[key];
|
|
124
|
+
// Unknown property?
|
|
125
|
+
if (!propSchema) {
|
|
126
|
+
// If strict mode, we could error here. For now, allow extra props?
|
|
127
|
+
// User asked for "comprehensive validator", so maybe warn?
|
|
128
|
+
// skipping for now to avoid noise on flexible blocks.
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
// Enum Validation
|
|
132
|
+
if (propSchema.type === 'enum' && propSchema.options) {
|
|
133
|
+
if (!propSchema.options.includes(value)) {
|
|
134
|
+
errors.push({
|
|
135
|
+
type: 'invalid_enum',
|
|
136
|
+
message: `Invalid value '${value}' for property '${key}'. Expected one of: ${propSchema.options.join(', ')}`,
|
|
137
|
+
severity: 'error',
|
|
138
|
+
line: line,
|
|
139
|
+
blockId: block.id,
|
|
140
|
+
propertyName: key
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Boolean Validation
|
|
145
|
+
if (propSchema.type === 'boolean') {
|
|
146
|
+
if (typeof value !== 'boolean') {
|
|
147
|
+
errors.push({
|
|
148
|
+
type: 'invalid_type',
|
|
149
|
+
message: `Property '${key}' expects boolean, got ${typeof value}`,
|
|
150
|
+
severity: 'error',
|
|
151
|
+
line: line,
|
|
152
|
+
blockId: block.id,
|
|
153
|
+
propertyName: key
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Number Validation
|
|
158
|
+
if (propSchema.type === 'number') {
|
|
159
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
160
|
+
errors.push({
|
|
161
|
+
type: 'invalid_type',
|
|
162
|
+
message: `Property '${key}' expects number, got ${typeof value}`,
|
|
163
|
+
severity: 'error',
|
|
164
|
+
line: line,
|
|
165
|
+
blockId: block.id,
|
|
166
|
+
propertyName: key
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
exports.Validator = Validator;
|
|
174
|
+
function createValidator() {
|
|
175
|
+
return new Validator();
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/parser/validator.ts"],"names":[],"mappings":";;;AAqMA,0CAEC;AAvMD,6CAA2D;AAE3D,0CAAkG;AAElG;;;GAGG;AACH,MAAa,SAAS;IAEpB,QAAQ,CAAC,GAAiB;QACxB,MAAM,MAAM,GAAsB,EAAE,CAAC;QAErC,4DAA4D;QAC5D,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAEzC,6BAA6B;QAC7B,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAE3C,6BAA6B;QAC7B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAExC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAC,GAAiB,EAAE,MAAyB;QACzE,MAAM,aAAa,GAAG,wBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEjD,IAAI,CAAC,aAA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
4
|
+
*/
|
|
5
|
+
import { PlatformAdapter, PickFileOptions } from './PlatformAdapter';
|
|
6
|
+
export declare class NullPlatformAdapter implements PlatformAdapter {
|
|
7
|
+
readFile(path: string): Promise<string>;
|
|
8
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
9
|
+
exists(path: string): Promise<boolean>;
|
|
10
|
+
listFiles(directory: string): Promise<string[]>;
|
|
11
|
+
openExternal(url: string): Promise<void>;
|
|
12
|
+
showMessage(message: string, type: 'info' | 'warning' | 'error'): void;
|
|
13
|
+
pickFile(options?: PickFileOptions): Promise<string | null>;
|
|
14
|
+
pickDirectory(options?: PickFileOptions): Promise<string | null>;
|
|
15
|
+
getWorkspaceRoot(): string | null;
|
|
16
|
+
getRelativePath(absolutePath: string): string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=NullPlatformAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NullPlatformAdapter.d.ts","sourceRoot":"","sources":["../../src/platform/NullPlatformAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEpE,qBAAa,mBAAoB,YAAW,eAAe;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAItC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/C,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI;IAIhE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI3D,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAItE,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAG9C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Null platform adapter (default no-op implementation)
|
|
4
|
+
* Used when no platform is injected
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.NullPlatformAdapter = void 0;
|
|
8
|
+
class NullPlatformAdapter {
|
|
9
|
+
async readFile(path) {
|
|
10
|
+
throw new Error('Platform not configured: readFile');
|
|
11
|
+
}
|
|
12
|
+
async writeFile(path, content) {
|
|
13
|
+
throw new Error('Platform not configured: writeFile');
|
|
14
|
+
}
|
|
15
|
+
async exists(path) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
async listFiles(directory) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
async openExternal(url) {
|
|
22
|
+
console.warn('Platform not configured: openExternal', url);
|
|
23
|
+
}
|
|
24
|
+
showMessage(message, type) {
|
|
25
|
+
console.log(`[${type}] ${message}`);
|
|
26
|
+
}
|
|
27
|
+
async pickFile(options) {
|
|
28
|
+
throw new Error('Platform not configured: pickFile');
|
|
29
|
+
}
|
|
30
|
+
async pickDirectory(options) {
|
|
31
|
+
throw new Error('Platform not configured: pickDirectory');
|
|
32
|
+
}
|
|
33
|
+
getWorkspaceRoot() {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
getRelativePath(absolutePath) {
|
|
37
|
+
return absolutePath;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.NullPlatformAdapter = NullPlatformAdapter;
|
|
41
|
+
//# sourceMappingURL=NullPlatformAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NullPlatformAdapter.js","sourceRoot":"","sources":["../../src/platform/NullPlatformAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,MAAa,mBAAmB;IAC9B,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IACtD,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,OAAe;QAC3C,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IACvD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY;QACvB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,OAAO,EAAE,CAAA;IACX,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW;QAC5B,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAA;IAC5D,CAAC;IAED,WAAW,CAAC,OAAe,EAAE,IAAkC;QAC7D,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAyB;QACtC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IACtD,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAyB;QAC3C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC3D,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAED,eAAe,CAAC,YAAoB;QAClC,OAAO,YAAY,CAAA;IACrB,CAAC;CACF;AAxCD,kDAwCC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform abstraction interface
|
|
3
|
+
* Allows jotx core to work on any platform
|
|
4
|
+
*/
|
|
5
|
+
export interface PickFileOptions {
|
|
6
|
+
filters?: Record<string, string[]>;
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
directory?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface PlatformAdapter {
|
|
11
|
+
readFile(path: string): Promise<string>;
|
|
12
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
13
|
+
exists(path: string): Promise<boolean>;
|
|
14
|
+
listFiles(directory: string): Promise<string[]>;
|
|
15
|
+
openExternal(url: string): Promise<void>;
|
|
16
|
+
showMessage(message: string, type: 'info' | 'warning' | 'error'): void;
|
|
17
|
+
pickFile(options?: PickFileOptions): Promise<string | null>;
|
|
18
|
+
pickDirectory(options?: PickFileOptions): Promise<string | null>;
|
|
19
|
+
getWorkspaceRoot(): string | null;
|
|
20
|
+
getRelativePath(absolutePath: string): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=PlatformAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformAdapter.d.ts","sourceRoot":"","sources":["../../src/platform/PlatformAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAE9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAG/C,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAGxC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,IAAI,CAAA;IAGtE,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAC3D,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAGhE,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAAA;IACjC,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlatformAdapter.js","sourceRoot":"","sources":["../../src/platform/PlatformAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PlatformAdapter"), exports);
|
|
18
|
+
__exportStar(require("./NullPlatformAdapter"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,wDAAqC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin system - Core plugin interfaces and manager
|
|
3
|
+
*/
|
|
4
|
+
export interface Plugin {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
author?: string;
|
|
9
|
+
onLoad?(core: any): void | Promise<void>;
|
|
10
|
+
onUnload?(): void | Promise<void>;
|
|
11
|
+
blocks?: BlockDefinition[];
|
|
12
|
+
validators?: ValidatorDefinition[];
|
|
13
|
+
serializers?: SerializerDefinition[];
|
|
14
|
+
events?: EventListener[];
|
|
15
|
+
}
|
|
16
|
+
export interface BlockDefinition {
|
|
17
|
+
type: string;
|
|
18
|
+
blockClass: any;
|
|
19
|
+
schema?: any;
|
|
20
|
+
renderer?: any;
|
|
21
|
+
}
|
|
22
|
+
export interface ValidatorDefinition {
|
|
23
|
+
name: string;
|
|
24
|
+
validate: (ast: any) => any;
|
|
25
|
+
}
|
|
26
|
+
export interface SerializerDefinition {
|
|
27
|
+
name: string;
|
|
28
|
+
serialize: (ast: any) => string;
|
|
29
|
+
}
|
|
30
|
+
export interface EventListener {
|
|
31
|
+
event: string;
|
|
32
|
+
handler: (data: any) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare class PluginManager {
|
|
35
|
+
private plugins;
|
|
36
|
+
private loadedPlugins;
|
|
37
|
+
register(plugin: Plugin): void;
|
|
38
|
+
unregister(name: string): void;
|
|
39
|
+
load(name: string, core: any): Promise<void>;
|
|
40
|
+
unload(name: string): Promise<void>;
|
|
41
|
+
get(name: string): Plugin | undefined;
|
|
42
|
+
getAll(): Plugin[];
|
|
43
|
+
getLoaded(): Plugin[];
|
|
44
|
+
isLoaded(name: string): boolean;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=PluginSystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginSystem.d.ts","sourceRoot":"","sources":["../../src/plugin/PluginSystem.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IAGf,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,QAAQ,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAGjC,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;IAC1B,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAClC,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACpC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAA;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,GAAG,CAAA;IACf,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,QAAQ,CAAC,EAAE,GAAG,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAA;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAA;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAA;CAC7B;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,aAAa,CAAoB;IAEzC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAQ9B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIrC,MAAM,IAAI,MAAM,EAAE;IAIlB,SAAS,IAAI,MAAM,EAAE;IAMrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGhC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin system - Core plugin interfaces and manager
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PluginManager = void 0;
|
|
7
|
+
class PluginManager {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.plugins = new Map();
|
|
10
|
+
this.loadedPlugins = new Set();
|
|
11
|
+
}
|
|
12
|
+
register(plugin) {
|
|
13
|
+
if (this.plugins.has(plugin.name)) {
|
|
14
|
+
console.warn(`Plugin ${plugin.name} already registered`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.plugins.set(plugin.name, plugin);
|
|
18
|
+
}
|
|
19
|
+
unregister(name) {
|
|
20
|
+
this.plugins.delete(name);
|
|
21
|
+
this.loadedPlugins.delete(name);
|
|
22
|
+
}
|
|
23
|
+
async load(name, core) {
|
|
24
|
+
const plugin = this.plugins.get(name);
|
|
25
|
+
if (!plugin) {
|
|
26
|
+
throw new Error(`Plugin ${name} not found`);
|
|
27
|
+
}
|
|
28
|
+
if (this.loadedPlugins.has(name)) {
|
|
29
|
+
console.warn(`Plugin ${name} already loaded`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
await plugin.onLoad?.(core);
|
|
33
|
+
this.loadedPlugins.add(name);
|
|
34
|
+
}
|
|
35
|
+
async unload(name) {
|
|
36
|
+
const plugin = this.plugins.get(name);
|
|
37
|
+
if (!plugin)
|
|
38
|
+
return;
|
|
39
|
+
await plugin.onUnload?.();
|
|
40
|
+
this.loadedPlugins.delete(name);
|
|
41
|
+
}
|
|
42
|
+
get(name) {
|
|
43
|
+
return this.plugins.get(name);
|
|
44
|
+
}
|
|
45
|
+
getAll() {
|
|
46
|
+
return Array.from(this.plugins.values());
|
|
47
|
+
}
|
|
48
|
+
getLoaded() {
|
|
49
|
+
return Array.from(this.loadedPlugins)
|
|
50
|
+
.map(name => this.plugins.get(name))
|
|
51
|
+
.filter((p) => p !== undefined);
|
|
52
|
+
}
|
|
53
|
+
isLoaded(name) {
|
|
54
|
+
return this.loadedPlugins.has(name);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.PluginManager = PluginManager;
|
|
58
|
+
//# sourceMappingURL=PluginSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginSystem.js","sourceRoot":"","sources":["../../src/plugin/PluginSystem.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAyCH,MAAa,aAAa;IAA1B;QACU,YAAO,GAAG,IAAI,GAAG,EAAkB,CAAA;QACnC,kBAAa,GAAG,IAAI,GAAG,EAAU,CAAA;IAuD3C,CAAC;IArDC,Q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AA;IACjC,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;aAClC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACnC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAA;IAChD,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;CACF;AAzDD,sCAyDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PluginSystem"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jotx 2.0 AST Types - Pure data structures
|
|
3
|
+
* Abstract Syntax Tree node types for parsed jotx documents
|
|
4
|
+
*/
|
|
5
|
+
import { BlockType, DocumentType } from './enums';
|
|
6
|
+
export type TokenType = 'keyword' | 'identifier' | 'string' | 'enum' | 'number' | 'boolean' | 'operator' | 'newline' | 'indent' | 'eof';
|
|
7
|
+
export interface Token {
|
|
8
|
+
type: TokenType;
|
|
9
|
+
value: string;
|
|
10
|
+
line: number;
|
|
11
|
+
column: number;
|
|
12
|
+
indent?: number;
|
|
13
|
+
raw?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Base block node - every block has this structure
|
|
17
|
+
* Properties bag contains all block-specific data
|
|
18
|
+
*/
|
|
19
|
+
export interface BlockNode {
|
|
20
|
+
type: BlockType | 'item' | 'row' | 'cell' | 'prop';
|
|
21
|
+
id: string;
|
|
22
|
+
properties: Record<string, any>;
|
|
23
|
+
children?: BlockNode[];
|
|
24
|
+
line?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Document metadata - flexible key-value pairs
|
|
28
|
+
*/
|
|
29
|
+
export interface DocumentMetadata {
|
|
30
|
+
title?: string;
|
|
31
|
+
type?: string;
|
|
32
|
+
icon?: string;
|
|
33
|
+
created?: string;
|
|
34
|
+
modified?: string;
|
|
35
|
+
author?: string;
|
|
36
|
+
tags?: string[];
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Document root node
|
|
41
|
+
*/
|
|
42
|
+
export interface DocumentNode {
|
|
43
|
+
type: DocumentType;
|
|
44
|
+
id: string;
|
|
45
|
+
metadata: DocumentMetadata;
|
|
46
|
+
blocks: BlockNode[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Complete AST with validation results
|
|
50
|
+
*/
|
|
51
|
+
export interface AST {
|
|
52
|
+
document: DocumentNode;
|
|
53
|
+
errors: ValidationError[];
|
|
54
|
+
}
|
|
55
|
+
export type ValidationSeverity = 'error' | 'warning';
|
|
56
|
+
export type ValidationErrorType = 'syntax_error' | 'duplicate_id' | 'invalid_enum' | 'missing_required' | 'invalid_type' | 'invalid_property' | 'invalid_block_type' | 'invalid_nesting' | 'invalid_block_schema' | 'invalid_document_type' | 'schema_violation' | 'invalid_metadata';
|
|
57
|
+
export interface ValidationError {
|
|
58
|
+
type: ValidationErrorType;
|
|
59
|
+
message: string;
|
|
60
|
+
severity: ValidationSeverity;
|
|
61
|
+
line?: number;
|
|
62
|
+
column?: number;
|
|
63
|
+
blockId?: string;
|
|
64
|
+
propertyName?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ValidationResult {
|
|
67
|
+
isValid: boolean;
|
|
68
|
+
errors: ValidationError[];
|
|
69
|
+
warnings: ValidationError[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Property schema definition
|
|
73
|
+
*/
|
|
74
|
+
export interface PropertySchema {
|
|
75
|
+
type: 'string' | 'enum' | 'number' | 'boolean';
|
|
76
|
+
required: boolean;
|
|
77
|
+
options?: string[];
|
|
78
|
+
default?: any;
|
|
79
|
+
description?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Block property schemas map
|
|
83
|
+
*/
|
|
84
|
+
export type BlockPropertySchemaMap = Record<string, PropertySchema>;
|
|
85
|
+
/**
|
|
86
|
+
* Property schemas for all 21 block types
|
|
87
|
+
* Defines what properties each block requires/accepts
|
|
88
|
+
*/
|
|
89
|
+
export declare const BLOCK_PROPERTY_SCHEMAS: Record<BlockType, BlockPropertySchemaMap>;
|
|
90
|
+
/**
|
|
91
|
+
* Schema for list items
|
|
92
|
+
*/
|
|
93
|
+
export declare const LIST_ITEM_SCHEMA: BlockPropertySchemaMap;
|
|
94
|
+
/**
|
|
95
|
+
* Schema for checklist items
|
|
96
|
+
*/
|
|
97
|
+
export declare const CHECKLIST_ITEM_SCHEMA: BlockPropertySchemaMap;
|
|
98
|
+
/**
|
|
99
|
+
* Schema for properties props
|
|
100
|
+
*/
|
|
101
|
+
export declare const PROPERTY_SCHEMA: BlockPropertySchemaMap;
|
|
102
|
+
/**
|
|
103
|
+
* Get property schema for a block type
|
|
104
|
+
*/
|
|
105
|
+
export declare function getBlockPropertySchema(blockType: BlockType): BlockPropertySchemaMap | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Check if a property is required for a block type
|
|
108
|
+
*/
|
|
109
|
+
export declare function isPropertyRequired(blockType: BlockType, propertyName: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Get default value for a property
|
|
112
|
+
*/
|
|
113
|
+
export declare function getPropertyDefault(blockType: BlockType, propertyName: string): any;
|
|
114
|
+
/**
|
|
115
|
+
* Validate enum value
|
|
116
|
+
*/
|
|
117
|
+
export declare function isValidEnumValue(blockType: BlockType, propertyName: string, value: string): boolean;
|
|
118
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/types/ast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAMjD,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GAC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