@10x-media/dual-session 0.1.0-beta.0 → 0.1.0-beta.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @10x-media/dual-session
2
2
 
3
+ ## 0.1.0-beta.1
4
+
5
+ ### Minor Changes
6
+
7
+ - More built-in locales for the `dualSession:` strings.
8
+
9
+ - Added: `de`, `es`, `fr`, `id`, `pt`, `ru`, `zh`, `uk`, `ar`, `ko`. Every key is covered in each.
10
+
3
11
  ## 0.1.0-beta.0
4
12
 
5
13
  ### Minor Changes
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/ar.ts
3
+ const ar = { [keys.pluginName]: "جلسة مزدوجة" };
4
+ //#endregion
5
+ export { ar };
6
+
7
+ //# sourceMappingURL=ar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ar.js","names":[],"sources":["../../src/translations/ar.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const ar: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'جلسة مزدوجة',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,cACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/de.ts
3
+ const de = { [keys.pluginName]: "Doppelte Sitzung" };
4
+ //#endregion
5
+ export { de };
6
+
7
+ //# sourceMappingURL=de.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"de.js","names":[],"sources":["../../src/translations/de.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const de: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Doppelte Sitzung',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,mBACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/es.ts
3
+ const es = { [keys.pluginName]: "Sesión dual" };
4
+ //#endregion
5
+ export { es };
6
+
7
+ //# sourceMappingURL=es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"es.js","names":[],"sources":["../../src/translations/es.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const es: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Sesión dual',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,cACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/fr.ts
3
+ const fr = { [keys.pluginName]: "Double session" };
4
+ //#endregion
5
+ export { fr };
6
+
7
+ //# sourceMappingURL=fr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fr.js","names":[],"sources":["../../src/translations/fr.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const fr: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Double session',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,iBACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/id.ts
3
+ const id = { [keys.pluginName]: "Sesi Ganda" };
4
+ //#endregion
5
+ export { id };
6
+
7
+ //# sourceMappingURL=id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.js","names":[],"sources":["../../src/translations/id.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const id: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Sesi Ganda',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,aACpB"}
@@ -5,9 +5,19 @@ import { TranslationKey, keys } from "./keys.js";
5
5
  type TranslationsOption = {
6
6
  [locale: string]: Partial<Record<TranslationKey, string>>;
7
7
  };
8
- /** Per-locale messages merged into `config.i18n.translations`. English only for now. */
8
+ /** Per-locale messages merged into `config.i18n.translations`. */
9
9
  declare const translations: {
10
+ ar: Record<string, Record<string, string>>;
11
+ de: Record<string, Record<string, string>>;
10
12
  en: Record<string, Record<string, string>>;
13
+ es: Record<string, Record<string, string>>;
14
+ fr: Record<string, Record<string, string>>;
15
+ id: Record<string, Record<string, string>>;
16
+ ko: Record<string, Record<string, string>>;
17
+ pt: Record<string, Record<string, string>>;
18
+ ru: Record<string, Record<string, string>>;
19
+ uk: Record<string, Record<string, string>>;
20
+ zh: Record<string, Record<string, string>>;
11
21
  };
12
22
  //#endregion
13
23
  export { TranslationsOption, translations };
@@ -1,5 +1,15 @@
1
1
  import "./keys.js";
2
+ import { ar } from "./ar.js";
3
+ import { de } from "./de.js";
2
4
  import { en } from "./en.js";
5
+ import { es } from "./es.js";
6
+ import { fr } from "./fr.js";
7
+ import { id } from "./id.js";
8
+ import { ko } from "./ko.js";
9
+ import { pt } from "./pt.js";
10
+ import { ru } from "./ru.js";
11
+ import { uk } from "./uk.js";
12
+ import { zh } from "./zh.js";
3
13
  //#region src/translations/index.ts
4
14
  /**
5
15
  * Flat `dualSession:foo` entries to the nested `{ dualSession: { foo } }`
@@ -19,8 +29,20 @@ const toNested = (flat) => {
19
29
  }
20
30
  return out;
21
31
  };
22
- /** Per-locale messages merged into `config.i18n.translations`. English only for now. */
23
- const translations = { en: toNested(en) };
32
+ /** Per-locale messages merged into `config.i18n.translations`. */
33
+ const translations = {
34
+ ar: toNested(ar),
35
+ de: toNested(de),
36
+ en: toNested(en),
37
+ es: toNested(es),
38
+ fr: toNested(fr),
39
+ id: toNested(id),
40
+ ko: toNested(ko),
41
+ pt: toNested(pt),
42
+ ru: toNested(ru),
43
+ uk: toNested(uk),
44
+ zh: toNested(zh)
45
+ };
24
46
  //#endregion
