@ollang-dev/sdk 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/tms.js +47 -0
- package/dist/browser/index.d.ts +143 -0
- package/dist/browser/index.js +2336 -0
- package/dist/browser/ollang-browser.min.js +1 -0
- package/dist/browser/script-loader.d.ts +1 -0
- package/dist/browser/script-loader.js +53 -0
- package/dist/client.d.ts +13 -0
- package/dist/client.js +60 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +74 -0
- package/dist/resources/cms.d.ts +29 -0
- package/dist/resources/cms.js +34 -0
- package/dist/resources/customInstructions.d.ts +11 -0
- package/dist/resources/customInstructions.js +24 -0
- package/dist/resources/orders.d.ts +13 -0
- package/dist/resources/orders.js +65 -0
- package/dist/resources/projects.d.ts +8 -0
- package/dist/resources/projects.js +29 -0
- package/dist/resources/revisions.d.ts +9 -0
- package/dist/resources/revisions.js +18 -0
- package/dist/resources/scans.d.ts +38 -0
- package/dist/resources/scans.js +52 -0
- package/dist/resources/uploads.d.ts +8 -0
- package/dist/resources/uploads.js +25 -0
- package/dist/tms/config.d.ts +16 -0
- package/dist/tms/config.js +172 -0
- package/dist/tms/detector/audio-detector.d.ts +27 -0
- package/dist/tms/detector/audio-detector.js +168 -0
- package/dist/tms/detector/auto-detect.d.ts +1 -0
- package/dist/tms/detector/auto-detect.js +152 -0
- package/dist/tms/detector/cms-detector.d.ts +17 -0
- package/dist/tms/detector/cms-detector.js +94 -0
- package/dist/tms/detector/content-type-detector.d.ts +79 -0
- package/dist/tms/detector/content-type-detector.js +2 -0
- package/dist/tms/detector/hardcoded-detector.d.ts +11 -0
- package/dist/tms/detector/hardcoded-detector.js +154 -0
- package/dist/tms/detector/i18n-detector.d.ts +16 -0
- package/dist/tms/detector/i18n-detector.js +311 -0
- package/dist/tms/detector/image-detector.d.ts +11 -0
- package/dist/tms/detector/image-detector.js +170 -0
- package/dist/tms/detector/text-detector.d.ts +9 -0
- package/dist/tms/detector/text-detector.js +35 -0
- package/dist/tms/detector/video-detector.d.ts +12 -0
- package/dist/tms/detector/video-detector.js +188 -0
- package/dist/tms/index.d.ts +12 -0
- package/dist/tms/index.js +38 -0
- package/dist/tms/multi-content-tms.d.ts +42 -0
- package/dist/tms/multi-content-tms.js +230 -0
- package/dist/tms/server/index.d.ts +1 -0
- package/dist/tms/server/index.js +1473 -0
- package/dist/tms/server/strapi-pusher.d.ts +31 -0
- package/dist/tms/server/strapi-pusher.js +296 -0
- package/dist/tms/server/strapi-schema.d.ts +47 -0
- package/dist/tms/server/strapi-schema.js +93 -0
- package/dist/tms/tms.d.ts +48 -0
- package/dist/tms/tms.js +875 -0
- package/dist/tms/types.d.ts +189 -0
- package/dist/tms/types.js +2 -0
- package/dist/tms/ui-dist/assets/index-5U1Hw3uo.css +1 -0
- package/dist/tms/ui-dist/assets/index-HvrqZV5Z.js +149 -0
- package/dist/tms/ui-dist/index.html +14 -0
- package/dist/types/index.d.ts +174 -0
- package/dist/types/index.js +2 -0
- package/package.json +98 -0
package/bin/tms.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Translation Management System CLI
|
|
5
|
+
*
|
|
6
|
+
* Usage: npx @ollang/sdk tms
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { spawn } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
|
|
13
|
+
console.log('🚀 Translation Management System başlatılıyor...\n');
|
|
14
|
+
|
|
15
|
+
const serverPath = path.join(__dirname, '..', 'dist', 'tms', 'server', 'index.js');
|
|
16
|
+
|
|
17
|
+
if (!fs.existsSync(serverPath)) {
|
|
18
|
+
console.error('❌ npm run build');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const server = spawn('node', [serverPath], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
cwd: process.cwd(),
|
|
25
|
+
env: {
|
|
26
|
+
...process.env,
|
|
27
|
+
TMS_PROJECT_ROOT: process.cwd(),
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
process.on('SIGINT', () => {
|
|
32
|
+
console.log('\n\n👋 TMS kapatılıyor...');
|
|
33
|
+
server.kill('SIGINT');
|
|
34
|
+
process.exit(0);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
server.on('error', (error) => {
|
|
38
|
+
console.error('❌ Server başlatılamadı:', error.message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
server.on('exit', (code) => {
|
|
43
|
+
if (code !== 0 && code !== null) {
|
|
44
|
+
console.error(`❌ Server hata ile kapandı (kod: ${code})`);
|
|
45
|
+
process.exit(code);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export interface OllangBrowserConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
projectId?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
tmsServerUrl?: string;
|
|
6
|
+
autoDetectCMS?: boolean;
|
|
7
|
+
cmsType?: 'contentful' | 'strapi' | 'sanity' | 'wordpress' | 'custom';
|
|
8
|
+
strapiUrl?: string;
|
|
9
|
+
captureSelectors?: string[];
|
|
10
|
+
excludeSelectors?: string[];
|
|
11
|
+
captureAttributes?: string[];
|
|
12
|
+
i18nFiles?: string[];
|
|
13
|
+
selectedFolder?: string;
|
|
14
|
+
debounceMs?: number;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
onContentDetected?: (content: CapturedContent[]) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface CapturedContent {
|
|
19
|
+
id: string;
|
|
20
|
+
text: string;
|
|
21
|
+
type: 'cms' | 'dynamic' | 'dynamic-unmatched';
|
|
22
|
+
mediaUrl?: string;
|
|
23
|
+
mediaType?: 'image' | 'video';
|
|
24
|
+
mediaAlt?: string;
|
|
25
|
+
selector: string;
|
|
26
|
+
xpath: string;
|
|
27
|
+
tagName: string;
|
|
28
|
+
attributes: Record<string, string>;
|
|
29
|
+
cmsType?: string;
|
|
30
|
+
cmsField?: string;
|
|
31
|
+
cmsId?: string;
|
|
32
|
+
strapiContentType?: string;
|
|
33
|
+
strapiEntryId?: number;
|
|
34
|
+
strapiField?: string;
|
|
35
|
+
strapiRoute?: string;
|
|
36
|
+
cmsFields?: Record<string, string>;
|
|
37
|
+
url: string;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
parentContext?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare class OllangBrowser {
|
|
42
|
+
private config;
|
|
43
|
+
private observer;
|
|
44
|
+
private capturedContent;
|
|
45
|
+
private i18nTexts;
|
|
46
|
+
private i18nNormalized;
|
|
47
|
+
private excludedTexts;
|
|
48
|
+
private selectedContentIds;
|
|
49
|
+
private folders;
|
|
50
|
+
private selectedFolder;
|
|
51
|
+
private strapiContentMap;
|
|
52
|
+
private strapiMediaMap;
|
|
53
|
+
private detectedStrapiUrls;
|
|
54
|
+
private strapiEntries;
|
|
55
|
+
private strapiLongTextMap;
|
|
56
|
+
private capturedTexts;
|
|
57
|
+
private readonly apiKeyStorageKey;
|
|
58
|
+
constructor(config: OllangBrowserConfig);
|
|
59
|
+
private getStoredApiKey;
|
|
60
|
+
private saveApiKey;
|
|
61
|
+
private init;
|
|
62
|
+
private interceptApiCalls;
|
|
63
|
+
private interceptFetch;
|
|
64
|
+
private interceptXHR;
|
|
65
|
+
private isStrapiApiUrl;
|
|
66
|
+
private extractContentTypeFromUrl;
|
|
67
|
+
private processStrapiResponse;
|
|
68
|
+
private static readonly MAX_FIELD_LENGTH;
|
|
69
|
+
private static readonly LONG_TEXT_FIELDS;
|
|
70
|
+
private static readonly MAX_RECURSION_DEPTH;
|
|
71
|
+
private static readonly SKIP_RELATION_KEYS;
|
|
72
|
+
private extractStrapiFields;
|
|
73
|
+
private isStrapiMediaObject;
|
|
74
|
+
private extractStrapiMedia;
|
|
75
|
+
private extractParagraphsFromHtml;
|
|
76
|
+
private static readonly SKIP_KEYS;
|
|
77
|
+
private isNonTranslatableField;
|
|
78
|
+
private normalizeText;
|
|
79
|
+
private findStrapiMatch;
|
|
80
|
+
private isI18nText;
|
|
81
|
+
private detectFrameworkI18n;
|
|
82
|
+
private getAngularTranslations;
|
|
83
|
+
private loadI18nFiles;
|
|
84
|
+
private extractTextsFromObject;
|
|
85
|
+
private startCapture;
|
|
86
|
+
private detectCMS;
|
|
87
|
+
private startObserving;
|
|
88
|
+
private handleMutations;
|
|
89
|
+
private captureApiContent;
|
|
90
|
+
private scanPage;
|
|
91
|
+
private scanMediaElements;
|
|
92
|
+
private scanElement;
|
|
93
|
+
private getDirectText;
|
|
94
|
+
private isLikelyStaticContent;
|
|
95
|
+
private createCapturedContent;
|
|
96
|
+
private extractCMSField;
|
|
97
|
+
private extractCMSId;
|
|
98
|
+
private extractAttributes;
|
|
99
|
+
private generateSelector;
|
|
100
|
+
private generateXPath;
|
|
101
|
+
private generateId;
|
|
102
|
+
capture(): CapturedContent[];
|
|
103
|
+
private groupCmsEntries;
|
|
104
|
+
getCapturedContent(): CapturedContent[];
|
|
105
|
+
getCmsContent(): CapturedContent[];
|
|
106
|
+
getStrapiMetadata(): {
|
|
107
|
+
trackedTexts: number;
|
|
108
|
+
entries: number;
|
|
109
|
+
detectedUrls: string[];
|
|
110
|
+
cmsType: string | undefined;
|
|
111
|
+
};
|
|
112
|
+
clear(): void;
|
|
113
|
+
destroy(): void;
|
|
114
|
+
addI18nTexts(texts: string[] | Record<string, any>): void;
|
|
115
|
+
getI18nTextsCount(): number;
|
|
116
|
+
private getEntryRoutes;
|
|
117
|
+
showDebugPanel(): Promise<void>;
|
|
118
|
+
private validateApiKey;
|
|
119
|
+
private showApiKeyFormInPanel;
|
|
120
|
+
private showPanelContent;
|
|
121
|
+
private createDebugPanel;
|
|
122
|
+
private updateStats;
|
|
123
|
+
private showContent;
|
|
124
|
+
private updateSelectionInfo;
|
|
125
|
+
private exportContent;
|
|
126
|
+
private escapeHtml;
|
|
127
|
+
private showStatus;
|
|
128
|
+
private hideStatus;
|
|
129
|
+
private loadFolders;
|
|
130
|
+
private updateFolderOptions;
|
|
131
|
+
private showNewFolderDialog;
|
|
132
|
+
private fetchStrapiSchemaInPanel;
|
|
133
|
+
private pushToTMS;
|
|
134
|
+
}
|
|
135
|
+
declare global {
|
|
136
|
+
interface Window {
|
|
137
|
+
__CONTENTFUL_SPACE_ID__?: string;
|
|
138
|
+
__STRAPI__?: any;
|
|
139
|
+
__SANITY__?: any;
|
|
140
|
+
wp?: any;
|
|
141
|
+
Ollang?: typeof OllangBrowser;
|
|
142
|
+
}
|
|
143
|
+
}
|