@flyingrobots/bijou-i18n-tools 4.4.1 → 5.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 CHANGED
@@ -11,6 +11,7 @@ Workflow and authoring tooling for Bijou localization.
11
11
  - CSV/TSV sheet serialization and parsing
12
12
  - serializable catalog-bundle export/import
13
13
  - JSON bundle serialization and parsing
14
+ - provider-neutral async service adapter ports for workbook and bundle exchange
14
15
  - typed value encoding/decoding for strings, data, and refs
15
16
  - reference validation and normalization
16
17
  - compilation into `@flyingrobots/bijou-i18n` runtime catalogs
@@ -18,6 +19,26 @@ Workflow and authoring tooling for Bijou localization.
18
19
 
19
20
  This package is intentionally provider-neutral. Filesystem, XLSX, or service-backed adapters can sit on top of it without polluting the core tooling API.
20
21
 
22
+ Service-backed workflows can use the built-in async adapter ports without
23
+ pulling remote service details into the tooling core:
24
+
25
+ ```typescript
26
+ import { pushTranslationWorkbookToService, type ExchangeWorkbookServiceAdapter } from '@flyingrobots/bijou-i18n-tools';
27
+
28
+ const adapter: ExchangeWorkbookServiceAdapter = {
29
+ pull: async () => ({ value: existingWorkbook, revision: 'rev-1' }),
30
+ push: async (snapshot) => snapshot,
31
+ };
32
+
33
+ await pushTranslationWorkbookToService(adapter, catalogs, 'de', {
34
+ revision: 'rev-1',
35
+ });
36
+ ```
37
+
38
+ Concrete Google Sheets or other remote service clients should live outside this
39
+ package and implement the adapter contract on top of the existing workbook or
40
+ bundle exchange shapes.
41
+
21
42
  ## Documentation
22
43
 
