@el-j/google-sheet-translations 2.2.0 → 3.0.0-beta.2

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.
Files changed (97) hide show
  1. package/README.md +42 -0
  2. package/dist/action-entrypoint.d.ts.map +1 -1
  3. package/dist/core/rowTransformer.d.ts +26 -0
  4. package/dist/core/rowTransformer.d.ts.map +1 -0
  5. package/dist/esm/index.js +4118 -2524
  6. package/dist/getMultipleSpreadSheetsData.d.ts.map +1 -1
  7. package/dist/getSpreadSheetData.d.ts +3 -3
  8. package/dist/getSpreadSheetData.d.ts.map +1 -1
  9. package/dist/index.d.ts +13 -8
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +4232 -2611
  12. package/dist/migration/migrateV3.d.ts +57 -0
  13. package/dist/migration/migrateV3.d.ts.map +1 -0
  14. package/dist/providers/assetContracts.d.ts +88 -0
  15. package/dist/providers/assetContracts.d.ts.map +1 -0
  16. package/dist/providers/capabilities.d.ts +50 -0
  17. package/dist/providers/capabilities.d.ts.map +1 -0
  18. package/dist/providers/catalog.d.ts +73 -0
  19. package/dist/providers/catalog.d.ts.map +1 -0
  20. package/dist/providers/config.d.ts +56 -0
  21. package/dist/providers/config.d.ts.map +1 -0
  22. package/dist/providers/contracts.d.ts +138 -0
  23. package/dist/providers/contracts.d.ts.map +1 -0
  24. package/dist/providers/cryptpad/assetProvider.d.ts +36 -0
  25. package/dist/providers/cryptpad/assetProvider.d.ts.map +1 -0
  26. package/dist/providers/cryptpad/fullProvider.d.ts +50 -0
  27. package/dist/providers/cryptpad/fullProvider.d.ts.map +1 -0
  28. package/dist/providers/cryptpad/index.d.ts +8 -0
  29. package/dist/providers/cryptpad/index.d.ts.map +1 -0
  30. package/dist/providers/cryptpad/provider.d.ts +37 -0
  31. package/dist/providers/cryptpad/provider.d.ts.map +1 -0
  32. package/dist/providers/google/index.d.ts +4 -0
  33. package/dist/providers/google/index.d.ts.map +1 -0
  34. package/dist/providers/google/providers.d.ts +105 -0
  35. package/dist/providers/google/providers.d.ts.map +1 -0
  36. package/dist/providers/index.d.ts +25 -0
  37. package/dist/providers/index.d.ts.map +1 -0
  38. package/dist/providers/orchestrator.d.ts +74 -0
  39. package/dist/providers/orchestrator.d.ts.map +1 -0
  40. package/dist/providers/runtime.d.ts +30 -0
  41. package/dist/providers/runtime.d.ts.map +1 -0
  42. package/dist/providers/syncEngine.d.ts +106 -0
  43. package/dist/providers/syncEngine.d.ts.map +1 -0
  44. package/dist/setup/gcpTransport.d.ts +25 -0
  45. package/dist/setup/gcpTransport.d.ts.map +1 -1
  46. package/dist/setup/migrateV3Cli.d.ts +2 -0
  47. package/dist/setup/migrateV3Cli.d.ts.map +1 -0
  48. package/dist/setup/providerCli.d.ts +2 -0
  49. package/dist/setup/providerCli.d.ts.map +1 -0
  50. package/dist/setup/wifSetup.d.ts +1 -1
  51. package/dist/setup/wifSetup.d.ts.map +1 -1
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/utils/auth.d.ts +1 -1
  54. package/dist/utils/auth.d.ts.map +1 -1
  55. package/dist/utils/configurationHandler.d.ts.map +1 -1
  56. package/dist/utils/dataConverter/convertFromDataJsonFormat.d.ts +1 -1
  57. package/dist/utils/dataConverter/convertFromDataJsonFormat.d.ts.map +1 -1
  58. package/dist/utils/dataConverter/convertToDataJsonFormat.d.ts +1 -1
  59. package/dist/utils/dataConverter/convertToDataJsonFormat.d.ts.map +1 -1
  60. package/dist/utils/dataConverter/findLocalChanges.d.ts +1 -1
  61. package/dist/utils/dataConverter/findLocalChanges.d.ts.map +1 -1
  62. package/dist/utils/docIngester.d.ts.map +1 -1
  63. package/dist/utils/docParser.d.ts.map +1 -1
  64. package/dist/utils/driveDocScanner.d.ts.map +1 -1
  65. package/dist/utils/driveFolderScanner.d.ts.map +1 -1
  66. package/dist/utils/driveImageSync.d.ts.map +1 -1
  67. package/dist/utils/driveSpreadsheetBootstrap.d.ts.map +1 -1
  68. package/dist/utils/fileWriter.d.ts +1 -1
  69. package/dist/utils/fileWriter.d.ts.map +1 -1
  70. package/dist/utils/getDriveTranslations.d.ts.map +1 -1
  71. package/dist/utils/isDataJsonNewer.d.ts.map +1 -1
  72. package/dist/utils/localImageUtils.d.ts.map +1 -1
  73. package/dist/utils/localeFilter.d.ts.map +1 -1
  74. package/dist/utils/localeNormalizer.d.ts.map +1 -1
  75. package/dist/utils/multiSpreadsheetMerger.d.ts.map +1 -1
  76. package/dist/utils/publicSheetReader.d.ts +1 -1
  77. package/dist/utils/publicSheetReader.d.ts.map +1 -1
  78. package/dist/utils/rateLimiter.d.ts.map +1 -1
  79. package/dist/utils/readDataJson.d.ts +1 -1
  80. package/dist/utils/sheetProcessor.d.ts +4 -9
  81. package/dist/utils/sheetProcessor.d.ts.map +1 -1
  82. package/dist/utils/spreadsheetCreator.d.ts +1 -1
  83. package/dist/utils/spreadsheetCreator.d.ts.map +1 -1
  84. package/dist/utils/spreadsheetFormulas.d.ts +1 -1
  85. package/dist/utils/spreadsheetFormulas.d.ts.map +1 -1
  86. package/dist/utils/spreadsheetUpdater.d.ts +3 -3
  87. package/dist/utils/spreadsheetUpdater.d.ts.map +1 -1
  88. package/dist/utils/syncManager.d.ts +2 -2
  89. package/dist/utils/syncManager.d.ts.map +1 -1
  90. package/dist/utils/translationHelpers.d.ts.map +1 -1
  91. package/dist/utils/validateEnv.d.ts +1 -1
  92. package/dist/utils/validateEnv.d.ts.map +1 -1
  93. package/dist/utils/wait.d.ts.map +1 -1
  94. package/dist-cli/migrate-v3.mjs +406 -0
  95. package/dist-cli/run-provider.mjs +2025 -0
  96. package/dist-cli/setup-wif.mjs +334 -18949
  97. package/package.json +25 -20