25
47
  export { toNested, translations };
26
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/translations/index.ts"],"sourcesContent":["import { en } from './en'\nimport type { TranslationKey } from './keys'\n\nexport type { TranslationKey } from './keys'\nexport { keys } from './keys'\n\n/** Per-locale string overrides keyed by this plugin's typed translation keys. */\nexport type TranslationsOption = {\n\t[locale: string]: Partial<Record<TranslationKey, string>>\n}\n\n/**\n * Flat `dualSession:foo` entries to the nested `{ dualSession: { foo } }`\n * shape Payload resolves `t('dualSession:foo')` against (it splits on `:`).\n * Undefined values are skipped so `Partial` override maps pass through.\n */\nexport const toNested = (flat: {\n\t[key: string]: string | undefined\n}): Record<string, Record<string, string>> => {\n\tconst out: Record<string, Record<string, string>> = {}\n\tfor (const [fullKey, value] of Object.entries(flat)) {\n\t\tif (typeof value !== 'string') {\n\t\t\tcontinue\n\t\t}\n\t\tconst separator = fullKey.indexOf(':')\n\t\t// An unnamespaced key has no bucket to go in, and `slice(0, -1)` would invent one\n\t\t// out of the key with its last character cut off.\n\t\tif (separator < 1) {\n\t\t\tcontinue\n\t\t}\n\t\tconst namespace = fullKey.slice(0, separator)\n\t\tconst bucket = out[namespace] ?? {}\n\t\tbucket[fullKey.slice(separator + 1)] = value\n\t\tout[namespace] = bucket\n\t}\n\treturn out\n}\n\n/** Per-locale messages merged into `config.i18n.translations`. English only for now. */\nexport const translations = {\n\ten: toNested(en),\n}\n"],"mappings":";;;;;;;;AAgBA,MAAa,YAAY,SAEqB;CAC7C,MAAM,MAA8C,CAAC;CACrD,KAAK,MAAM,CAAC,SAAS,UAAU,OAAO,QAAQ,IAAI,GAAG;EACpD,IAAI,OAAO,UAAU,UACpB;EAED,MAAM,YAAY,QAAQ,QAAQ,GAAG;EAGrC,IAAI,YAAY,GACf;EAED,MAAM,YAAY,QAAQ,MAAM,GAAG,SAAS;EAC5C,MAAM,SAAS,IAAI,cAAc,CAAC;EAClC,OAAO,QAAQ,MAAM,YAAY,CAAC,KAAK;EACvC,IAAI,aAAa;CAClB;CACA,OAAO;AACR;;AAGA,MAAa,eAAe,EAC3B,IAAI,SAAS,EAAE,EAChB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/translations/index.ts"],"sourcesContent":["import { ar } from './ar'\nimport { de } from './de'\nimport { en } from './en'\nimport { es } from './es'\nimport { fr } from './fr'\nimport { id } from './id'\nimport type { TranslationKey } from './keys'\nimport { ko } from './ko'\nimport { pt } from './pt'\nimport { ru } from './ru'\nimport { uk } from './uk'\nimport { zh } from './zh'\n\nexport type { TranslationKey } from './keys'\nexport { keys } from './keys'\n\n/** Per-locale string overrides keyed by this plugin's typed translation keys. */\nexport type TranslationsOption = {\n\t[locale: string]: Partial<Record<TranslationKey, string>>\n}\n\n/**\n * Flat `dualSession:foo` entries to the nested `{ dualSession: { foo } }`\n * shape Payload resolves `t('dualSession:foo')` against (it splits on `:`).\n * Undefined values are skipped so `Partial` override maps pass through.\n */\nexport const toNested = (flat: {\n\t[key: string]: string | undefined\n}): Record<string, Record<string, string>> => {\n\tconst out: Record<string, Record<string, string>> = {}\n\tfor (const [fullKey, value] of Object.entries(flat)) {\n\t\tif (typeof value !== 'string') {\n\t\t\tcontinue\n\t\t}\n\t\tconst separator = fullKey.indexOf(':')\n\t\t// An unnamespaced key has no bucket to go in, and `slice(0, -1)` would invent one\n\t\t// out of the key with its last character cut off.\n\t\tif (separator < 1) {\n\t\t\tcontinue\n\t\t}\n\t\tconst namespace = fullKey.slice(0, separator)\n\t\tconst bucket = out[namespace] ?? {}\n\t\tbucket[fullKey.slice(separator + 1)] = value\n\t\tout[namespace] = bucket\n\t}\n\treturn out\n}\n\n/** Per-locale messages merged into `config.i18n.translations`. */\nexport const translations = {\n\tar: toNested(ar),\n\tde: toNested(de),\n\ten: toNested(en),\n\tes: toNested(es),\n\tfr: toNested(fr),\n\tid: toNested(id),\n\tko: toNested(ko),\n\tpt: toNested(pt),\n\tru: toNested(ru),\n\tuk: toNested(uk),\n\tzh: toNested(zh),\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAa,YAAY,SAEqB;CAC7C,MAAM,MAA8C,CAAC;CACrD,KAAK,MAAM,CAAC,SAAS,UAAU,OAAO,QAAQ,IAAI,GAAG;EACpD,IAAI,OAAO,UAAU,UACpB;EAED,MAAM,YAAY,QAAQ,QAAQ,GAAG;EAGrC,IAAI,YAAY,GACf;EAED,MAAM,YAAY,QAAQ,MAAM,GAAG,SAAS;EAC5C,MAAM,SAAS,IAAI,cAAc,CAAC;EAClC,OAAO,QAAQ,MAAM,YAAY,CAAC,KAAK;EACvC,IAAI,aAAa;CAClB;CACA,OAAO;AACR;;AAGA,MAAa,eAAe;CAC3B,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;CACf,IAAI,SAAS,EAAE;AAChB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/ko.ts
3
+ const ko = { [keys.pluginName]: "이중 세션" };
4
+ //#endregion
5
+ export { ko };
6
+
7
+ //# sourceMappingURL=ko.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ko.js","names":[],"sources":["../../src/translations/ko.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const ko: Record<TranslationKey, string> = {\n\t[keys.pluginName]: '이중 세션',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,QACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/pt.ts
3
+ const pt = { [keys.pluginName]: "Sessão dupla" };
4
+ //#endregion
5
+ export { pt };
6
+
7
+ //# sourceMappingURL=pt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pt.js","names":[],"sources":["../../src/translations/pt.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const pt: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Sessão dupla',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,eACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/ru.ts
3
+ const ru = { [keys.pluginName]: "Двойная сессия" };
4
+ //#endregion
5
+ export { ru };
6
+
7
+ //# sourceMappingURL=ru.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ru.js","names":[],"sources":["../../src/translations/ru.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const ru: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Двойная сессия',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,iBACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/uk.ts
3
+ const uk = { [keys.pluginName]: "Подвійна сесія" };
4
+ //#endregion
5
+ export { uk };
6
+
7
+ //# sourceMappingURL=uk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uk.js","names":[],"sources":["../../src/translations/uk.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const uk: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Подвійна сесія',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,iBACpB"}
@@ -0,0 +1,7 @@
1
+ import { keys } from "./keys.js";
2
+ //#region src/translations/zh.ts
3
+ const zh = { [keys.pluginName]: "双会话" };
4
+ //#endregion
5
+ export { zh };
6
+
7
+ //# sourceMappingURL=zh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zh.js","names":[],"sources":["../../src/translations/zh.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const zh: Record<TranslationKey, string> = {\n\t[keys.pluginName]: '双会话',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC,GAChD,KAAK,aAAa,MACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10x-media/dual-session",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "Give each Payload auth collection its own session cookie, so an admin session and a frontend session can coexist.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -89,9 +89,9 @@
89
89
  "typescript": "5.9.3",
90
90
  "vitest": "4.1.7",
91
91
  "@10x-media/tsconfig": "0.0.0",
92
- "@10x-media/vitest-config": "0.0.0",
92
+ "@10x-media/payload-test-harness": "0.0.0",
93
93
  "@10x-media/tsdown-config": "0.0.0",
94
- "@10x-media/payload-test-harness": "0.0.0"
94
+ "@10x-media/vitest-config": "0.0.0"
95
95
  },
96
96
  "publishConfig": {
97
97
  "access": "public"