23
44
  See the [Bijou repo](https://github.com/flyingrobots/bijou) for the full documentation map, architecture guide, and design system.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { parseCatalogBundleJson, parseExchangeSheet, serializeCatalogBundleJson, serializeExchangeSheet, type DelimitedFormat, } from './adapters.js';
2
2
  export { decodeExchangeValue, encodeExchangeValue, exportCatalogBundle, exportTranslationWorkbook, importCatalogBundle, importTranslationWorkbook, type CatalogBundle, type EncodedExchangeValue, type ExchangeSheet, type ExchangeValueKind, type ExchangeWorkbook, type SerializedAuthoringCatalog, type SerializedAuthoringCatalogEntry, type SerializedAuthoringTranslation, type TranslationWorkbookRow, } from './exchange.js';
3
3
  export { compileCatalogs, exportTranslationRows, hashSourceValue, importTranslationRows, markStaleTranslations, pseudoLocalize, ref, type AuthoringCatalog, type AuthoringCatalogEntry, type AuthoringTranslation, type AuthoringTranslationStatus, type TranslationRow, } from './tools.js';
4
+ export { pullCatalogBundleFromService, pullTranslationWorkbookFromService, pushCatalogBundleToService, pushTranslationWorkbookToService, type CatalogBundleServiceAdapter, type CatalogBundleServicePullResult, type ExchangeWorkbookServiceAdapter, type ServiceExchangeAdapter, type ServiceExchangeSnapshot, type TranslationWorkbookServicePullResult, } from './service.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,GAAG,EACH,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,EACtB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,GAAG,EACH,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,0BAA0B,EAC1B,gCAAgC,EAChC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oCAAoC,GAC1C,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { parseCatalogBundleJson, parseExchangeSheet, serializeCatalogBundleJson, serializeExchangeSheet, } from './adapters.js';
2
2
  export { decodeExchangeValue, encodeExchangeValue, exportCatalogBundle, exportTranslationWorkbook, importCatalogBundle, importTranslationWorkbook, } from './exchange.js';
3
3
  export { compileCatalogs, exportTranslationRows, hashSourceValue, importTranslationRows, markStaleTranslations, pseudoLocalize, ref, } from './tools.js';
4
+ export { pullCatalogBundleFromService, pullTranslationWorkbookFromService, pushCatalogBundleToService, pushTranslationWorkbookToService, } from './service.js';
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,GAEvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,GAU1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,GAAG,GAMJ,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,sBAAsB,GAEvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,GAU1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,GAAG,GAMJ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,0BAA0B,EAC1B,gCAAgC,GAOjC,MAAM,cAAc,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { CatalogBundle, ExchangeWorkbook } from './exchange.js';
2
+ import type { AuthoringCatalog, TranslationRow } from './tools.js';
3
+ export interface ServiceExchangeSnapshot<T> {
4
+ readonly value: T;
5
+ readonly revision?: string;
6
+ }
7
+ export interface ServiceExchangeAdapter<T> {
8
+ pull(): Promise<ServiceExchangeSnapshot<T>>;
9
+ push(snapshot: ServiceExchangeSnapshot<T>): Promise<ServiceExchangeSnapshot<T>>;
10
+ }
11
+ export type ExchangeWorkbookServiceAdapter = ServiceExchangeAdapter<ExchangeWorkbook>;
12
+ export type CatalogBundleServiceAdapter = ServiceExchangeAdapter<CatalogBundle>;
13
+ export interface TranslationWorkbookServicePullResult {
14
+ readonly snapshot: ServiceExchangeSnapshot<ExchangeWorkbook>;
15
+ readonly rows: readonly TranslationRow[];
16
+ }
17
+ export interface CatalogBundleServicePullResult {
18
+ readonly snapshot: ServiceExchangeSnapshot<CatalogBundle>;
19
+ readonly catalogs: readonly AuthoringCatalog[];
20
+ }
21
+ export declare function pullTranslationWorkbookFromService(adapter: ExchangeWorkbookServiceAdapter): Promise<TranslationWorkbookServicePullResult>;
22
+ export declare function pushTranslationWorkbookToService(adapter: ExchangeWorkbookServiceAdapter, catalogs: readonly AuthoringCatalog[], locale: string, snapshot?: Omit<ServiceExchangeSnapshot<ExchangeWorkbook>, 'value'>): Promise<ServiceExchangeSnapshot<ExchangeWorkbook>>;
23
+ export declare function pullCatalogBundleFromService(adapter: CatalogBundleServiceAdapter): Promise<CatalogBundleServicePullResult>;
24
+ export declare function pushCatalogBundleToService(adapter: CatalogBundleServiceAdapter, catalogs: readonly AuthoringCatalog[], snapshot?: Omit<ServiceExchangeSnapshot<CatalogBundle>, 'value'>): Promise<ServiceExchangeSnapshot<CatalogBundle>>;
25
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,WAAW,uBAAuB,CAAC,CAAC;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AO,EAAE,2BAA2B,EACpC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EACrC,QAAQ,GAAE,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,EAAE,OAAO,CAAM,GACnE,OAAO,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAKjD"}
@@ -0,0 +1,28 @@
1
+ import { exportCatalogBundle, exportTranslationWorkbook, importCatalogBundle, importTranslationWorkbook } from './exchange.js';
2
+ export async function pullTranslationWorkbookFromService(adapter) {
3
+ const snapshot = await adapter.pull();
4
+ return {
5
+ snapshot,
6
+ rows: importTranslationWorkbook(snapshot.value),
7
+ };
8
+ }
9
+ export async function pushTranslationWorkbookToService(adapter, catalogs, locale, snapshot = {}) {
10
+ return adapter.push({
11
+ ...snapshot,
12
+ value: exportTranslationWorkbook(catalogs, locale),
13
+ });
14
+ }
15
+ export async function pullCatalogBundleFromService(adapter) {
16
+ const snapshot = await adapter.pull();
17
+ return {
18
+ snapshot,
19
+ catalogs: importCatalogBundle(snapshot.value),
20
+ };
21
+ }
22
+ export async function pushCatalogBundleToService(adapter, catalogs, snapshot = {}) {
23
+ return adapter.push({
24
+ ...snapshot,
25
+ value: exportCatalogBundle(catalogs),
26
+ });
27
+ }
28
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AA0B/H,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,OAAuC;IAEvC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACtC,OAAO;QACL,QAAQ;QACR,IAAI,EAAE,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC;KAChD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,OAAuC,EACvC,QAAqC,EACrC,MAAc,EACd,WAAqE,EAAE;IAEvE,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,GAAG,QAAQ;QACX,KAAK,EAAE,yBAAyB,CAAC,QAAQ,EAAE,MAAM,CAAC;KACnD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,OAAoC;IAEpC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACtC,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,OAAoC,EACpC,QAAqC,EACrC,WAAkE,EAAE;IAEpE,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,GAAG,QAAQ;QACX,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC;KACrC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flyingrobots/bijou-i18n-tools",
3
- "version": "4.4.1",
3
+ "version": "5.0.0",
4
4
  "description": "Localization workflow tooling for Bijou — authoring catalogs, stale detection, tabular export/import, and runtime compilation.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -24,7 +24,7 @@
24
24
  "lint": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
- "@flyingrobots/bijou-i18n": "4.4.1"
27
+ "@flyingrobots/bijou-i18n": "5.0.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^22.0.0",