@el-j/google-sheet-translations 2.2.0 → 3.0.0-beta.13
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 +44 -1
- package/dist/action-entrypoint.d.ts.map +1 -1
- package/dist/core/rowTransformer.d.ts +26 -0
- package/dist/core/rowTransformer.d.ts.map +1 -0
- package/dist/esm/index.js +9549 -2524
- package/dist/getMultipleSpreadSheetsData.d.ts.map +1 -1
- package/dist/getSpreadSheetData.d.ts +3 -3
- package/dist/getSpreadSheetData.d.ts.map +1 -1
- package/dist/index.d.ts +13 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9656 -2611
- package/dist/migration/migrateV3.d.ts +60 -0
- package/dist/migration/migrateV3.d.ts.map +1 -0
- package/dist/providers/assetContracts.d.ts +88 -0
- package/dist/providers/assetContracts.d.ts.map +1 -0
- package/dist/providers/capabilities.d.ts +50 -0
- package/dist/providers/capabilities.d.ts.map +1 -0
- package/dist/providers/catalog.d.ts +73 -0
- package/dist/providers/catalog.d.ts.map +1 -0
- package/dist/providers/config.d.ts +56 -0
- package/dist/providers/config.d.ts.map +1 -0
- package/dist/providers/contracts.d.ts +138 -0
- package/dist/providers/contracts.d.ts.map +1 -0
- package/dist/providers/cryptpad/assetProvider.d.ts +37 -0
- package/dist/providers/cryptpad/assetProvider.d.ts.map +1 -0
- package/dist/providers/cryptpad/chainpad.d.ts +15 -0
- package/dist/providers/cryptpad/chainpad.d.ts.map +1 -0
- package/dist/providers/cryptpad/client.d.ts +195 -0
- package/dist/providers/cryptpad/client.d.ts.map +1 -0
- package/dist/providers/cryptpad/crypto.d.ts +46 -0
- package/dist/providers/cryptpad/crypto.d.ts.map +1 -0
- package/dist/providers/cryptpad/driveCatalogProvider.d.ts +23 -0
- package/dist/providers/cryptpad/driveCatalogProvider.d.ts.map +1 -0
- package/dist/providers/cryptpad/driveClient.d.ts +42 -0
- package/dist/providers/cryptpad/driveClient.d.ts.map +1 -0
- package/dist/providers/cryptpad/fullProvider.d.ts +48 -0
- package/dist/providers/cryptpad/fullProvider.d.ts.map +1 -0
- package/dist/providers/cryptpad/index.d.ts +25 -0
- package/dist/providers/cryptpad/index.d.ts.map +1 -0
- package/dist/providers/cryptpad/netflux.d.ts +27 -0
- package/dist/providers/cryptpad/netflux.d.ts.map +1 -0
- package/dist/providers/cryptpad/provider.d.ts +37 -0
- package/dist/providers/cryptpad/provider.d.ts.map +1 -0
- package/dist/providers/cryptpad/sheetOutputProvider.d.ts +46 -0
- package/dist/providers/cryptpad/sheetOutputProvider.d.ts.map +1 -0
- package/dist/providers/cryptpad/sheetParser.d.ts +196 -0
- package/dist/providers/cryptpad/sheetParser.d.ts.map +1 -0
- package/dist/providers/cryptpad/sheetProvider.d.ts +38 -0
- package/dist/providers/cryptpad/sheetProvider.d.ts.map +1 -0
- package/dist/providers/cryptpad/sheetSyncProvider.d.ts +46 -0
- package/dist/providers/cryptpad/sheetSyncProvider.d.ts.map +1 -0
- package/dist/providers/google/index.d.ts +4 -0
- package/dist/providers/google/index.d.ts.map +1 -0
- package/dist/providers/google/providers.d.ts +106 -0
- package/dist/providers/google/providers.d.ts.map +1 -0
- package/dist/providers/index.d.ts +25 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/orchestrator.d.ts +74 -0
- package/dist/providers/orchestrator.d.ts.map +1 -0
- package/dist/providers/runtime.d.ts +30 -0
- package/dist/providers/runtime.d.ts.map +1 -0
- package/dist/providers/syncEngine.d.ts +107 -0
- package/dist/providers/syncEngine.d.ts.map +1 -0
- package/dist/setup/cryptpadCli.d.ts +2 -0
- package/dist/setup/cryptpadCli.d.ts.map +1 -0
- package/dist/setup/gcpTransport.d.ts +25 -0
- package/dist/setup/gcpTransport.d.ts.map +1 -1
- package/dist/setup/migrateV3Cli.d.ts +2 -0
- package/dist/setup/migrateV3Cli.d.ts.map +1 -0
- package/dist/setup/providerCli.d.ts +2 -0
- package/dist/setup/providerCli.d.ts.map +1 -0
- package/dist/setup/wifSetup.d.ts +1 -1
- package/dist/setup/wifSetup.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/auth.d.ts +1 -1
- package/dist/utils/auth.d.ts.map +1 -1
- package/dist/utils/configurationHandler.d.ts.map +1 -1
- package/dist/utils/dataConverter/convertFromDataJsonFormat.d.ts +1 -1
- package/dist/utils/dataConverter/convertFromDataJsonFormat.d.ts.map +1 -1
- package/dist/utils/dataConverter/convertToDataJsonFormat.d.ts +1 -1
- package/dist/utils/dataConverter/convertToDataJsonFormat.d.ts.map +1 -1
- package/dist/utils/dataConverter/findLocalChanges.d.ts +1 -1
- package/dist/utils/dataConverter/findLocalChanges.d.ts.map +1 -1
- package/dist/utils/docIngester.d.ts.map +1 -1
- package/dist/utils/docParser.d.ts.map +1 -1
- package/dist/utils/driveDocScanner.d.ts.map +1 -1
- package/dist/utils/driveFolderScanner.d.ts.map +1 -1
- package/dist/utils/driveImageSync.d.ts.map +1 -1
- package/dist/utils/driveSpreadsheetBootstrap.d.ts.map +1 -1
- package/dist/utils/fileWriter.d.ts +1 -1
- package/dist/utils/fileWriter.d.ts.map +1 -1
- package/dist/utils/getDriveTranslations.d.ts.map +1 -1
- package/dist/utils/isDataJsonNewer.d.ts.map +1 -1
- package/dist/utils/localImageUtils.d.ts.map +1 -1
- package/dist/utils/localeFilter.d.ts.map +1 -1
- package/dist/utils/localeNormalizer.d.ts.map +1 -1
- package/dist/utils/multiSpreadsheetMerger.d.ts.map +1 -1
- package/dist/utils/publicSheetReader.d.ts +1 -1
- package/dist/utils/publicSheetReader.d.ts.map +1 -1
- package/dist/utils/rateLimiter.d.ts.map +1 -1
- package/dist/utils/readDataJson.d.ts +1 -1
- package/dist/utils/sheetProcessor.d.ts +4 -9
- package/dist/utils/sheetProcessor.d.ts.map +1 -1
- package/dist/utils/spreadsheetCreator.d.ts +1 -1
- package/dist/utils/spreadsheetCreator.d.ts.map +1 -1
- package/dist/utils/spreadsheetFormulas.d.ts +1 -1
- package/dist/utils/spreadsheetFormulas.d.ts.map +1 -1
- package/dist/utils/spreadsheetUpdater.d.ts +3 -3
- package/dist/utils/spreadsheetUpdater.d.ts.map +1 -1
- package/dist/utils/syncManager.d.ts +2 -2
- package/dist/utils/syncManager.d.ts.map +1 -1
- package/dist/utils/translationDataStats.d.ts +13 -0
- package/dist/utils/translationDataStats.d.ts.map +1 -0
- package/dist/utils/translationHelpers.d.ts.map +1 -1
- package/dist/utils/validateEnv.d.ts +1 -1
- package/dist/utils/validateEnv.d.ts.map +1 -1
- package/dist/utils/wait.d.ts.map +1 -1
- package/dist-cli/cryptpad.mjs +6363 -0
- package/dist-cli/migrate-v3.mjs +406 -0
- package/dist-cli/run-provider.mjs +7441 -0
- package/dist-cli/setup-wif.mjs +334 -18949
- package/package.json +47 -24
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { SheetRow } from '../../types';
|
|
2
|
+
export interface CryptPadSheetGrid {
|
|
3
|
+
[cellRef: string]: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ReconstructedSheet {
|
|
6
|
+
cells: CryptPadSheetGrid;
|
|
7
|
+
rows: SheetRow[];
|
|
8
|
+
sheetNames: string[];
|
|
9
|
+
}
|
|
10
|
+
/** Converts column index (0-based) to letter: 0 -> 'A', 25 -> 'Z', 26 -> 'AA'. */
|
|
11
|
+
export declare function colIndexToLetter(colIndex: number): string;
|
|
12
|
+
/** Converts column letter to 0-based index: 'A' -> 0, 'Z' -> 25, 'AA' -> 26. */
|
|
13
|
+
export declare function letterToColIndex(letter: string): number;
|
|
14
|
+
/**
|
|
15
|
+
* Parses a cell reference into components: 'A1' -> { col: 'A', row: 1 },
|
|
16
|
+
* 'Sheet1!B2' -> { sheet: 'Sheet1', col: 'B', row: 2 }.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseCellRef(cellRef: string): {
|
|
19
|
+
sheet?: string;
|
|
20
|
+
col: string;
|
|
21
|
+
row: number;
|
|
22
|
+
} | null;
|
|
23
|
+
export interface OnlyOfficeMetadata {
|
|
24
|
+
channelId: string | null;
|
|
25
|
+
title: string | null;
|
|
26
|
+
defaultTitle: string | null;
|
|
27
|
+
userDoc?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the active OnlyOffice real-time collaboration channel ID and document
|
|
31
|
+
* metadata from decrypted pad metadata messages.
|
|
32
|
+
*
|
|
33
|
+
* CryptPad metadata channels are governed by ChainPad (SmartJSONTransformer DAG).
|
|
34
|
+
* Replaying the ChainPad log deterministically computes the true, latest document
|
|
35
|
+
* state (userDoc.content.channel).
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractOnlyOfficeMetadata(metadataMessages: string[]): OnlyOfficeMetadata;
|
|
38
|
+
/**
|
|
39
|
+
* Extracts the most recently registered OnlyOffice real-time collaboration channel ID
|
|
40
|
+
* from decrypted pad metadata messages.
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractOnlyOfficeChannelId(metadataMessages: string[]): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Parses OnlyOffice incremental binary change records into cell coordinates and text values.
|
|
45
|
+
* Supports dynamic sheet identifiers, tab additions, renames, and binary change frames.
|
|
46
|
+
*
|
|
47
|
+
* @param rtMessages - Decrypted raw change messages retrieved from the OnlyOffice RT Netflux channel.
|
|
48
|
+
* @returns A mapping of cell coordinates (`A1` or `sheet!A1`) to cell text values.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseOnlyOfficeChanges(rtMessages: string[]): CryptPadSheetGrid;
|
|
51
|
+
/**
|
|
52
|
+
* Extracts sheet name <-> sheet ID bidirectional mappings from OnlyOffice change messages.
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractOnlyOfficeSheetIdMap(rtMessages: string[]): {
|
|
55
|
+
nameToId: Record<string, string>;
|
|
56
|
+
idToName: Record<string, string>;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Converts a grid of cell references (e.g. { A1: 'key', B1: 'en', A2: 'btn.save', B2: 'Save' })
|
|
60
|
+
* into structured `SheetRow[]` objects using row 1 as the header column keys.
|
|
61
|
+
*/
|
|
62
|
+
export declare function convertCellsToSheetRows(cells: CryptPadSheetGrid): SheetRow[];
|
|
63
|
+
/**
|
|
64
|
+
* Builds a cell reference string such as "A1" or "Sheet1!B2".
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildCellRef(sheetName: string | undefined, col: string | number, row: number): string;
|
|
67
|
+
/**
|
|
68
|
+
* Groups a flat grid of cell coordinates by sheet tab name.
|
|
69
|
+
* Cells without an explicit sheet prefix are assigned to `defaultSheet` (defaults to 'Sheet1').
|
|
70
|
+
*/
|
|
71
|
+
export declare function groupCellsBySheet(cells: CryptPadSheetGrid, defaultSheet?: string): Record<string, CryptPadSheetGrid>;
|
|
72
|
+
/**
|
|
73
|
+
* Converts a grid of cell references into a dictionary of SheetRow arrays keyed by sheet tab name.
|
|
74
|
+
*/
|
|
75
|
+
export declare function convertCellsToMultiSheetRows(cells: CryptPadSheetGrid, defaultSheet?: string): Record<string, SheetRow[]>;
|
|
76
|
+
export interface OnlyOfficeCellUpdate {
|
|
77
|
+
sheet?: string;
|
|
78
|
+
sheetId?: string | number;
|
|
79
|
+
col: string | number;
|
|
80
|
+
row: number;
|
|
81
|
+
/** Literal cell text. Mutually exclusive with `formula` — exactly one must be set. */
|
|
82
|
+
value?: string;
|
|
83
|
+
/** Formula text (with or without a leading "="), e.g. "i18n!B1" or "=i18n!B1".
|
|
84
|
+
* Mutually exclusive with `value` — exactly one must be set. See
|
|
85
|
+
* {@link encodeOnlyOfficeFormulaCellRecord}. */
|
|
86
|
+
formula?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Encodes a single cell update record into the native OnlyOffice binary format:
|
|
90
|
+
* AscCH.historyitem_Cell_ChangeValue (magic 0x01291001) with 32-bit LE coordinates c1, r1.
|
|
91
|
+
* Supports dynamic sheet ID identifiers (string or number).
|
|
92
|
+
*
|
|
93
|
+
* The returned buffer is a standalone, self-contained record ready to be base64-encoded
|
|
94
|
+
* and placed as a single `changes` entry in an OnlyOffice `saveChanges` message.
|
|
95
|
+
* Format: 4-byte LE record length + body bytes (magic, sheetId, coordinates, value).
|
|
96
|
+
*/
|
|
97
|
+
export declare function encodeOnlyOfficeCellRecord(cellRef: string, value: string, sheetId?: string | number): Buffer;
|
|
98
|
+
/**
|
|
99
|
+
* Encodes a single FORMULA cell update record into the native OnlyOffice binary format:
|
|
100
|
+
* the same `AscCH.historyitem_Cell_ChangeValue` (magic 0x01291001) history item used for
|
|
101
|
+
* plain-text cells — confirmed from ONLYOFFICE/sdkjs source (`cell/model/Workbook.js`
|
|
102
|
+
* `setValue`/`setFormulaTemplate`, `cell/model/UndoRedo.js` `UndoRedoData_CellValueData`)
|
|
103
|
+
* that OnlyOffice does NOT use a separate history item for formulas; only the `NewVal`
|
|
104
|
+
* object's `formula` property differs (a UTF-16LE string instead of the Null marker).
|
|
105
|
+
*
|
|
106
|
+
* Layout derived by decoding this module's own byte-verified plain-text encoder
|
|
107
|
+
* ({@link encodeOnlyOfficeCellRecord}) against the sdkjs-confirmed property-ID scheme —
|
|
108
|
+
* every offset below was cross-checked against real, already-tested reference bytes:
|
|
109
|
+
*
|
|
110
|
+
* ```
|
|
111
|
+
* UndoRedoData_CellSimpleData (Row=0, Col=1, NewVal=2)
|
|
112
|
+
* Row: SByte(r1&0xff)
|
|
113
|
+
* Col: SByte(c1&0xff)
|
|
114
|
+
* NewVal -> UndoRedoData_CellValueData (class byte 3) (formula=0, value=1, formulaRef=2, ca=3)
|
|
115
|
+
* formula: String(f) <- the formula text, WITHOUT a leading "="
|
|
116
|
+
* value -> CCellValue (class byte 1) (text=0, multiText=1, number=2, type=3)
|
|
117
|
+
* text: Null, multiText: Null, number: Null, type: SByte(0) [CellValueType.Number]
|
|
118
|
+
* (a freshly-authored formula has no cached result yet — OnlyOffice's own recalc
|
|
119
|
+
* engine computes and syncs the cached value once the client evaluates the formula;
|
|
120
|
+
* this matches `Cell.prototype.cleanText()`, called synchronously before the record
|
|
121
|
+
* is built in `setFormulaTemplate`)
|
|
122
|
+
* formulaRef: Null
|
|
123
|
+
* ca: Undefined (matches the literal-cell reference bytes, which use Undefined here
|
|
124
|
+
* too rather than a Boolean default)
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* NOT yet independently verified against a real captured formula-cell record from a live
|
|
128
|
+
* OnlyOffice session (unlike {@link encodeOnlyOfficeCellRecord} and
|
|
129
|
+
* {@link encodeOnlyOfficeSheetAddRecord}, which both have byte-exact reference captures)
|
|
130
|
+
* — see issue #165's own risk note about attempting formula encoding without a real
|
|
131
|
+
* reference binary. Treat with appropriate caution until cross-checked against a live
|
|
132
|
+
* capture.
|
|
133
|
+
*
|
|
134
|
+
* @param cellRef - Target cell, e.g. "A1" or "Sheet1!B2".
|
|
135
|
+
* @param formula - Formula text, with or without a leading "=" (stripped either way,
|
|
136
|
+
* matching sdkjs's own `val[0] == "="` handling in `Workbook.js`).
|
|
137
|
+
* @param sheetId - Target sheet's internal OnlyOffice sheet ID.
|
|
138
|
+
*/
|
|
139
|
+
export declare function encodeOnlyOfficeFormulaCellRecord(cellRef: string, formula: string, sheetId?: string | number): Buffer;
|
|
140
|
+
/**
|
|
141
|
+
* Formats a list of cell updates into an OnlyOffice `saveChanges` message.
|
|
142
|
+
*
|
|
143
|
+
* ### OnlyOffice Real-Time Change Protocol
|
|
144
|
+
* OnlyOffice broadcasts changes as a JSON `saveChanges` message with a `changes` array.
|
|
145
|
+
* Each entry in `changes` is an independent document record:
|
|
146
|
+
* - The first entry is always `txOpen` (transaction open marker, 14 bytes).
|
|
147
|
+
* - Each subsequent entry is a single cell update record.
|
|
148
|
+
*
|
|
149
|
+
* Each `change` value is a JSON-encoded string of the format `"<byteLength>;<base64>"`
|
|
150
|
+
* where `byteLength` is the binary buffer length and `<base64>` is the base64-encoded buffer.
|
|
151
|
+
*
|
|
152
|
+
* This matches the exact wire format used by real OnlyOffice collaborative sessions
|
|
153
|
+
* and ensures CryptPad's OnlyOffice integration can parse each record independently.
|
|
154
|
+
*/
|
|
155
|
+
export declare function buildOnlyOfficeChangePayload(updates: OnlyOfficeCellUpdate[], defaultSheetId?: string | number): string;
|
|
156
|
+
/**
|
|
157
|
+
* Encodes a single "add worksheet tab" record into the native OnlyOffice binary format:
|
|
158
|
+
* AscCH.historyitem_Workbook_SheetAdd (real op code 1, from ONLYOFFICE/sdkjs
|
|
159
|
+
* `cell/model/History.js` — not a guessed name), UndoRedoDataTypes.SheetAdd (25, from
|
|
160
|
+
* `cell/model/UndoRedo.js`), with a generic property list matching
|
|
161
|
+
* `UndoRedoData_SheetAdd.prototype.Properties` (`name`=0, `sheetidfrom`=1, `sheetid`=2,
|
|
162
|
+
* `tableNames`=3, `insertBefore`=4, `opt_sheet`=5, `opt_sheetidToAdd`=6).
|
|
163
|
+
*
|
|
164
|
+
* Field layout was derived and verified against two independent real "add sheet"
|
|
165
|
+
* records captured from a live OnlyOffice browser session on a CryptPad pad (see
|
|
166
|
+
* issue #161): the body length implied by summing the fixed structural bytes plus the
|
|
167
|
+
* two variable-length UTF-16LE strings matched the actual captured body length exactly
|
|
168
|
+
* in both captures, and the `insertBefore` value matched the sheet's real insert
|
|
169
|
+
* position in both.
|
|
170
|
+
*
|
|
171
|
+
* Each optional/unused property (`sheetidfrom`, `tableNames`, `opt_sheet`,
|
|
172
|
+
* `opt_sheetidToAdd`) is written as its observed constant "null" marker byte — real
|
|
173
|
+
* OnlyOffice clients only populate them for operations this encoder doesn't need to
|
|
174
|
+
* perform (e.g. duplicating an existing sheet).
|
|
175
|
+
*
|
|
176
|
+
* @param name - Display name for the new sheet tab.
|
|
177
|
+
* @param sheetId - Freeform internal sheet identifier (see {@link generateOnlyOfficeSheetId}).
|
|
178
|
+
* @param insertBeforeIndex - 0-based tab position to insert at (0-255; real captures never
|
|
179
|
+
* exceeded a handful of tabs, and the wire format observed here only ever used one byte).
|
|
180
|
+
*/
|
|
181
|
+
export declare function encodeOnlyOfficeSheetAddRecord(name: string, sheetId: string, insertBeforeIndex: number): Buffer;
|
|
182
|
+
/**
|
|
183
|
+
* Generates a freeform internal sheetId string in the same shape real OnlyOffice
|
|
184
|
+
* clients use (`<numeric prefix>_<counter>`, e.g. `"7204278956594729_12"`, per live
|
|
185
|
+
* capture in #161). The exact value doesn't need to match any specific algorithm —
|
|
186
|
+
* the field is a free-form string elsewhere in the protocol — only a value that's
|
|
187
|
+
* unique within the pad.
|
|
188
|
+
*/
|
|
189
|
+
export declare function generateOnlyOfficeSheetId(): string;
|
|
190
|
+
/**
|
|
191
|
+
* Formats a single "add worksheet tab" operation into an OnlyOffice `saveChanges`
|
|
192
|
+
* message, structured the same way as {@link buildOnlyOfficeChangePayload}
|
|
193
|
+
* (txOpen marker followed by one record).
|
|
194
|
+
*/
|
|
195
|
+
export declare function buildOnlyOfficeSheetAddPayload(name: string, sheetId: string, insertBeforeIndex: number): string;
|
|
196
|
+
//# sourceMappingURL=sheetParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetParser.d.ts","sourceRoot":"","sources":["../../../src/providers/cryptpad/sheetParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,MAAM,WAAW,iBAAiB;IAChC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,iBAAiB,CAAC;IACzB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQzD;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM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0,0 +1,38 @@
|
|
|
1
|
+
import type { TranslationInputProvider } from '../contracts';
|
|
2
|
+
import { type ProviderCapabilitySet } from '../capabilities';
|
|
3
|
+
/** Definition of a single CryptPad sheet source to read as a translation table. */
|
|
4
|
+
export interface CryptPadSheetSource {
|
|
5
|
+
/** Target table name (e.g. "i18n", "translations"). */
|
|
6
|
+
tableName: string;
|
|
7
|
+
/** Full CryptPad URL (e.g. https://cryptpad.fr/sheet/#/2/sheet/edit/seed/p/). */
|
|
8
|
+
url?: string;
|
|
9
|
+
/** Optional password if the pad is password-protected. */
|
|
10
|
+
password?: string;
|
|
11
|
+
/** Optional unique identifier for this source. */
|
|
12
|
+
tableId?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Options for configuring the CryptPad Sheet input provider. */
|
|
15
|
+
export interface CryptPadSheetInputProviderOptions {
|
|
16
|
+
/** Array of CryptPad sheet sources. */
|
|
17
|
+
sources?: CryptPadSheetSource[];
|
|
18
|
+
/** Convenience single-source URL. */
|
|
19
|
+
url?: string;
|
|
20
|
+
/** Convenience single-source password. */
|
|
21
|
+
password?: string;
|
|
22
|
+
/** Convenience single-source table name (defaults to 'translations'). */
|
|
23
|
+
tableName?: string;
|
|
24
|
+
/** Optional custom provider identifier. Defaults to 'cryptpad-sheet'. */
|
|
25
|
+
providerId?: string;
|
|
26
|
+
/** Optional custom provider display name. */
|
|
27
|
+
displayName?: string;
|
|
28
|
+
/** Optional timeout in milliseconds for WebSocket retrieval. */
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare const CRYPTPAD_SHEET_INPUT_CAPABILITIES: ProviderCapabilitySet;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a read-only {@link TranslationInputProvider} that retrieves translation tables
|
|
34
|
+
* directly from password-protected or public CryptPad spreadsheets (OnlyOffice sheets)
|
|
35
|
+
* using end-to-end encrypted Netflux WebSockets without requiring a browser or bot.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createCryptPadSheetInputProvider(options: CryptPadSheetInputProviderOptions): TranslationInputProvider;
|
|
38
|
+
//# sourceMappingURL=sheetProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/cryptpad/sheetProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGlF,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iEAAiE;AACjE,MAAM,WAAW,iCAAiC;IAChD,uCAAuC;IACvC,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,qCAAqC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,iCAAiC,EAAE,qBAG9C,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,iCAAiC,GACzC,wBAAwB,CAyG1B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TranslationSyncProvider } from '../contracts';
|
|
2
|
+
import { type ProviderCapabilitySet } from '../capabilities';
|
|
3
|
+
import { type SyncConflictPolicy } from '../syncEngine';
|
|
4
|
+
export interface CryptPadSheetSyncProviderOptions {
|
|
5
|
+
/** Full CryptPad URL (e.g. https://cryptpad.fr/sheet/#/2/sheet/edit/seed/p/). */
|
|
6
|
+
url?: string;
|
|
7
|
+
/** Optional password if the pad is password-protected. */
|
|
8
|
+
password?: string;
|
|
9
|
+
/** Conflict resolution strategy used during sync. Defaults to 'manual'. Only takes
|
|
10
|
+
* effect when a real `baseTranslations` snapshot is supplied — see below. */
|
|
11
|
+
conflictPolicy?: SyncConflictPolicy;
|
|
12
|
+
/** When true, overwrites existing remote values even on conflict. Defaults to false. */
|
|
13
|
+
override?: boolean;
|
|
14
|
+
/** Column header mappings for locale normalization. */
|
|
15
|
+
localeMapping?: Record<string, string>;
|
|
16
|
+
/** Optional custom provider identifier. Defaults to 'cryptpad-sheet'. */
|
|
17
|
+
providerId?: string;
|
|
18
|
+
/** Optional custom provider display name. */
|
|
19
|
+
displayName?: string;
|
|
20
|
+
/** Optional timeout in milliseconds for WebSocket operations. */
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const CRYPTPAD_SHEET_SYNC_CAPABILITIES: ProviderCapabilitySet;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a {@link TranslationSyncProvider} that reconciles local translation changes
|
|
26
|
+
* against a live CryptPad spreadsheet (multi-tab OnlyOffice workbook), pushing only
|
|
27
|
+
* the resolved diffs back over Netflux.
|
|
28
|
+
*
|
|
29
|
+
* ### Two modes, chosen automatically per call
|
|
30
|
+
*
|
|
31
|
+
* - **Default (no `payload.metadata.baseTranslations` supplied)** — the common case,
|
|
32
|
+
* used by `gst-cryptpad sync` and anything else that doesn't track a real common-
|
|
33
|
+
* ancestor snapshot. Uses the exact same one-way "push new keys only" diff
|
|
34
|
+
* ({@link findLocalChanges}) as `createGoogleSheetsSyncProvider`, so `sync` behaves
|
|
35
|
+
* identically across providers by default: an existing key that differs between
|
|
36
|
+
* local and remote is left untouched either way, matching Google Sheets exactly.
|
|
37
|
+
* (See issue #164 — without a genuine base snapshot, three-way conflict detection
|
|
38
|
+
* degenerates to "no conflict ever detected," which is a materially different and
|
|
39
|
+
* more aggressive behavior than Google's, not an intentional feature.)
|
|
40
|
+
* - **Advanced (a real `payload.metadata.baseTranslations` is supplied)** — a genuine
|
|
41
|
+
* three-way merge via {@link resolveSyncPlan}, with `conflictPolicy` controlling how
|
|
42
|
+
* keys that changed on both sides are resolved. This is an explicit opt-in for
|
|
43
|
+
* callers that track a base snapshot themselves (see the Full Sync guide).
|
|
44
|
+
*/
|
|
45
|
+
export declare function createCryptPadSheetSyncProvider(options?: CryptPadSheetSyncProviderOptions): TranslationSyncProvider;
|
|
46
|
+
//# sourceMappingURL=sheetSyncProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetSyncProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/cryptpad/sheetSyncProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EAExB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGlF,OAAO,EAAmB,KAAK,kBAAkB,EAA2B,MAAM,eAAe,CAAC;AAQlG,MAAM,WAAW,gCAAgC;IAC/C,iFAAiF;IACjF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;kFAC8E;IAC9E,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gCAAgC,EAAE,qBAG7C,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,gCAAqC,GAC7C,uBAAuB,CAqFzB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Barrel for the Google Sheets provider family (input/output/sync). */
|
|
2
|
+
export { createGoogleSheetsInputProvider, createGoogleSheetsOutputProvider, createGoogleSheetsSyncProvider, GOOGLE_SHEETS_PROVIDER_CAPABILITIES, } from './providers';
|
|
3
|
+
export type { GoogleSheetsInputProviderOptions, GoogleSheetsOutputProviderOptions, GoogleSheetsSyncProviderOptions, } from './providers';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/google/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,EACL,+BAA+B,EAC/B,gCAAgC,EAChC,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,gCAAgC,EAChC,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { GoogleAuth } from 'google-auth-library';
|
|
2
|
+
import { GoogleSpreadsheet } from 'google-spreadsheet';
|
|
3
|
+
import type { TranslationInputProvider, TranslationOutputProvider, TranslationSyncProvider } from '../contracts';
|
|
4
|
+
import { type ProviderCapabilitySet } from '../capabilities';
|
|
5
|
+
import { withRetry } from '../../utils/rateLimiter';
|
|
6
|
+
import { updateSpreadsheetWithLocalChanges } from '../../utils/spreadsheetUpdater';
|
|
7
|
+
import { findLocalChanges } from '../../utils/dataConverter/findLocalChanges';
|
|
8
|
+
import type { SheetRow } from '../../types';
|
|
9
|
+
/**
|
|
10
|
+
* Options for creating a Google Sheets input provider.
|
|
11
|
+
*/
|
|
12
|
+
export interface GoogleSheetsInputProviderOptions {
|
|
13
|
+
/** Target spreadsheet ID. If omitted, falls back to GOOGLE_SPREADSHEET_ID env var. */
|
|
14
|
+
spreadsheetId?: string;
|
|
15
|
+
/** Maximum number of rows to retrieve per sheet tab. Defaults to 100. */
|
|
16
|
+
rowLimit?: number;
|
|
17
|
+
/** Throttling delay in seconds between API requests. */
|
|
18
|
+
waitSeconds?: number;
|
|
19
|
+
/** When true, fetches public spreadsheet without requiring authentication. */
|
|
20
|
+
publicSheet?: boolean;
|
|
21
|
+
/** Custom provider identifier. Defaults to 'google-sheets'. */
|
|
22
|
+
providerId?: string;
|
|
23
|
+
/** Custom provider display name. */
|
|
24
|
+
displayName?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Options for creating a Google Sheets output provider.
|
|
28
|
+
*/
|
|
29
|
+
export interface GoogleSheetsOutputProviderOptions {
|
|
30
|
+
/** Target spreadsheet ID. If omitted, falls back to GOOGLE_SPREADSHEET_ID env var. */
|
|
31
|
+
spreadsheetId?: string;
|
|
32
|
+
/** Throttling delay in seconds between API requests. */
|
|
33
|
+
waitSeconds?: number;
|
|
34
|
+
/** When true, automatically inserts GOOGLETRANSLATE formulas for missing translations. */
|
|
35
|
+
autoTranslate?: boolean;
|
|
36
|
+
/** When true with autoTranslate, overwrites existing manual translations with formulas. */
|
|
37
|
+
override?: boolean;
|
|
38
|
+
/** Column header mappings for locale normalization. */
|
|
39
|
+
localeMapping?: Record<string, string>;
|
|
40
|
+
/** Custom provider identifier. Defaults to 'google-sheets'. */
|
|
41
|
+
providerId?: string;
|
|
42
|
+
/** Custom provider display name. */
|
|
43
|
+
displayName?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for creating a Google Sheets sync provider.
|
|
47
|
+
*/
|
|
48
|
+
export interface GoogleSheetsSyncProviderOptions {
|
|
49
|
+
/** Target spreadsheet ID. If omitted, falls back to GOOGLE_SPREADSHEET_ID env var. */
|
|
50
|
+
spreadsheetId?: string;
|
|
51
|
+
/** Throttling delay in seconds between API requests. */
|
|
52
|
+
waitSeconds?: number;
|
|
53
|
+
/** When true, automatically inserts GOOGLETRANSLATE formulas for missing translations. */
|
|
54
|
+
autoTranslate?: boolean;
|
|
55
|
+
/** When true with autoTranslate, overwrites existing manual translations with formulas. */
|
|
56
|
+
override?: boolean;
|
|
57
|
+
/** Column header mappings for locale normalization. */
|
|
58
|
+
localeMapping?: Record<string, string>;
|
|
59
|
+
/** Custom provider identifier. Defaults to 'google-sheets'. */
|
|
60
|
+
providerId?: string;
|
|
61
|
+
/** Custom provider display name. */
|
|
62
|
+
displayName?: string;
|
|
63
|
+
}
|
|
64
|
+
interface GoogleSheetsProviderDeps {
|
|
65
|
+
createAuthClient: () => GoogleAuth;
|
|
66
|
+
createSpreadsheetClient: (spreadsheetId: string, authClient: GoogleAuth) => GoogleSpreadsheet;
|
|
67
|
+
readPublicSheet: (spreadsheetId: string, sheetName: string) => Promise<SheetRow[]>;
|
|
68
|
+
withRetry: typeof withRetry;
|
|
69
|
+
updateSpreadsheetWithLocalChanges: typeof updateSpreadsheetWithLocalChanges;
|
|
70
|
+
findLocalChanges: typeof findLocalChanges;
|
|
71
|
+
logger: Pick<Console, 'warn' | 'log'>;
|
|
72
|
+
}
|
|
73
|
+
export declare function createDefaultDeps(): GoogleSheetsProviderDeps;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a {@link TranslationInputProvider} backed by Google Sheets. When
|
|
76
|
+
* `options.publicSheet` is true, reads via the no-auth public CSV export path
|
|
77
|
+
* (`publicReadNoAuth` capability); otherwise authenticates via
|
|
78
|
+
* {@link createAuthClient} and reads through the Google Sheets API, skipping
|
|
79
|
+
* (and warning about) any requested table name that has no matching sheet.
|
|
80
|
+
*/
|
|
81
|
+
export declare function createGoogleSheetsInputProvider(options?: GoogleSheetsInputProviderOptions, depsOverrides?: Partial<GoogleSheetsProviderDeps>): TranslationInputProvider;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a {@link TranslationOutputProvider} that authenticates and writes the full
|
|
84
|
+
* translation set to a Google Sheets spreadsheet via {@link updateSpreadsheetWithLocalChanges},
|
|
85
|
+
* optionally auto-translating missing cells with a formula (`autoTranslate`) and
|
|
86
|
+
* optionally overwriting existing non-empty cells (`override`).
|
|
87
|
+
*/
|
|
88
|
+
export declare function createGoogleSheetsOutputProvider(options?: GoogleSheetsOutputProviderOptions, depsOverrides?: Partial<GoogleSheetsProviderDeps>): TranslationOutputProvider;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a {@link TranslationSyncProvider} that computes local-only changes via
|
|
91
|
+
* {@link findLocalChanges} (comparing `localTranslations` against `remoteTranslations`)
|
|
92
|
+
* and, if any exist, writes just those changed keys back to the spreadsheet. Returns
|
|
93
|
+
* early with `changedKeys: 0` when there is no local diff, avoiding an unnecessary
|
|
94
|
+
* authenticated round-trip.
|
|
95
|
+
*/
|
|
96
|
+
export declare function createGoogleSheetsSyncProvider(options?: GoogleSheetsSyncProviderOptions, depsOverrides?: Partial<GoogleSheetsProviderDeps>): TranslationSyncProvider;
|
|
97
|
+
/**
|
|
98
|
+
* Static capability sets declared for Google Sheets input, output, and sync providers.
|
|
99
|
+
*/
|
|
100
|
+
export declare const GOOGLE_SHEETS_PROVIDER_CAPABILITIES: {
|
|
101
|
+
readonly input: ProviderCapabilitySet;
|
|
102
|
+
readonly output: ProviderCapabilitySet;
|
|
103
|
+
readonly sync: ProviderCapabilitySet;
|
|
104
|
+
};
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../src/providers/google/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO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AuB,CA6CzB;AAED;;GAEG;AACH,eAAO,MAAM,mCAAmC;aAC9C,KAAK;aACL,MAAM;aACN,IAAI;CACI,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public barrel for the v3 provider platform: capability model, provider contracts
|
|
3
|
+
* (translation + asset), the built-in Google and CryptPad provider factories, the
|
|
4
|
+
* catalog/discovery API, the sync engine, the orchestrator, and the runtime config
|
|
5
|
+
* layer that wires a {@link ProviderRuntimeConfig} into concrete provider instances.
|
|
6
|
+
*/
|
|
7
|
+
export { PROVIDER_CAPABILITIES, EMPTY_PROVIDER_CAPABILITIES, OPERATION_CAPABILITY_REQUIREMENTS, createCapabilitySet, missingCapabilities, hasRequiredCapabilities, assertRequiredCapabilities, assertOperationCapabilities, } from './capabilities';
|
|
8
|
+
export type { ProviderCapability, ProviderCapabilitySet, ProviderOperation } from './capabilities';
|
|
9
|
+
export type { ProviderKind, ProviderMetadata, CanonicalTableInput, TranslationInputRequest, TranslationInputResult, TranslationOutputPayload, TranslationOutputResult, TranslationSyncPayload, TranslationSyncResult, TranslationInputProvider, TranslationOutputProvider, TranslationSyncProvider, AnyTranslationProvider, ProviderRegistry, SegmentedProviderRegistry, } from './contracts';
|
|
10
|
+
export type { AssetProviderKind, CanonicalAssetEntry, AssetManifestResult, AssetSyncRequest, AssetSyncResult, AssetInputProvider, AssetOutputProvider, AssetSyncProvider, } from './assetContracts';
|
|
11
|
+
export type { ProviderSourceKind, ProviderSourceDescriptor, ProviderDiscoveryRequest, ProviderDiscoveryResult, ProviderCatalogProvider, InMemoryProviderCatalogOptions, } from './catalog';
|
|
12
|
+
export { createGoogleSheetsInputProvider, createGoogleSheetsOutputProvider, createGoogleSheetsSyncProvider, GOOGLE_SHEETS_PROVIDER_CAPABILITIES, } from './google';
|
|
13
|
+
export type { GoogleSheetsInputProviderOptions, GoogleSheetsOutputProviderOptions, GoogleSheetsSyncProviderOptions, } from './google';
|
|
14
|
+
export { createCryptPadCsvInputProvider, createCryptPadSheetInputProvider, createCryptPadSheetOutputProvider, createCryptPadSheetSyncProvider, createCryptPadDriveCatalogProvider, createCryptPadWorkspaceOutputProvider, createCryptPadWorkspaceSyncProvider, createCryptPadAssetSyncProvider, CryptPadClient, CryptPadDriveClient, parsePadUrl, deriveCryptPadKeys, decryptCryptPadPayload, encryptCryptPadPayload, resolveCryptPadWebsocketUrl, fetchChannelHistory, broadcastChannelMessage, extractOnlyOfficeChannelId, extractOnlyOfficeMetadata, extractOnlyOfficeSheetIdMap, parseOnlyOfficeChanges, convertCellsToSheetRows, convertCellsToMultiSheetRows, groupCellsBySheet, buildCellRef, buildOnlyOfficeChangePayload, encodeOnlyOfficeCellRecord, CRYPTPAD_CSV_INPUT_CAPABILITIES, CRYPTPAD_SHEET_INPUT_CAPABILITIES, CRYPTPAD_SHEET_OUTPUT_CAPABILITIES, CRYPTPAD_SHEET_SYNC_CAPABILITIES, CRYPTPAD_DRIVE_CATALOG_CAPABILITIES, CRYPTPAD_WORKSPACE_OUTPUT_CAPABILITIES, CRYPTPAD_WORKSPACE_SYNC_CAPABILITIES, CRYPTPAD_ASSET_SYNC_CAPABILITIES, } from './cryptpad';
|
|
15
|
+
export type { CryptPadCsvSource, CryptPadCsvInputProviderOptions, CryptPadSheetSource, CryptPadSheetInputProviderOptions, CryptPadSheetOutputProviderOptions, CryptPadSheetSyncProviderOptions, CryptPadDriveCatalogOptions, CryptPadDriveItem, CryptPadDriveClientOptions, CryptPadClientOptions, CryptPadSheetResult, ParsedCryptPadUrl, DerivedCryptPadKeys, CryptPadSheetGrid, ReconstructedSheet, OnlyOfficeCellUpdate, CryptPadWorkspaceProviderOptions, CryptPadAssetSyncProviderOptions, } from './cryptpad';
|
|
16
|
+
export { createInMemoryProviderCatalogProvider, createDefaultProviderCatalog } from './catalog';
|
|
17
|
+
export { buildSyncPlan, resolveSyncPlan } from './syncEngine';
|
|
18
|
+
export type { SyncConflictPolicy, SyncChangeType, SyncEntryChange, SyncConflict, SyncPlan, ResolveSyncPlanResult, BuildSyncPlanInput, } from './syncEngine';
|
|
19
|
+
export { runProviderPipeline } from './orchestrator';
|
|
20
|
+
export type { ProviderPipelineOptions, ProviderPipelineResult } from './orchestrator';
|
|
21
|
+
export { validateProviderRuntimeConfig, assertValidProviderRuntimeConfig, mapLegacyGoogleOptionsToProviderConfig, } from './config';
|
|
22
|
+
export type { ProviderReferenceConfig, ProviderRuntimeConfig, ProviderConfigValidationResult, LegacyConfigMappingResult, } from './config';
|
|
23
|
+
export { createProvidersFromRuntimeConfig, requiresGoogleAuthForRuntimeConfig } from './runtime';
|
|
24
|
+
export type { ProviderRuntimeSelection } from './runtime';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,iCAAiC,EACjC,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnG,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,k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AAM,cAAc,CAAC;AAE9D,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,sCAAsC,GACvC,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,gCAAgC,EAAE,kCAAkC,EAAE,MAAM,WAAW,CAAC;AAEjG,YAAY,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type SheetProcessingResult } from '../core/rowTransformer';
|
|
2
|
+
import type { TranslationData } from '../types';
|
|
3
|
+
import type { TranslationInputProvider, TranslationOutputProvider, TranslationSyncProvider, TranslationOutputResult, TranslationSyncResult } from './contracts';
|
|
4
|
+
import type { AssetSyncProvider, AssetSyncResult } from './assetContracts';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for executing asset sync within the provider pipeline.
|
|
7
|
+
*/
|
|
8
|
+
export interface ProviderAssetSyncRequestOptions {
|
|
9
|
+
/** Local directory where synchronized assets will be written. */
|
|
10
|
+
targetDirectory: string;
|
|
11
|
+
/** When true, local files in targetDirectory not found in the manifest are removed. */
|
|
12
|
+
deleteMissing?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Input options supplied to {@link runProviderPipeline} to configure input, output,
|
|
16
|
+
* sync, asset sync providers, and execution parameters.
|
|
17
|
+
*/
|
|
18
|
+
export interface ProviderPipelineOptions {
|
|
19
|
+
/** Provider responsible for reading canonical source tables. */
|
|
20
|
+
inputProvider: TranslationInputProvider;
|
|
21
|
+
/** Optional provider responsible for writing canonical tables to a destination. */
|
|
22
|
+
outputProvider?: TranslationOutputProvider;
|
|
23
|
+
/** Optional provider responsible for reconciling local changes back to the remote source. */
|
|
24
|
+
syncProvider?: TranslationSyncProvider;
|
|
25
|
+
/** Optional asset-sync provider (e.g. CryptPad asset manifest sync). Runs only when `assetSync` is also set. */
|
|
26
|
+
assetSyncProvider?: AssetSyncProvider;
|
|
27
|
+
/** Target directory (and delete-missing behavior) for the asset sync run. Ignored if `assetSyncProvider` is absent. */
|
|
28
|
+
assetSync?: ProviderAssetSyncRequestOptions;
|
|
29
|
+
/** Explicit list of table names to process. Defaults to input provider default if omitted. */
|
|
30
|
+
tableNames?: string[];
|
|
31
|
+
/** Snapshot of local translations used for three-way sync back. */
|
|
32
|
+
localTranslationsForSync?: TranslationData;
|
|
33
|
+
/** Optional abort signal for cancelling in-flight operations. */
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Result returned by {@link runProviderPipeline} containing processed translations,
|
|
38
|
+
* discovered locales, mapping tables, and optional step results.
|
|
39
|
+
*/
|
|
40
|
+
export interface ProviderPipelineResult {
|
|
41
|
+
/** Merged translation data structured by locale -> table -> key -> value. */
|
|
42
|
+
translations: TranslationData;
|
|
43
|
+
/** Normalized list of locale identifiers present in the translations. */
|
|
44
|
+
locales: string[];
|
|
45
|
+
/** Mapping of original header columns to normalized locale codes. */
|
|
46
|
+
localeMapping: Record<string, string>;
|
|
47
|
+
/** Original locale mapping preserved for reverse lookup. */
|
|
48
|
+
originalLocaleMapping: Record<string, string>;
|
|
49
|
+
/** Total number of tables read from the input provider. */
|
|
50
|
+
inputTableCount: number;
|
|
51
|
+
/** Result from the output provider stage, if outputProvider was configured. */
|
|
52
|
+
outputResult?: TranslationOutputResult;
|
|
53
|
+
/** Result from the sync provider stage, if syncProvider was configured. */
|
|
54
|
+
syncResult?: TranslationSyncResult;
|
|
55
|
+
/** Result from the asset sync provider stage, if assetSyncProvider was configured and executed. */
|
|
56
|
+
assetSyncResult?: AssetSyncResult;
|
|
57
|
+
/** Additional provider-specific metadata returned from the pipeline execution. */
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
interface OrchestratorDeps {
|
|
61
|
+
transformRows: (rows: Record<string, string>[], sheetTitle: string) => SheetProcessingResult;
|
|
62
|
+
logger: Pick<Console, 'warn'>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Runs the full provider-driven translation pipeline: read tables from the input
|
|
66
|
+
* provider, transform rows into canonical {@link TranslationData}, optionally write
|
|
67
|
+
* to an output provider, optionally sync local changes back, and optionally sync
|
|
68
|
+
* assets via an asset-sync provider. Each optional stage is gated by a capability
|
|
69
|
+
* check on the corresponding provider so unsupported operations fail fast instead
|
|
70
|
+
* of silently doing partial work.
|
|
71
|
+
*/
|
|
72
|
+
export declare function runProviderPipeline(options: ProviderPipelineOptions, depsOverrides?: Partial<OrchestratorDeps>): Promise<ProviderPipelineResult>;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/providers/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC9C,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IAC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AK,qBAAqB,CAAC;IAC7F,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAC/B;AAgCD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,uBAAuB,EAChC,aAAa,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAC5C,OAAO,CAAC,sBAAsB,CAAC,CA0GjC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TranslationInputProvider, TranslationOutputProvider, TranslationSyncProvider } from './contracts';
|
|
2
|
+
import type { AssetSyncProvider } from './assetContracts';
|
|
3
|
+
import type { ProviderRuntimeConfig } from './config';
|
|
4
|
+
/**
|
|
5
|
+
* Set of instantiated providers resolved from a {@link ProviderRuntimeConfig}.
|
|
6
|
+
*/
|
|
7
|
+
export interface ProviderRuntimeSelection {
|
|
8
|
+
/** Required input provider for reading source tables. */
|
|
9
|
+
inputProvider: TranslationInputProvider;
|
|
10
|
+
/** Optional output provider for writing destination tables. */
|
|
11
|
+
outputProvider?: TranslationOutputProvider;
|
|
12
|
+
/** Optional sync provider for two-way / three-way changes sync. */
|
|
13
|
+
syncProvider?: TranslationSyncProvider;
|
|
14
|
+
/** Optional asset sync provider for fetching and mirroring media assets. */
|
|
15
|
+
assetSyncProvider?: AssetSyncProvider;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Builds a {@link ProviderRuntimeSelection} by resolving each configured provider slot
|
|
19
|
+
* (`input`, `output`, `sync`, `assetSync`) to a concrete provider instance via its factory.
|
|
20
|
+
* Throws if a slot names a provider ID with no matching factory, or if a provider's
|
|
21
|
+
* required options are missing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createProvidersFromRuntimeConfig(config: ProviderRuntimeConfig): ProviderRuntimeSelection;
|
|
24
|
+
/**
|
|
25
|
+
* Determines whether a runtime config needs authenticated Google credentials, i.e.
|
|
26
|
+
* whether Google Sheets is used for output/sync, or for input without `publicSheet: true`.
|
|
27
|
+
* Used to skip Google auth bootstrapping entirely for CryptPad-only pipelines.
|
|
28
|
+
*/
|
|
29
|
+
export declare function requiresGoogleAuthForRuntimeConfig(config: ProviderRuntimeConfig): boolean;
|
|
30
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/providers/runtime.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,yDAAyD;IACzD,aAAa,EAAE,wBAAwB,CAAC;IACxC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,mEAAmE;IACnE,YAAY,CAAC,EAAE,uBAAuB,CAAC;IACvC,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAwLD;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,qBAAqB,GAC5B,wBAAwB,CAqB1B;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAezF"}
|