@lokalise/tm-events-schemas 1.0.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 +3 -0
- package/dist/events/import.d.ts +212 -0
- package/dist/events/import.js +35 -0
- package/dist/events/import.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { type ConsumerMessageSchema, type PublisherMessageSchema } from '@message-queue-toolkit/schemas';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const TM_IMPORT_TOPIC = "translation-memory-import";
|
|
4
|
+
export declare const BASE_IMPORT_EVENT_PAYLOAD_SCHEMA: z.ZodObject<{
|
|
5
|
+
importProcess: z.ZodObject<{
|
|
6
|
+
id: z.ZodGUID;
|
|
7
|
+
groupId: z.ZodString;
|
|
8
|
+
fileName: z.ZodString;
|
|
9
|
+
inputFileStorageId: z.ZodGUID;
|
|
10
|
+
status: z.ZodEnum<{
|
|
11
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
12
|
+
readonly COMPLETED: "COMPLETED";
|
|
13
|
+
readonly FAILED: "FAILED";
|
|
14
|
+
}>;
|
|
15
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
16
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
17
|
+
createdAt: z.ZodISODateTime;
|
|
18
|
+
updatedAt: z.ZodISODateTime;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type BaseImportEventPayload = z.infer<typeof BASE_IMPORT_EVENT_PAYLOAD_SCHEMA>;
|
|
22
|
+
/**
|
|
23
|
+
* Event definitions
|
|
24
|
+
*/
|
|
25
|
+
export declare const TmImportEvents: {
|
|
26
|
+
'import.completed': {
|
|
27
|
+
snsTopic: string;
|
|
28
|
+
producedBy: string[];
|
|
29
|
+
consumerSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
timestamp: z.ZodISODateTime;
|
|
32
|
+
type: z.ZodLiteral<"import.completed">;
|
|
33
|
+
deduplicationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
deduplicationOptions: z.ZodOptional<z.ZodNullable<typeof import("@message-queue-toolkit/schemas").MESSAGE_DEDUPLICATION_OPTIONS_SCHEMA>>;
|
|
35
|
+
payload: z.ZodObject<{
|
|
36
|
+
importProcess: z.ZodObject<{
|
|
37
|
+
id: z.ZodGUID;
|
|
38
|
+
groupId: z.ZodString;
|
|
39
|
+
fileName: z.ZodString;
|
|
40
|
+
inputFileStorageId: z.ZodGUID;
|
|
41
|
+
status: z.ZodEnum<{
|
|
42
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
43
|
+
readonly COMPLETED: "COMPLETED";
|
|
44
|
+
readonly FAILED: "FAILED";
|
|
45
|
+
}>;
|
|
46
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
47
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
48
|
+
createdAt: z.ZodISODateTime;
|
|
49
|
+
updatedAt: z.ZodISODateTime;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
metadata: import("@message-queue-toolkit/schemas").MetadataObject;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
publisherSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodOptional<z.ZodString>;
|
|
56
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
57
|
+
type: z.ZodLiteral<"import.completed">;
|
|
58
|
+
deduplicationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
deduplicationOptions: z.ZodOptional<z.ZodNullable<typeof import("@message-queue-toolkit/schemas").MESSAGE_DEDUPLICATION_OPTIONS_SCHEMA>>;
|
|
60
|
+
payload: z.ZodObject<{
|
|
61
|
+
importProcess: z.ZodObject<{
|
|
62
|
+
id: z.ZodGUID;
|
|
63
|
+
groupId: z.ZodString;
|
|
64
|
+
fileName: z.ZodString;
|
|
65
|
+
inputFileStorageId: z.ZodGUID;
|
|
66
|
+
status: z.ZodEnum<{
|
|
67
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
68
|
+
readonly COMPLETED: "COMPLETED";
|
|
69
|
+
readonly FAILED: "FAILED";
|
|
70
|
+
}>;
|
|
71
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
72
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
73
|
+
createdAt: z.ZodISODateTime;
|
|
74
|
+
updatedAt: z.ZodISODateTime;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
79
|
+
producedBy: z.ZodOptional<z.ZodString>;
|
|
80
|
+
originatedFrom: z.ZodOptional<z.ZodString>;
|
|
81
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}>>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
};
|
|
85
|
+
'import.failed': {
|
|
86
|
+
snsTopic: string;
|
|
87
|
+
producedBy: string[];
|
|
88
|
+
consumerSchema: z.ZodObject<{
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
timestamp: z.ZodISODateTime;
|
|
91
|
+
type: z.ZodLiteral<"import.failed">;
|
|
92
|
+
deduplicationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
|
+
deduplicationOptions: z.ZodOptional<z.ZodNullable<typeof import("@message-queue-toolkit/schemas").MESSAGE_DEDUPLICATION_OPTIONS_SCHEMA>>;
|
|
94
|
+
payload: z.ZodObject<{
|
|
95
|
+
importProcess: z.ZodObject<{
|
|
96
|
+
id: z.ZodGUID;
|
|
97
|
+
groupId: z.ZodString;
|
|
98
|
+
fileName: z.ZodString;
|
|
99
|
+
inputFileStorageId: z.ZodGUID;
|
|
100
|
+
status: z.ZodEnum<{
|
|
101
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
102
|
+
readonly COMPLETED: "COMPLETED";
|
|
103
|
+
readonly FAILED: "FAILED";
|
|
104
|
+
}>;
|
|
105
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
106
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
107
|
+
createdAt: z.ZodISODateTime;
|
|
108
|
+
updatedAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strip>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
metadata: import("@message-queue-toolkit/schemas").MetadataObject;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
publisherSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodOptional<z.ZodString>;
|
|
115
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
116
|
+
type: z.ZodLiteral<"import.failed">;
|
|
117
|
+
deduplicationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
118
|
+
deduplicationOptions: z.ZodOptional<z.ZodNullable<typeof import("@message-queue-toolkit/schemas").MESSAGE_DEDUPLICATION_OPTIONS_SCHEMA>>;
|
|
119
|
+
payload: z.ZodObject<{
|
|
120
|
+
importProcess: z.ZodObject<{
|
|
121
|
+
id: z.ZodGUID;
|
|
122
|
+
groupId: z.ZodString;
|
|
123
|
+
fileName: z.ZodString;
|
|
124
|
+
inputFileStorageId: z.ZodGUID;
|
|
125
|
+
status: z.ZodEnum<{
|
|
126
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
127
|
+
readonly COMPLETED: "COMPLETED";
|
|
128
|
+
readonly FAILED: "FAILED";
|
|
129
|
+
}>;
|
|
130
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
131
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
132
|
+
createdAt: z.ZodISODateTime;
|
|
133
|
+
updatedAt: z.ZodISODateTime;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
138
|
+
producedBy: z.ZodOptional<z.ZodString>;
|
|
139
|
+
originatedFrom: z.ZodOptional<z.ZodString>;
|
|
140
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}>>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
};
|
|
144
|
+
'import.progress_updated': {
|
|
145
|
+
snsTopic: string;
|
|
146
|
+
producedBy: string[];
|
|
147
|
+
consumerSchema: z.ZodObject<{
|
|
148
|
+
id: z.ZodString;
|
|
149
|
+
timestamp: z.ZodISODateTime;
|
|
150
|
+
type: z.ZodLiteral<"import.progress_updated">;
|
|
151
|
+
deduplicationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
152
|
+
deduplicationOptions: z.ZodOptional<z.ZodNullable<typeof import("@message-queue-toolkit/schemas").MESSAGE_DEDUPLICATION_OPTIONS_SCHEMA>>;
|
|
153
|
+
payload: z.ZodObject<{
|
|
154
|
+
importProcess: z.ZodObject<{
|
|
155
|
+
id: z.ZodGUID;
|
|
156
|
+
groupId: z.ZodString;
|
|
157
|
+
fileName: z.ZodString;
|
|
158
|
+
inputFileStorageId: z.ZodGUID;
|
|
159
|
+
status: z.ZodEnum<{
|
|
160
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
161
|
+
readonly COMPLETED: "COMPLETED";
|
|
162
|
+
readonly FAILED: "FAILED";
|
|
163
|
+
}>;
|
|
164
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
165
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
166
|
+
createdAt: z.ZodISODateTime;
|
|
167
|
+
updatedAt: z.ZodISODateTime;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
metadata: import("@message-queue-toolkit/schemas").MetadataObject;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
publisherSchema: z.ZodObject<{
|
|
173
|
+
id: z.ZodOptional<z.ZodString>;
|
|
174
|
+
timestamp: z.ZodOptional<z.ZodISODateTime>;
|
|
175
|
+
type: z.ZodLiteral<"import.progress_updated">;
|
|
176
|
+
deduplicationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
177
|
+
deduplicationOptions: z.ZodOptional<z.ZodNullable<typeof import("@message-queue-toolkit/schemas").MESSAGE_DEDUPLICATION_OPTIONS_SCHEMA>>;
|
|
178
|
+
payload: z.ZodObject<{
|
|
179
|
+
importProcess: z.ZodObject<{
|
|
180
|
+
id: z.ZodGUID;
|
|
181
|
+
groupId: z.ZodString;
|
|
182
|
+
fileName: z.ZodString;
|
|
183
|
+
inputFileStorageId: z.ZodGUID;
|
|
184
|
+
status: z.ZodEnum<{
|
|
185
|
+
readonly IN_PROGRESS: "IN_PROGRESS";
|
|
186
|
+
readonly COMPLETED: "COMPLETED";
|
|
187
|
+
readonly FAILED: "FAILED";
|
|
188
|
+
}>;
|
|
189
|
+
progress: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
190
|
+
upsertedRecordsCount: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
191
|
+
createdAt: z.ZodISODateTime;
|
|
192
|
+
updatedAt: z.ZodISODateTime;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
196
|
+
schemaVersion: z.ZodOptional<z.ZodString>;
|
|
197
|
+
producedBy: z.ZodOptional<z.ZodString>;
|
|
198
|
+
originatedFrom: z.ZodOptional<z.ZodString>;
|
|
199
|
+
correlationId: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}>>;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Event types
|
|
206
|
+
*/
|
|
207
|
+
export type ImportCompletedConsumerEvent = ConsumerMessageSchema<(typeof TmImportEvents)['import.completed']>;
|
|
208
|
+
export type ImportCompletedPublisherEvent = PublisherMessageSchema<(typeof TmImportEvents)['import.completed']>;
|
|
209
|
+
export type ImportFailedConsumerEvent = ConsumerMessageSchema<(typeof TmImportEvents)['import.failed']>;
|
|
210
|
+
export type ImportFailedPublisherEvent = PublisherMessageSchema<(typeof TmImportEvents)['import.failed']>;
|
|
211
|
+
export type ImportProgressUpdatedConsumerEvent = ConsumerMessageSchema<(typeof TmImportEvents)['import.progress_updated']>;
|
|
212
|
+
export type ImportProgressUpdatedPublisherEvent = PublisherMessageSchema<(typeof TmImportEvents)['import.progress_updated']>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IMPORT_PROCESS_SCHEMA } from '@lokalise/tm-api-schemas';
|
|
2
|
+
import { enrichMessageSchemaWithBase, } from '@message-queue-toolkit/schemas';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
export const TM_IMPORT_TOPIC = 'translation-memory-import';
|
|
5
|
+
const TRANSLATION_MEMORY_SERVICE = 'translation-memory';
|
|
6
|
+
export const BASE_IMPORT_EVENT_PAYLOAD_SCHEMA = z.object({
|
|
7
|
+
importProcess: IMPORT_PROCESS_SCHEMA,
|
|
8
|
+
});
|
|
9
|
+
/**
|
|
10
|
+
* Event definitions
|
|
11
|
+
*/
|
|
12
|
+
export const TmImportEvents = {
|
|
13
|
+
'import.completed': {
|
|
14
|
+
...enrichMessageSchemaWithBase('import.completed', BASE_IMPORT_EVENT_PAYLOAD_SCHEMA, {
|
|
15
|
+
description: 'Indicates that TM import was completed successfully',
|
|
16
|
+
}),
|
|
17
|
+
snsTopic: TM_IMPORT_TOPIC,
|
|
18
|
+
producedBy: [TRANSLATION_MEMORY_SERVICE],
|
|
19
|
+
},
|
|
20
|
+
'import.failed': {
|
|
21
|
+
...enrichMessageSchemaWithBase('import.failed', BASE_IMPORT_EVENT_PAYLOAD_SCHEMA, {
|
|
22
|
+
description: 'Indicates that TM import has failed',
|
|
23
|
+
}),
|
|
24
|
+
snsTopic: TM_IMPORT_TOPIC,
|
|
25
|
+
producedBy: [TRANSLATION_MEMORY_SERVICE],
|
|
26
|
+
},
|
|
27
|
+
'import.progress_updated': {
|
|
28
|
+
...enrichMessageSchemaWithBase('import.progress_updated', BASE_IMPORT_EVENT_PAYLOAD_SCHEMA, {
|
|
29
|
+
description: 'Indicates that TM import progress has updated',
|
|
30
|
+
}),
|
|
31
|
+
snsTopic: TM_IMPORT_TOPIC,
|
|
32
|
+
producedBy: [TRANSLATION_MEMORY_SERVICE],
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/events/import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAEL,2BAA2B,GAG5B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,CAAC,MAAM,eAAe,GAAG,2BAA2B,CAAA;AAE1D,MAAM,0BAA0B,GAAG,oBAAoB,CAAA;AAEvD,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,aAAa,EAAE,qBAAqB;CACrC,CAAC,CAAA;AAGF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,kBAAkB,EAAE;QAClB,GAAG,2BAA2B,CAAC,kBAAkB,EAAE,gCAAgC,EAAE;YACnF,WAAW,EAAE,qDAAqD;SACnE,CAAC;QACF,QAAQ,EAAE,eAAe;QACzB,UAAU,EAAE,CAAC,0BAA0B,CAAC;KACzC;IACD,eAAe,EAAE;QACf,GAAG,2BAA2B,CAAC,eAAe,EAAE,gCAAgC,EAAE;YAChF,WAAW,EAAE,qCAAqC;SACnD,CAAC;QACF,QAAQ,EAAE,eAAe;QACzB,UAAU,EAAE,CAAC,0BAA0B,CAAC;KACzC;IACD,yBAAyB,EAAE;QACzB,GAAG,2BAA2B,CAAC,yBAAyB,EAAE,gCAAgC,EAAE;YAC1F,WAAW,EAAE,+CAA+C;SAC7D,CAAC;QACF,QAAQ,EAAE,eAAe;QACzB,UAAU,EAAE,CAAC,0BAA0B,CAAC;KACzC;CACgD,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './events/import.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lokalise/tm-events-schemas",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Lokalise",
|
|
7
|
+
"url": "https://lokalise.com/"
|
|
8
|
+
},
|
|
9
|
+
"description": "Event schemas for Lokalise Translation Memory service",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git://github.com/lokalise/tm-service.git"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./dist/index.js",
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "rimraf dist && tsc --project tsconfig.build.json",
|
|
28
|
+
"clean": "rimraf dist",
|
|
29
|
+
"lint": "biome check && tsc",
|
|
30
|
+
"lint:fix": "biome check --write",
|
|
31
|
+
"test:ci": "echo \"No tests\"",
|
|
32
|
+
"package-version": "echo $npm_package_version",
|
|
33
|
+
"prepublishOnly": "node --run build",
|
|
34
|
+
"postversion": "biome check --write package.json"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@message-queue-toolkit/schemas": "^7.1.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"zod": "^4.1.12"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@biomejs/biome": "^2.3.1",
|
|
44
|
+
"@lokalise/biome-config": "^3.1.0",
|
|
45
|
+
"@lokalise/tsconfig": "^3.0.0",
|
|
46
|
+
"rimraf": "^6.0.1",
|
|
47
|
+
"typescript": "5.9.3",
|
|
48
|
+
"zod": "^4.1.12"
|
|
49
|
+
}
|
|
50
|
+
}
|