@@ -0,0 +1,57 @@
1
+ import type { ProviderRuntimeConfig } from '../providers/config';
2
+ /**
3
+ * Options controlling the automated migration from v2 to v3 provider architecture.
4
+ */
5
+ export interface MigrateV3Options {
6
+ /** Root directory of the project being migrated. Defaults to process.cwd(). */
7
+ projectRoot?: string;
8
+ /** Relative destination path for generated provider config JSON (defaults to 'provider.config.json'). */
9
+ providerConfigPath?: string;
10
+ /** Preview changes without writing any files. */
11
+ dryRun?: boolean;
12
+ /** Rewrite legacy `uses: el-j/google-sheet-translations@...` workflow steps to `provider-config-path` mode. */
13
+ writeWorkflows?: boolean;
14
+ /** Overwrite an existing provider config file at `providerConfigPath` instead of warning and skipping. */
15
+ force?: boolean;
16
+ /** Cross-check the generated provider config against the legacy option mapping and report any drift. */
17
+ parityCheck?: boolean;
18
+ }
19
+ /** Result of comparing the generated provider config against {@link mapLegacyGoogleOptionsToProviderConfig}. */
20
+ export interface MigrationParityCheck {
21
+ passed: boolean;
22
+ differences: string[];
23
+ expectedConfig: ProviderRuntimeConfig;
24
+ }
25
+ /**
26
+ * Summary of actions taken and files modified during v3 project migration.
27
+ */
28
+ export interface MigrateV3Result {
29
+ /** Resolved project root directory. */
30
+ projectRoot: string;
31
+ /** Relative path to the generated provider configuration file. */
32
+ providerConfigPath: string;
33
+ /** Concrete runtime configuration object generated from existing project setup. */
34
+ providerConfig: ProviderRuntimeConfig;
35
+ /** Paths of GitHub Actions workflows containing legacy configurations found. */
36
+ legacyWorkflowsFound: string[];
37
+ /** Paths of workflows rewritten to reference provider-config-path. */
38
+ rewrittenWorkflows: string[];
39
+ /** Paths of newly created files on disk. */
40
+ createdFiles: string[];
41
+ /** Warning messages produced during migration (e.g. conflicting settings). */
42
+ warnings: string[];
43
+ /** Detailed parity check outcome when parityCheck option was enabled. */
44
+ parityCheck?: MigrationParityCheck;
45
+ }
46
+ /**
47
+ * Auto-migrates a project from the legacy GitHub Action inputs to the v3 provider
48
+ * runtime: scans `.github/workflows/*.yml` for steps using the legacy action inputs,
49
+ * generates a {@link ProviderRuntimeConfig} from the first legacy step found, writes
50
+ * it to `providerConfigPath` (unless it already exists and `force` is not set), and —
51
+ * when `writeWorkflows` is set — rewrites each matching step in place to reference
52
+ * that config file instead of the legacy inputs. Workflows using Drive-folder mode
53
+ * (which has no v3 equivalent yet) are left untouched with a warning rather than
54
+ * being rewritten. Throws if no workflow files exist, or if none use the legacy action.
55
+ */
56
+ export declare function migrateProjectToV3(options?: MigrateV3Options): MigrateV3Result;
57
+ //# sourceMappingURL=migrateV3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrateV3.d.ts","sourceRoot":"","sources":["../../src/migration/migrateV3.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yGAAyG;IACzG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+GAA+G;IAC/G,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0GAA0G;IAC1G,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wGAAwG;IACxG,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,gHAAgH;AAChH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,qBAAqB,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mFAAmF;IACnF,cAAc,EAAE,qBAAqB,CAAC;IACtC,gFAAgF;IAChF,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,sEAAsE;IACtE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,4CAA4C;IAC5C,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,yEAAyE;IACzE,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AA4TD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CAwGlF"}
@@ -0,0 +1,88 @@
1
+ import type { ProviderCapabilitySet } from './capabilities';
2
+ /**
3
+ * Provider-side contracts for binary/static asset handling, parallel to the
4
+ * table-oriented contracts in {@link ./contracts}. An asset provider deals in
5
+ * files described by a manifest rather than translation rows.
6
+ */
7
+ export type AssetProviderKind = 'asset-input' | 'asset-output' | 'asset-sync';
8
+ /** One file entry in an asset manifest: where it lives locally/remotely and where it should land. */
9
+ export interface CanonicalAssetEntry {
10
+ assetId: string;
11
+ /** Destination path relative to the sync target directory. */
12
+ relativePath: string;
13
+ /** SHA-256 hash, if already known; used to dedupe fetches across entries. */
14
+ hash?: string;
15
+ sourceUrl?: string;
16
+ sourcePath?: string;
17
+ modifiedTime?: string;
18
+ sizeBytes?: number;
19
+ metadata?: Record<string, unknown>;
20
+ }
21
+ /**
22
+ * Result returned when retrieving an asset manifest.
23
+ */
24
+ export interface AssetManifestResult {
25
+ /** List of asset entries contained in the manifest. */
26
+ assets: CanonicalAssetEntry[];
27
+ /** Optional manifest-level metadata. */
28
+ metadata?: Record<string, unknown>;
29
+ }
30
+ /**
31
+ * Parameters for performing an asset synchronization operation.
32
+ */
33
+ export interface AssetSyncRequest {
34
+ /** Local target directory where assets will be synchronized. */
35
+ targetDirectory: string;
36
+ /** When true, local files under `targetDirectory` not named in the manifest are deleted. */
37
+ deleteMissing?: boolean;
38
+ /** Optional abort signal for early cancellation. */
39
+ signal?: AbortSignal;
40
+ }
41
+ /**
42
+ * Statistics and affected paths resulting from an asset sync execution.
43
+ */
44
+ export interface AssetSyncResult {
45
+ /** Total number of assets listed in the input manifest. */
46
+ manifestCount: number;
47
+ /** Relative paths of assets downloaded fresh. */
48
+ downloaded: string[];
49
+ /** Relative paths of assets modified / updated. */
50
+ updated: string[];
51
+ /** Relative paths of orphaned local assets deleted (when deleteMissing was true). */
52
+ deleted: string[];
53
+ /** Relative paths of unchanged assets skipped due to matching hash or size. */
54
+ skipped: string[];
55
+ /** Optional provider-specific execution metadata. */
56
+ metadata?: Record<string, unknown>;
57
+ }
58
+ /**
59
+ * Common metadata attributes shared across all asset provider interfaces.
60
+ */
61
+ export interface AssetProviderMetadata {
62
+ /** Unique provider identifier (e.g. 'cryptpad-assets'). */
63
+ providerId: string;
64
+ /** Human-readable provider name. */
65
+ displayName: string;
66
+ /** Capability set declaring which asset operations are supported. */
67
+ capabilities: ProviderCapabilitySet;
68
+ }
69
+ /** An asset provider that can list a manifest of assets available to read. */
70
+ export interface AssetInputProvider extends AssetProviderMetadata {
71
+ kind: 'asset-input';
72
+ readAssetManifest(): Promise<AssetManifestResult>;
73
+ }
74
+ /** An asset provider that can write a given manifest of assets to a target directory. */
75
+ export interface AssetOutputProvider extends AssetProviderMetadata {
76
+ kind: 'asset-output';
77
+ writeAssets(manifest: CanonicalAssetEntry[], targetDirectory: string): Promise<AssetSyncResult>;
78
+ }
79
+ /**
80
+ * An asset provider that owns both reading its manifest and syncing assets to a
81
+ * target directory in one call. This is the shape used by the CryptPad asset
82
+ * sync provider and by {@link ProviderPipelineOptions.assetSyncProvider}.
83
+ */
84
+ export interface AssetSyncProvider extends AssetProviderMetadata {
85
+ kind: 'asset-sync';
86
+ syncAssets(request: AssetSyncRequest): Promise<AssetSyncResult>;
87
+ }
88
+ //# sourceMappingURL=assetContracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetContracts.d.ts","sourceRoot":"","sources":["../../src/providers/assetContracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;AAE9E,qGAAqG;AACrG,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9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AAC9E,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,IAAI,EAAE,aAAa,CAAC;IACpB,iBAAiB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACnD;AAED,yFAAyF;AACzF,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,CAAC,QAAQ,EAAE,mBAAmB,EAAE,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACjG;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACjE"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The full set of capability flags a provider can declare. A provider that
3
+ * doesn't support an operation simply leaves the corresponding flag `false`
4
+ * (see {@link EMPTY_PROVIDER_CAPABILITIES}), rather than omitting it.
5
+ */
6
+ export declare const PROVIDER_CAPABILITIES: readonly ['readTables', 'writeTables', 'syncBack', 'readAssets', 'writeAssets', 'autoTranslateFormula', 'discoverByFolder', 'assetSync', 'publicReadNoAuth'];
7
+ /**
8
+ * Union of capability flag identifiers supported by the provider platform.
9
+ */
10
+ export type ProviderCapability = (typeof PROVIDER_CAPABILITIES)[number];
11
+ /**
12
+ * Record mapping each {@link ProviderCapability} to a boolean indicating whether it is supported.
13
+ */
14
+ export type ProviderCapabilitySet = Record<ProviderCapability, boolean>;
15
+ /**
16
+ * Baseline capability set where all capabilities are explicitly disabled (`false`).
17
+ */
18
+ export declare const EMPTY_PROVIDER_CAPABILITIES: ProviderCapabilitySet;
19
+ /**
20
+ * A named pipeline operation (e.g. "read-input") that requires one or more
21
+ * capabilities to be present before it can run. See {@link OPERATION_CAPABILITY_REQUIREMENTS}.
22
+ */
23
+ export type ProviderOperation = 'read-input' | 'write-output' | 'sync-back' | 'read-assets' | 'write-assets' | 'discover-sources' | 'sync-assets' | 'public-read';
24
+ /**
25
+ * Mapping defining which capabilities are mandatory for each {@link ProviderOperation}.
26
+ */
27
+ export declare const OPERATION_CAPABILITY_REQUIREMENTS: Record<ProviderOperation, ProviderCapability[]>;
28
+ /**
29
+ * Builds a full {@link ProviderCapabilitySet}, defaulting every unspecified
30
+ * capability to `false`. Provider factories use this so they only need to
31
+ * name the capabilities they actually support.
32
+ */
33
+ export declare function createCapabilitySet(overrides?: Partial<ProviderCapabilitySet>): ProviderCapabilitySet;
34
+ /** Returns the subset of `required` that `capabilities` does not have set to `true`. */
35
+ export declare function missingCapabilities(capabilities: ProviderCapabilitySet, required: ProviderCapability[]): ProviderCapability[];
36
+ /** Returns `true` only if every capability in `required` is set to `true` on `capabilities`. */
37
+ export declare function hasRequiredCapabilities(capabilities: ProviderCapabilitySet, required: ProviderCapability[]): boolean;
38
+ /**
39
+ * Throws a descriptive error naming `providerName`, `operation` (if given), and every
40
+ * missing capability, unless `capabilities` already satisfies all of `required`.
41
+ */
42
+ export declare function assertRequiredCapabilities(providerName: string, capabilities: ProviderCapabilitySet, required: ProviderCapability[], operation?: string): void;
43
+ /**
44
+ * Convenience wrapper around {@link assertRequiredCapabilities} that looks up the
45
+ * required capabilities for a named {@link ProviderOperation} via
46
+ * {@link OPERATION_CAPABILITY_REQUIREMENTS}. This is the gate every pipeline stage
47
+ * (read/write/sync/asset-sync/discovery) runs through before it executes.
48
+ */
49
+ export declare function assertOperationCapabilities(providerName: string, capabilities: ProviderCapabilitySet, operation: ProviderOperation): void;
50
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/providers/capabilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YAChC,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,kBAAkB,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ification of a discoverable resource within a provider catalog.
4
+ */
5
+ export type ProviderSourceKind = 'table' | 'asset';
6
+ /**
7
+ * Metadata descriptor describing a discoverable data source (sheet, table, or asset manifest).
8
+ */
9
+ export interface ProviderSourceDescriptor {
10
+ /** Identifier of the provider that can read this source. */
11
+ providerId: string;
12
+ /** Unique identifier of the specific resource / document. */
13
+ sourceId: string;
14
+ /** Kind of resource represented by this descriptor. */
15
+ kind: ProviderSourceKind;
16
+ /** Human-readable display title or filename. */
17
+ name: string;
18
+ /** Additional provider-specific metadata (e.g. URLs, mime types). */
19
+ metadata?: Record<string, unknown>;
20
+ }
21
+ /**
22
+ * Filter and cancellation options for catalog source discovery.
23
+ */
24
+ export interface ProviderDiscoveryRequest {
25
+ /** Optional search query or filter string. */
26
+ query?: string;
27
+ /** Optional cancellation signal. */
28
+ signal?: AbortSignal;
29
+ }
30
+ /**
31
+ * Result returned by a catalog source discovery operation.
32
+ */
33
+ export interface ProviderDiscoveryResult {
34
+ /** Discovered source descriptors matching the request. */
35
+ sources: ProviderSourceDescriptor[];
36
+ /** Optional diagnostic or pagination metadata. */
37
+ metadata?: Record<string, unknown>;
38
+ }
39
+ /** A discovery-only provider: it lists available sources, but doesn't read/write/sync them itself. */
40
+ export interface ProviderCatalogProvider {
41
+ kind: 'catalog';
42
+ providerId: string;
43
+ displayName: string;
44
+ capabilities: ProviderCapabilitySet;
45
+ discoverSources(request?: ProviderDiscoveryRequest): Promise<ProviderDiscoveryResult>;
46
+ }
47
+ /**
48
+ * Options for configuring an in-memory {@link ProviderCatalogProvider}.
49
+ */
50
+ export interface InMemoryProviderCatalogOptions {
51
+ /** Custom provider identifier. Defaults to 'in-memory-catalog'. */
52
+ providerId?: string;
53
+ /** Custom human-friendly provider name. */
54
+ displayName?: string;
55
+ /** Fixed list of sources returned during discovery. */
56
+ sources: ProviderSourceDescriptor[];
57
+ }
58
+ /**
59
+ * Creates a {@link ProviderCatalogProvider} backed by a static, in-memory list of
60
+ * sources. `discoverSources({ query })` filters that list by substring match against
61
+ * each source's id, name, and kind (case-insensitive); an empty/absent query returns
62
+ * every source.
63
+ */
64
+ export declare function createInMemoryProviderCatalogProvider(options: InMemoryProviderCatalogOptions): ProviderCatalogProvider;
65
+ /**
66
+ * The built-in catalog listing every provider source shipped with this package
67
+ * (Google Drive folder discovery, CryptPad CSV export URL, CryptPad asset manifest).
68
+ * Each entry is descriptive metadata only — actually reading from a discovered
69
+ * source still goes through the matching input/output/sync/asset-sync provider
70
+ * factory (see {@link createProvidersFromRuntimeConfig}).
71
+ */
72
+ export declare function createDefaultProviderCatalog(): ProviderCatalogProvider;
73
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/providers/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,IAAI,EAAE,kBAAkB,CAAC;IACzB,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0DAA0D;IAC1D,OAAO,EAAE,wBAAwB,EAAE,CAAC;IACpC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,sGAAsG;AACtG,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,qBAAqB,CAAC;IACpC,eAAe,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACvF;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,8BAA8B,GACtC,uBAAuB,CAwBzB;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,uBAAuB,CA4BtE"}
@@ -0,0 +1,56 @@
1
+ import type { SpreadsheetOptions } from '../utils/configurationHandler';
2
+ /**
3
+ * A single provider slot: which provider implementation to instantiate
4
+ * (e.g. "google-sheets", "cryptpad-csv") and the options to pass to its factory.
5
+ */
6
+ export interface ProviderReferenceConfig {
7
+ provider: string;
8
+ options?: Record<string, unknown>;
9
+ }
10
+ /**
11
+ * Declarative runtime configuration consumed by {@link createProvidersFromRuntimeConfig}.
12
+ * Only `input` is required; `output`, `sync`, and `assetSync` are opt-in per pipeline run.
13
+ */
14
+ export interface ProviderRuntimeConfig {
15
+ input: ProviderReferenceConfig;
16
+ output?: ProviderReferenceConfig;
17
+ sync?: ProviderReferenceConfig;
18
+ /** Optional asset-sync provider slot (e.g. "cryptpad-assets"). See {@link AssetSyncProvider}. */
19
+ assetSync?: ProviderReferenceConfig;
20
+ }
21
+ /**
22
+ * Outcome returned by {@link validateProviderRuntimeConfig}.
23
+ */
24
+ export interface ProviderConfigValidationResult {
25
+ /** True when the configuration satisfies all syntactic and structural requirements. */
26
+ valid: boolean;
27
+ /** List of validation error messages encountered during inspection. */
28
+ errors: string[];
29
+ }
30
+ /**
31
+ * Result returned when mapping legacy spreadsheet options to a v3 provider runtime configuration.
32
+ */
33
+ export interface LegacyConfigMappingResult {
34
+ /** Generated modern provider runtime configuration. */
35
+ config: ProviderRuntimeConfig;
36
+ /** Explanatory deprecation warnings advising migration steps. */
37
+ deprecations: string[];
38
+ }
39
+ /**
40
+ * Validates the shape of an untrusted runtime config value (typically parsed from JSON)
41
+ * before it is trusted as a {@link ProviderRuntimeConfig}. Collects every error found
42
+ * rather than failing on the first one, so a config file can be fixed in one pass.
43
+ */
44
+ export declare function validateProviderRuntimeConfig(config: unknown): ProviderConfigValidationResult;
45
+ /**
46
+ * Maps legacy Google-first options to the provider runtime schema.
47
+ * This enables v3 adoption without forcing immediate option rewrites.
48
+ */
49
+ export declare function mapLegacyGoogleOptionsToProviderConfig(options?: SpreadsheetOptions): LegacyConfigMappingResult;
50
+ /**
51
+ * Validates `config` and returns it typed as {@link ProviderRuntimeConfig}, or throws
52
+ * with all collected validation errors joined into a single message. Use this at
53
+ * process boundaries (CLI, Action inputs) where a throw-on-invalid contract is wanted.
54
+ */
55
+ export declare function assertValidProviderRuntimeConfig(config: unknown): ProviderRuntimeConfig;
56
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/providers/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,uBAAuB,CAAC;IAC/B,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC,IAAI,CAAC,EAAE,uBAAuB,CAAC;IAC/B,iGAAiG;IACjG,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,uFAAuF;IACvF,KAAK,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,uDAAuD;IACvD,MAAM,EAAE,qBAAqB,CAAC;IAC9B,iEAAiE;IACjE,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAMD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,OAAO,GAAG,8BAA8B,CA6D7F;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CACpD,OAAO,GAAE,kBAAuB,GAC/B,yBAAyB,CAmC3B;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,OAAO,GAAG,qBAAqB,CAMvF"}
@@ -0,0 +1,138 @@
1
+ import type { SheetRow, TranslationData } from '../types';
2
+ import type { ProviderCapabilitySet } from './capabilities';
3
+ /**
4
+ * Role played by a translation provider in the pipeline.
5
+ */
6
+ export type ProviderKind = 'input' | 'output' | 'sync';
7
+ /**
8
+ * Common metadata attributes implemented by all translation providers.
9
+ */
10
+ export interface ProviderMetadata {
11
+ /** Unique provider identifier (e.g. 'google-sheets', 'cryptpad-csv'). */
12
+ providerId: string;
13
+ /** Human-readable provider name. */
14
+ displayName: string;
15
+ /** Capability set declaring which pipeline operations this provider supports. */
16
+ capabilities: ProviderCapabilitySet;
17
+ }
18
+ /**
19
+ * Canonical representation of a single tabular sheet/sheet-tab read from a provider.
20
+ */
21
+ export interface CanonicalTableInput {
22
+ /** Unique identifier of the table within the data source. */
23
+ tableId: string;
24
+ /** Human-readable name or tab title of the table. */
25
+ tableName: string;
26
+ /** Raw row objects extracted from the table. */
27
+ rows: SheetRow[];
28
+ /** Optional source file path or URL. */
29
+ sourcePath?: string;
30
+ /** ISO timestamp string representing the last modified time if known. */
31
+ modifiedTime?: string;
32
+ /** Provider-specific metadata associated with the table. */
33
+ metadata?: Record<string, unknown>;
34
+ }
35
+ /**
36
+ * Parameters for requesting tables from a {@link TranslationInputProvider}.
37
+ */
38
+ export interface TranslationInputRequest {
39
+ /** Specific table names to fetch. If omitted, all available tables are returned. */
40
+ tableNames?: string[];
41
+ /** Optional abort signal for early cancellation. */
42
+ signal?: AbortSignal;
43
+ }
44
+ /**
45
+ * Result returned by a {@link TranslationInputProvider.readTables} call.
46
+ */
47
+ export interface TranslationInputResult {
48
+ /** Array of canonical tables read from the input provider. */
49
+ tables: CanonicalTableInput[];
50
+ /** Optional provider-level execution metadata. */
51
+ metadata?: Record<string, unknown>;
52
+ }
53
+ /**
54
+ * Payload passed to a {@link TranslationOutputProvider.writeTranslations} call.
55
+ */
56
+ export interface TranslationOutputPayload {
57
+ /** Merged translation data. */
58
+ translations: TranslationData;
59
+ /** List of locales to output. */
60
+ locales: string[];
61
+ /** Mapping of original header columns to normalized locale codes. */
62
+ localeMapping?: Record<string, string>;
63
+ /** Original locale mapping preserved for reverse lookup. */
64
+ originalLocaleMapping?: Record<string, string>;
65
+ /** Optional provider-specific metadata. */
66
+ metadata?: Record<string, unknown>;
67
+ }
68
+ /**
69
+ * Result returned by a {@link TranslationOutputProvider.writeTranslations} call.
70
+ */
71
+ export interface TranslationOutputResult {
72
+ /** List of file paths or resource identifiers written. */
73
+ wroteFiles: string[];
74
+ /** Optional output execution metadata. */
75
+ metadata?: Record<string, unknown>;
76
+ }
77
+ /**
78
+ * Payload passed to a {@link TranslationSyncProvider.syncTranslations} call.
79
+ */
80
+ export interface TranslationSyncPayload {
81
+ /** Local translation snapshot containing recent edits. */
82
+ localTranslations: TranslationData;
83
+ /** Authoritative remote translations snapshot from the provider. */
84
+ remoteTranslations: TranslationData;
85
+ /** Optional sync options and provider metadata. */
86
+ metadata?: Record<string, unknown>;
87
+ }
88
+ /**
89
+ * Result returned by a {@link TranslationSyncProvider.syncTranslations} call.
90
+ */
91
+ export interface TranslationSyncResult {
92
+ /** Number of translation keys created or updated during sync. */
93
+ changedKeys: number;
94
+ /** Number of translation keys skipped (e.g. unmodified or conflict-deferred). */
95
+ skippedKeys: number;
96
+ /** Optional sync outcome metadata. */
97
+ metadata?: Record<string, unknown>;
98
+ }
99
+ /** A provider that reads canonical tables from a data source (e.g. Google Sheets, a CSV file). */
100
+ export interface TranslationInputProvider extends ProviderMetadata {
101
+ kind: 'input';
102
+ readTables(request: TranslationInputRequest): Promise<TranslationInputResult>;
103
+ }
104
+ /** A provider that writes the merged translation set to a destination. */
105
+ export interface TranslationOutputProvider extends ProviderMetadata {
106
+ kind: 'output';
107
+ writeTranslations(payload: TranslationOutputPayload): Promise<TranslationOutputResult>;
108
+ }
109
+ /** A provider that reconciles local translation edits with a remote source, resolving conflicts. */
110
+ export interface TranslationSyncProvider extends ProviderMetadata {
111
+ kind: 'sync';
112
+ syncTranslations(payload: TranslationSyncPayload): Promise<TranslationSyncResult>;
113
+ }
114
+ /**
115
+ * Union of all standard translation provider types.
116
+ */
117
+ export type AnyTranslationProvider = TranslationInputProvider | TranslationOutputProvider | TranslationSyncProvider;
118
+ /**
119
+ * Typed provider registry contract for the orchestration layer.
120
+ * Implementations can provide in-memory, DI, or plugin-backed registries.
121
+ */
122
+ export interface ProviderRegistry {
123
+ register(provider: AnyTranslationProvider): void;
124
+ get(providerId: string): AnyTranslationProvider | undefined;
125
+ list(): AnyTranslationProvider[];
126
+ }
127
+ /**
128
+ * A provider registry partitioned by provider role (`input`, `output`, `sync`).
129
+ */
130
+ export interface SegmentedProviderRegistry {
131
+ registerInput(provider: TranslationInputProvider): void;
132
+ registerOutput(provider: TranslationOutputProvider): void;
133
+ registerSync(provider: TranslationSyncProvider): void;
134
+ getInput(providerId: string): TranslationInputProvider | undefined;
135
+ getOutput(providerId: string): TranslationOutputProvider | undefined;
136
+ getSync(providerId: string): TranslationSyncProvider | undefined;
137
+ }
138
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,oDAAoD;IACpD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,8DAA8D;IAC9D,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EA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BAA0B,SAAQ,gBAAgB;IACjE,IAAI,EAAE,QAAQ,CAAC;IACf,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACxF;AAED,oGAAoG;AACpG,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACnF;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAC9B,wBAAwB,GACxB,yBAAyB,GACzB,uBAAuB,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACjD,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAAC;IAC5D,IAAI,IAAI,sBAAsB,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,aAAa,CAAC,QAAQ,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACxD,cAAc,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC1D,YAAY,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS,CAAC;IACnE,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,CAAC;IACrE,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAAC;CAClE"}
@@ -0,0 +1,36 @@
1
+ import { type ProviderCapabilitySet } from '../capabilities';
2
+ import type { AssetSyncProvider, CanonicalAssetEntry } from '../assetContracts';
3
+ /**
4
+ * Options for configuring a CryptPad asset synchronization provider.
5
+ */
6
+ export interface CryptPadAssetSyncProviderOptions {
7
+ /** Path to a JSON file containing a {@link CanonicalAssetEntry}[] manifest. */
8
+ manifestPath: string;
9
+ /** Optional custom provider identifier. Defaults to 'cryptpad-assets'. */
10
+ providerId?: string;
11
+ /** Optional human-friendly provider name. */
12
+ displayName?: string;
13
+ }
14
+ interface CryptPadAssetSyncProviderDeps {
15
+ readManifest: (manifestPath: string) => Promise<CanonicalAssetEntry[]>;
16
+ readAssetBuffer: (asset: CanonicalAssetEntry, signal?: AbortSignal) => Promise<Buffer>;
17
+ fileExists: (filePath: string) => Promise<boolean>;
18
+ readFile: (filePath: string) => Promise<Buffer>;
19
+ writeFile: (filePath: string, content: Buffer) => Promise<void>;
20
+ listFiles: (directory: string) => Promise<string[]>;
21
+ deleteFile: (filePath: string) => Promise<void>;
22
+ }
23
+ declare const CRYPTPAD_ASSET_SYNC_CAPABILITIES: ProviderCapabilitySet;
24
+ /**
25
+ * Creates an {@link AssetSyncProvider} that syncs binary/static assets described by a
26
+ * JSON manifest (`manifestPath`) into a local target directory. For each manifest
27
+ * entry it downloads a missing file, overwrites a file whose SHA-256 hash differs,
28
+ * or skips a file that is already up to date; entries sharing the same declared
29
+ * `hash` reuse one fetched buffer. When {@link AssetSyncRequest.deleteMissing} is
30
+ * set, local files under the target directory that are not named by the manifest
31
+ * are removed. All target paths are checked with {@link isSafePath} to reject
32
+ * manifest entries that would write outside the target directory.
33
+ */
34
+ export declare function createCryptPadAssetSyncProvider(options: CryptPadAssetSyncProviderOptions, depsOverrides?: Partial<CryptPadAssetSyncProviderDeps>): AssetSyncProvider;
35
+ export { CRYPTPAD_ASSET_SYNC_CAPABILITIES };
36
+ //# sourceMappingURL=assetProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assetProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/cryptpad/assetProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,KAAK,EACV,iBAAiB,EAGjB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,6BAA6B;IACrC,YAAY,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACvE,eAAe,EAAE,CAAC,KAAK,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvF,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACpD,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,QAAA,MAAM,gCAAgC,EAAE,qBAGtC,CAAC;AAgFH;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,gCAAgC,EACzC,aAAa,GAAE,OAAO,CAAC,6BAA6B,CAAM,GACzD,iBAAiB,CAsEnB;AAED,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { TranslationOutputProvider, TranslationSyncProvider } from '../contracts';
2
+ import { type ProviderCapabilitySet } from '../capabilities';
3
+ import { type SyncConflictPolicy } from '../syncEngine';
4
+ import type { TranslationData } from '../../types';
5
+ interface CryptPadWorkspaceSnapshot {
6
+ revision: number;
7
+ translations: TranslationData;
8
+ metadata?: Record<string, unknown>;
9
+ }
10
+ /**
11
+ * Options for configuring CryptPad workspace output and sync providers.
12
+ */
13
+ export interface CryptPadWorkspaceProviderOptions {
14
+ /** Path to the local JSON snapshot file acting as the CryptPad workspace state. */
15
+ filePath: string;
16
+ /** Optional authentication token for future remote write-back endpoints. */
17
+ authToken?: string;
18
+ /** Optimistic-concurrency guard: if set, writes fail unless the on-disk revision matches. */
19
+ expectedRevision?: number;
20
+ /** Conflict resolution strategy used by the sync provider; ignored by the output provider. */
21
+ conflictPolicy?: SyncConflictPolicy;
22
+ /** Custom provider identifier. */
23
+ providerId?: string;
24
+ /** Custom human-friendly provider name. */
25
+ displayName?: string;
26
+ }
27
+ interface CryptPadWorkspaceProviderDeps {
28
+ readSnapshot: (filePath: string, authToken?: string) => Promise<CryptPadWorkspaceSnapshot>;
29
+ writeSnapshot: (filePath: string, snapshot: CryptPadWorkspaceSnapshot, authToken?: string) => Promise<void>;
30
+ }
31
+ declare const CRYPTPAD_WORKSPACE_OUTPUT_CAPABILITIES: ProviderCapabilitySet;
32
+ declare const CRYPTPAD_WORKSPACE_SYNC_CAPABILITIES: ProviderCapabilitySet;
33
+ /**
34
+ * Creates a {@link TranslationOutputProvider} that writes translations into a local
35
+ * JSON snapshot file representing CryptPad workspace state. Each write reads the
36
+ * current snapshot, checks `expectedRevision` (if set) for optimistic-concurrency
37
+ * safety, deep-merges the new translations over the existing ones, and writes back
38
+ * with the revision incremented by one.
39
+ */
40
+ export declare function createCryptPadWorkspaceOutputProvider(options: CryptPadWorkspaceProviderOptions, depsOverrides?: Partial<CryptPadWorkspaceProviderDeps>): TranslationOutputProvider;
41
+ /**
42
+ * Creates a {@link TranslationSyncProvider} that reconciles local translation changes
43
+ * against the CryptPad workspace snapshot using {@link resolveSyncPlan} (three-way
44
+ * diff against `payload.metadata.baseTranslations`, falling back to the remote
45
+ * snapshot as base) and the configured `conflictPolicy`. Like the output provider,
46
+ * it checks `expectedRevision` before writing and increments the revision on write.
47
+ */
48
+ export declare function createCryptPadWorkspaceSyncProvider(options: CryptPadWorkspaceProviderOptions, depsOverrides?: Partial<CryptPadWorkspaceProviderDeps>): TranslationSyncProvider;
49
+ export { CRYPTPAD_WORKSPACE_OUTPUT_CAPABILITIES, CRYPTPAD_WORKSPACE_SYNC_CAPABILITIES };
50
+ //# sourceMappingURL=fullProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fullProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/cryptpad/fullProvider.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,yBAAyB,EAGzB,uBAAuB,EAExB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAmB,KAAK,kBAAkB,EAA2B,MAAM,eAAe,CAAC;AAClG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,UAAU,yBAAyB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8FAA8F;IAC9F,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,6BAA6B;IACrC,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC3F,aAAa,EAAE,CACb,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,yBAAyB,EACnC,SAAS,CAAC,EAAE,MAAM,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,QAAA,MAAM,sCAAsC,EAAE,qBAE5C,CAAC;AAEH,QAAA,MAAM,oCAAoC,EAAE,qBAG1C,CAAC;AAqEH;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,gCAAgC,EACzC,aAAa,GAAE,OAAO,CAAC,6BAA6B,CAAM,GACzD,yBAAyB,CAoC3B;AAaD;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,gCAAgC,EACzC,aAAa,GAAE,OAAO,CAAC,6BAA6B,CAAM,GACzD,uBAAuB,CAgDzB;AAED,OAAO,EAAE,sCAAsC,EAAE,oCAAoC,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Barrel for the CryptPad provider family: CSV input (MVP), workspace output/sync, and asset sync. */
2
+ export { createCryptPadCsvInputProvider, CRYPTPAD_CSV_INPUT_CAPABILITIES } from './provider';
3
+ export { createCryptPadWorkspaceOutputProvider, createCryptPadWorkspaceSyncProvider, CRYPTPAD_WORKSPACE_OUTPUT_CAPABILITIES, CRYPTPAD_WORKSPACE_SYNC_CAPABILITIES, } from './fullProvider';
4
+ export { createCryptPadAssetSyncProvider, CRYPTPAD_ASSET_SYNC_CAPABILITIES } from './assetProvider';
5
+ export type { CryptPadCsvSource, CryptPadCsvInputProviderOptions } from './provider';
6
+ export type { CryptPadWorkspaceProviderOptions } from './fullProvider';
7
+ export type { CryptPadAssetSyncProviderOptions } from './assetProvider';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/cryptpad/index.ts"],"names":[],"mappings":"AAAA,uGAAuG;AACvG,OAAO,EAAE,8BAA8B,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAE7F,OAAO,EACL,qCAAqC,EACrC,mCAAmC,EACnC,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC;AAEpG,YAAY,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAErF,YAAY,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,gCAAgC,EAAE,MAAM,iBAAiB,CAAC"}