@uniformdev/tms-phrase 19.135.1-alpha.11
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/LICENSE.txt +2 -0
- package/dist/index.d.mts +189 -0
- package/dist/index.d.ts +189 -0
- package/dist/index.esm.js +432 -0
- package/dist/index.js +460 -0
- package/dist/index.mjs +432 -0
- package/package.json +43 -0
package/LICENSE.txt
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { TranslationPayload } from '@uniformdev/tms-sdk';
|
|
2
|
+
|
|
3
|
+
declare const buildPhraseJobFileName: ({ uniformProjectId, uniformEntityId, prefix, }: {
|
|
4
|
+
uniformProjectId: string;
|
|
5
|
+
uniformEntityId: string;
|
|
6
|
+
prefix?: string | null | undefined;
|
|
7
|
+
}) => string | null;
|
|
8
|
+
declare const parsePhraseJobFileName: (jobFileName: string) => {
|
|
9
|
+
uniformProjectId: string;
|
|
10
|
+
uniformEntityId: string;
|
|
11
|
+
} | null;
|
|
12
|
+
|
|
13
|
+
type AuthRequestPayload = {
|
|
14
|
+
apiHost: string;
|
|
15
|
+
userName: string;
|
|
16
|
+
password: string;
|
|
17
|
+
};
|
|
18
|
+
type PhraseAuthToken = {
|
|
19
|
+
token: string;
|
|
20
|
+
expires: number;
|
|
21
|
+
};
|
|
22
|
+
type SessionAuthToken = {
|
|
23
|
+
hash: string;
|
|
24
|
+
authToken: PhraseAuthToken;
|
|
25
|
+
};
|
|
26
|
+
type PhraseApiRequestPayload = {
|
|
27
|
+
phraseApiUrl: string;
|
|
28
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
body?: Record<string, unknown>;
|
|
31
|
+
apiToken?: string;
|
|
32
|
+
};
|
|
33
|
+
type ListApiResponse<TItem> = {
|
|
34
|
+
totalElements: number;
|
|
35
|
+
totalPages: number;
|
|
36
|
+
pageSize: number;
|
|
37
|
+
pageNumber: number;
|
|
38
|
+
numberOfElements: number;
|
|
39
|
+
content: TItem[];
|
|
40
|
+
};
|
|
41
|
+
type ProjectsResponseItem = {
|
|
42
|
+
uid: string;
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
sourceLang: string;
|
|
46
|
+
targetLangs: string[];
|
|
47
|
+
};
|
|
48
|
+
type JobsResponseItem = {
|
|
49
|
+
continuous: boolean;
|
|
50
|
+
dateCreated: string;
|
|
51
|
+
dateDue: string;
|
|
52
|
+
filename: string;
|
|
53
|
+
importStatus: {
|
|
54
|
+
status: string;
|
|
55
|
+
errorMessage?: string;
|
|
56
|
+
};
|
|
57
|
+
imported: boolean;
|
|
58
|
+
innerId: string;
|
|
59
|
+
originalFileDirectory: string;
|
|
60
|
+
owner: {
|
|
61
|
+
userName: string;
|
|
62
|
+
uid: string;
|
|
63
|
+
id: string;
|
|
64
|
+
firstName: string;
|
|
65
|
+
};
|
|
66
|
+
providers: {
|
|
67
|
+
type: 'string';
|
|
68
|
+
id: 'string';
|
|
69
|
+
uid: 'string';
|
|
70
|
+
}[];
|
|
71
|
+
serverTaskId: string;
|
|
72
|
+
sourceFileUid: string;
|
|
73
|
+
split: boolean;
|
|
74
|
+
status: JobStatus;
|
|
75
|
+
targetLang: string;
|
|
76
|
+
uid: string;
|
|
77
|
+
};
|
|
78
|
+
type ProjectProvider = {
|
|
79
|
+
id: string;
|
|
80
|
+
uid: string;
|
|
81
|
+
} & ({
|
|
82
|
+
type: 'USER';
|
|
83
|
+
userName: string;
|
|
84
|
+
firstName: string;
|
|
85
|
+
lastName: string;
|
|
86
|
+
email: string;
|
|
87
|
+
active: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
type: 'VENDOR';
|
|
90
|
+
name: string;
|
|
91
|
+
defaultProjectOwnerId: number;
|
|
92
|
+
});
|
|
93
|
+
type ProjectFileImportSettings = {
|
|
94
|
+
inputCharset?: string;
|
|
95
|
+
outputCharset?: string;
|
|
96
|
+
zipCharset?: string;
|
|
97
|
+
fileFormat?: string;
|
|
98
|
+
autodetectMultilingualFiles?: boolean;
|
|
99
|
+
targetLength?: boolean;
|
|
100
|
+
targetLengthMax?: number;
|
|
101
|
+
targetLengthPercent?: boolean;
|
|
102
|
+
targetLengthPercentValue?: number;
|
|
103
|
+
json?: {
|
|
104
|
+
tagRegexp?: string;
|
|
105
|
+
htmlSubFilter?: boolean;
|
|
106
|
+
icuSubFilter?: boolean;
|
|
107
|
+
excludeKeyRegexp?: string;
|
|
108
|
+
includeKeyRegexp?: string;
|
|
109
|
+
contextNotePath?: string;
|
|
110
|
+
maxLenPath?: string;
|
|
111
|
+
contextKeyPath?: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
type CreateJobApiResponse = {
|
|
115
|
+
jobs?: {
|
|
116
|
+
uid: string;
|
|
117
|
+
}[];
|
|
118
|
+
};
|
|
119
|
+
type JobStatus = 'NEW' | 'EMAILED' | 'ACCEPTED' | 'COMPLETED' | 'DELIVERED' | 'CANCELLED' | 'DECLINED' | 'REJECTED';
|
|
120
|
+
type AsyncRequestIdApiResponse = {
|
|
121
|
+
asyncRequest?: {
|
|
122
|
+
id: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
type PhraseWebhookPayload = {
|
|
126
|
+
event: string;
|
|
127
|
+
eventUid: string;
|
|
128
|
+
timestamp: number;
|
|
129
|
+
jobParts: {
|
|
130
|
+
id: string;
|
|
131
|
+
uid: string;
|
|
132
|
+
internalId: string;
|
|
133
|
+
status: WebhookJobStatus;
|
|
134
|
+
fileName: string;
|
|
135
|
+
project: {
|
|
136
|
+
uid: string;
|
|
137
|
+
};
|
|
138
|
+
}[];
|
|
139
|
+
};
|
|
140
|
+
type WebhookJobStatus = 'NEW' | 'EMAILED' | 'ASSIGNED' | 'COMPLETED_BY_LINGUIST' | 'COMPLETED' | 'CANCELLED' | 'DECLINED_BY_LINGUIST' | 'REJECTED_BY_LINGUIST';
|
|
141
|
+
|
|
142
|
+
type PhraseTmsClientOptions = {
|
|
143
|
+
proxyUrl?: string;
|
|
144
|
+
apiHost: string;
|
|
145
|
+
userName: string;
|
|
146
|
+
password: string;
|
|
147
|
+
};
|
|
148
|
+
declare class PhraseTmsClient {
|
|
149
|
+
#private;
|
|
150
|
+
constructor(options: PhraseTmsClientOptions);
|
|
151
|
+
checkCredentials(): Promise<boolean>;
|
|
152
|
+
/**
|
|
153
|
+
* https://cloud.memsource.com/web/docs/api#operation/listProjects
|
|
154
|
+
*/
|
|
155
|
+
listProjects(): Promise<ProjectsResponseItem[]>;
|
|
156
|
+
getProject(projectUid: string): Promise<ProjectsResponseItem | null>;
|
|
157
|
+
/**
|
|
158
|
+
* https://cloud.memsource.com/web/docs/api#operation/getImportSettingsForProject
|
|
159
|
+
*/
|
|
160
|
+
getProjectFileImportSettings(projectUid: string): Promise<ProjectFileImportSettings | null>;
|
|
161
|
+
setProjectFileImportSettings(projectUid: string, importSettings: ProjectFileImportSettings): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* https://cloud.memsource.com/web/docs/api#operation/listPartsV2
|
|
164
|
+
*/
|
|
165
|
+
listProjectJobs(projectUid: string, options?: {
|
|
166
|
+
status?: JobStatus[];
|
|
167
|
+
fileName?: string;
|
|
168
|
+
}): Promise<JobsResponseItem[]>;
|
|
169
|
+
listProjectProviders(projectUid: string): Promise<ProjectProvider[]>;
|
|
170
|
+
createTranslationJobFromPayload({ projectUid, dueDate, provider, payload, }: {
|
|
171
|
+
projectUid: string;
|
|
172
|
+
dueDate?: string;
|
|
173
|
+
provider?: ProjectProvider;
|
|
174
|
+
payload: TranslationPayload;
|
|
175
|
+
}): Promise<string | null>;
|
|
176
|
+
downloadTargetFile<TResult>({ projectUid, jobUid, getAsyncRequestMaxAttempts, getAsyncRequestDelayMs, }: {
|
|
177
|
+
projectUid: string;
|
|
178
|
+
jobUid: string;
|
|
179
|
+
getAsyncRequestMaxAttempts?: number;
|
|
180
|
+
getAsyncRequestDelayMs?: number;
|
|
181
|
+
}): Promise<TResult | null>;
|
|
182
|
+
setJobStatus({ projectUid, jobUid, jobStatus, }: {
|
|
183
|
+
projectUid: string;
|
|
184
|
+
jobUid: string;
|
|
185
|
+
jobStatus: JobStatus;
|
|
186
|
+
}): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { type AsyncRequestIdApiResponse, type AuthRequestPayload, type CreateJobApiResponse, type JobStatus, type JobsResponseItem, type ListApiResponse, type PhraseApiRequestPayload, type PhraseAuthToken, PhraseTmsClient, type PhraseTmsClientOptions, type PhraseWebhookPayload, type ProjectFileImportSettings, type ProjectProvider, type ProjectsResponseItem, type SessionAuthToken, buildPhraseJobFileName, parsePhraseJobFileName };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { TranslationPayload } from '@uniformdev/tms-sdk';
|
|
2
|
+
|
|
3
|
+
declare const buildPhraseJobFileName: ({ uniformProjectId, uniformEntityId, prefix, }: {
|
|
4
|
+
uniformProjectId: string;
|
|
5
|
+
uniformEntityId: string;
|
|
6
|
+
prefix?: string | null | undefined;
|
|
7
|
+
}) => string | null;
|
|
8
|
+
declare const parsePhraseJobFileName: (jobFileName: string) => {
|
|
9
|
+
uniformProjectId: string;
|
|
10
|
+
uniformEntityId: string;
|
|
11
|
+
} | null;
|
|
12
|
+
|
|
13
|
+
type AuthRequestPayload = {
|
|
14
|
+
apiHost: string;
|
|
15
|
+
userName: string;
|
|
16
|
+
password: string;
|
|
17
|
+
};
|
|
18
|
+
type PhraseAuthToken = {
|
|
19
|
+
token: string;
|
|
20
|
+
expires: number;
|
|
21
|
+
};
|
|
22
|
+
type SessionAuthToken = {
|
|
23
|
+
hash: string;
|
|
24
|
+
authToken: PhraseAuthToken;
|
|
25
|
+
};
|
|
26
|
+
type PhraseApiRequestPayload = {
|
|
27
|
+
phraseApiUrl: string;
|
|
28
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH';
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
body?: Record<string, unknown>;
|
|
31
|
+
apiToken?: string;
|
|
32
|
+
};
|
|
33
|
+
type ListApiResponse<TItem> = {
|
|
34
|
+
totalElements: number;
|
|
35
|
+
totalPages: number;
|
|
36
|
+
pageSize: number;
|
|
37
|
+
pageNumber: number;
|
|
38
|
+
numberOfElements: number;
|
|
39
|
+
content: TItem[];
|
|
40
|
+
};
|
|
41
|
+
type ProjectsResponseItem = {
|
|
42
|
+
uid: string;
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
sourceLang: string;
|
|
46
|
+
targetLangs: string[];
|
|
47
|
+
};
|
|
48
|
+
type JobsResponseItem = {
|
|
49
|
+
continuous: boolean;
|
|
50
|
+
dateCreated: string;
|
|
51
|
+
dateDue: string;
|
|
52
|
+
filename: string;
|
|
53
|
+
importStatus: {
|
|
54
|
+
status: string;
|
|
55
|
+
errorMessage?: string;
|
|
56
|
+
};
|
|
57
|
+
imported: boolean;
|
|
58
|
+
innerId: string;
|
|
59
|
+
originalFileDirectory: string;
|
|
60
|
+
owner: {
|
|
61
|
+
userName: string;
|
|
62
|
+
uid: string;
|
|
63
|
+
id: string;
|
|
64
|
+
firstName: string;
|
|
65
|
+
};
|
|
66
|
+
providers: {
|
|
67
|
+
type: 'string';
|
|
68
|
+
id: 'string';
|
|
69
|
+
uid: 'string';
|
|
70
|
+
}[];
|
|
71
|
+
serverTaskId: string;
|
|
72
|
+
sourceFileUid: string;
|
|
73
|
+
split: boolean;
|
|
74
|
+
status: JobStatus;
|
|
75
|
+
targetLang: string;
|
|
76
|
+
uid: string;
|
|
77
|
+
};
|
|
78
|
+
type ProjectProvider = {
|
|
79
|
+
id: string;
|
|
80
|
+
uid: string;
|
|
81
|
+
} & ({
|
|
82
|
+
type: 'USER';
|
|
83
|
+
userName: string;
|
|
84
|
+
firstName: string;
|
|
85
|
+
lastName: string;
|
|
86
|
+
email: string;
|
|
87
|
+
active: boolean;
|
|
88
|
+
} | {
|
|
89
|
+
type: 'VENDOR';
|
|
90
|
+
name: string;
|
|
91
|
+
defaultProjectOwnerId: number;
|
|
92
|
+
});
|
|
93
|
+
type ProjectFileImportSettings = {
|
|
94
|
+
inputCharset?: string;
|
|
95
|
+
outputCharset?: string;
|
|
96
|
+
zipCharset?: string;
|
|
97
|
+
fileFormat?: string;
|
|
98
|
+
autodetectMultilingualFiles?: boolean;
|
|
99
|
+
targetLength?: boolean;
|
|
100
|
+
targetLengthMax?: number;
|
|
101
|
+
targetLengthPercent?: boolean;
|
|
102
|
+
targetLengthPercentValue?: number;
|
|
103
|
+
json?: {
|
|
104
|
+
tagRegexp?: string;
|
|
105
|
+
htmlSubFilter?: boolean;
|
|
106
|
+
icuSubFilter?: boolean;
|
|
107
|
+
excludeKeyRegexp?: string;
|
|
108
|
+
includeKeyRegexp?: string;
|
|
109
|
+
contextNotePath?: string;
|
|
110
|
+
maxLenPath?: string;
|
|
111
|
+
contextKeyPath?: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
type CreateJobApiResponse = {
|
|
115
|
+
jobs?: {
|
|
116
|
+
uid: string;
|
|
117
|
+
}[];
|
|
118
|
+
};
|
|
119
|
+
type JobStatus = 'NEW' | 'EMAILED' | 'ACCEPTED' | 'COMPLETED' | 'DELIVERED' | 'CANCELLED' | 'DECLINED' | 'REJECTED';
|
|
120
|
+
type AsyncRequestIdApiResponse = {
|
|
121
|
+
asyncRequest?: {
|
|
122
|
+
id: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
type PhraseWebhookPayload = {
|
|
126
|
+
event: string;
|
|
127
|
+
eventUid: string;
|
|
128
|
+
timestamp: number;
|
|
129
|
+
jobParts: {
|
|
130
|
+
id: string;
|
|
131
|
+
uid: string;
|
|
132
|
+
internalId: string;
|
|
133
|
+
status: WebhookJobStatus;
|
|
134
|
+
fileName: string;
|
|
135
|
+
project: {
|
|
136
|
+
uid: string;
|
|
137
|
+
};
|
|
138
|
+
}[];
|
|
139
|
+
};
|
|
140
|
+
type WebhookJobStatus = 'NEW' | 'EMAILED' | 'ASSIGNED' | 'COMPLETED_BY_LINGUIST' | 'COMPLETED' | 'CANCELLED' | 'DECLINED_BY_LINGUIST' | 'REJECTED_BY_LINGUIST';
|
|
141
|
+
|
|
142
|
+
type PhraseTmsClientOptions = {
|
|
143
|
+
proxyUrl?: string;
|
|
144
|
+
apiHost: string;
|
|
145
|
+
userName: string;
|
|
146
|
+
password: string;
|
|
147
|
+
};
|
|
148
|
+
declare class PhraseTmsClient {
|
|
149
|
+
#private;
|
|
150
|
+
constructor(options: PhraseTmsClientOptions);
|
|
151
|
+
checkCredentials(): Promise<boolean>;
|
|
152
|
+
/**
|
|
153
|
+
* https://cloud.memsource.com/web/docs/api#operation/listProjects
|
|
154
|
+
*/
|
|
155
|
+
listProjects(): Promise<ProjectsResponseItem[]>;
|
|
156
|
+
getProject(projectUid: string): Promise<ProjectsResponseItem | null>;
|
|
157
|
+
/**
|
|
158
|
+
* https://cloud.memsource.com/web/docs/api#operation/getImportSettingsForProject
|
|
159
|
+
*/
|
|
160
|
+
getProjectFileImportSettings(projectUid: string): Promise<ProjectFileImportSettings | null>;
|
|
161
|
+
setProjectFileImportSettings(projectUid: string, importSettings: ProjectFileImportSettings): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* https://cloud.memsource.com/web/docs/api#operation/listPartsV2
|
|
164
|
+
*/
|
|
165
|
+
listProjectJobs(projectUid: string, options?: {
|
|
166
|
+
status?: JobStatus[];
|
|
167
|
+
fileName?: string;
|
|
168
|
+
}): Promise<JobsResponseItem[]>;
|
|
169
|
+
listProjectProviders(projectUid: string): Promise<ProjectProvider[]>;
|
|
170
|
+
createTranslationJobFromPayload({ projectUid, dueDate, provider, payload, }: {
|
|
171
|
+
projectUid: string;
|
|
172
|
+
dueDate?: string;
|
|
173
|
+
provider?: ProjectProvider;
|
|
174
|
+
payload: TranslationPayload;
|
|
175
|
+
}): Promise<string | null>;
|
|
176
|
+
downloadTargetFile<TResult>({ projectUid, jobUid, getAsyncRequestMaxAttempts, getAsyncRequestDelayMs, }: {
|
|
177
|
+
projectUid: string;
|
|
178
|
+
jobUid: string;
|
|
179
|
+
getAsyncRequestMaxAttempts?: number;
|
|
180
|
+
getAsyncRequestDelayMs?: number;
|
|
181
|
+
}): Promise<TResult | null>;
|
|
182
|
+
setJobStatus({ projectUid, jobUid, jobStatus, }: {
|
|
183
|
+
projectUid: string;
|
|
184
|
+
jobUid: string;
|
|
185
|
+
jobStatus: JobStatus;
|
|
186
|
+
}): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { type AsyncRequestIdApiResponse, type AuthRequestPayload, type CreateJobApiResponse, type JobStatus, type JobsResponseItem, type ListApiResponse, type PhraseApiRequestPayload, type PhraseAuthToken, PhraseTmsClient, type PhraseTmsClientOptions, type PhraseWebhookPayload, type ProjectFileImportSettings, type ProjectProvider, type ProjectsResponseItem, type SessionAuthToken, buildPhraseJobFileName, parsePhraseJobFileName };
|