@powerhousedao/shared 6.2.3-dev.64 → 6.2.3-dev.65

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.
@@ -0,0 +1,26 @@
1
+ //#region clis/ph-dir.d.ts
2
+ /**
3
+ * The project's `.ph` tree — stores, identity, run records, registry cache.
4
+ *
5
+ * Classically `<cwd>/.ph` (every classic command resolves it exactly so). A
6
+ * desktop shell relocates the WHOLE tree under the user's profile by setting
7
+ * `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names
8
+ * under a different root, and nothing of the user's lands in the install
9
+ * dir. One resolver replaces the former `.ph/...` literals; it adds no path
10
+ * names and no layout of its own.
11
+ */
12
+ export declare function resolvePhDir(base?: string, env?: Record<string, string | undefined>): string;
13
+ /**
14
+ * The two PGlite store dirs the switchboard defaults to, for the server and
15
+ * for `ph switchboard --reset` (which must touch the same paths). Without a
16
+ * user-data root these are the classic literals, verbatim — byte-identical
17
+ * to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they
18
+ * are the same names inside `${userData}/.ph`.
19
+ */
20
+ export declare function defaultStoreDirs(env?: Record<string, string | undefined>, phDir?: string): {
21
+ reactor: string;
22
+ readModel: string;
23
+ };
24
+ //#endregion
25
+ export {};
26
+ //# sourceMappingURL=ph-dir.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ph-dir.d.mts","names":[],"sources":["../../clis/ph-dir.ts"],"mappings":";;;;;;;;;;;wBAYgB,aACd,eACA,MAAK;;;;;;;;wBAYS,iBACd,MAAK,oCACL;EACG;EAAiB"}
@@ -0,0 +1,37 @@
1
+ import path from "node:path";
2
+ //#region clis/ph-dir.ts
3
+ /**
4
+ * The project's `.ph` tree — stores, identity, run records, registry cache.
5
+ *
6
+ * Classically `<cwd>/.ph` (every classic command resolves it exactly so). A
7
+ * desktop shell relocates the WHOLE tree under the user's profile by setting
8
+ * `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names
9
+ * under a different root, and nothing of the user's lands in the install
10
+ * dir. One resolver replaces the former `.ph/...` literals; it adds no path
11
+ * names and no layout of its own.
12
+ */
13
+ function resolvePhDir(base = process.cwd(), env = process.env) {
14
+ return path.join(env.PH_USER_DATA_DIR ?? base, ".ph");
15
+ }
16
+ /**
17
+ * The two PGlite store dirs the switchboard defaults to, for the server and
18
+ * for `ph switchboard --reset` (which must touch the same paths). Without a
19
+ * user-data root these are the classic literals, verbatim — byte-identical
20
+ * to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they
21
+ * are the same names inside `${userData}/.ph`.
22
+ */
23
+ function defaultStoreDirs(env = process.env, phDir) {
24
+ const root = phDir ?? (env.PH_USER_DATA_DIR ? resolvePhDir(void 0, env) : void 0);
25
+ if (root === void 0) return {
26
+ reactor: "./.ph/reactor-storage",
27
+ readModel: ".ph/read-storage"
28
+ };
29
+ return {
30
+ reactor: path.join(root, "reactor-storage"),
31
+ readModel: path.join(root, "read-storage")
32
+ };
33
+ }
34
+ //#endregion
35
+ export { defaultStoreDirs, resolvePhDir };
36
+
37
+ //# sourceMappingURL=ph-dir.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ph-dir.mjs","names":[],"sources":["../../clis/ph-dir.ts"],"sourcesContent":["import path from \"node:path\";\n\n/**\n * The project's `.ph` tree — stores, identity, run records, registry cache.\n *\n * Classically `<cwd>/.ph` (every classic command resolves it exactly so). A\n * desktop shell relocates the WHOLE tree under the user's profile by setting\n * `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names\n * under a different root, and nothing of the user's lands in the install\n * dir. One resolver replaces the former `.ph/...` literals; it adds no path\n * names and no layout of its own.\n */\nexport function resolvePhDir(\n base: string = process.cwd(),\n env: Record<string, string | undefined> = process.env,\n): string {\n return path.join(env.PH_USER_DATA_DIR ?? base, \".ph\");\n}\n\n/**\n * The two PGlite store dirs the switchboard defaults to, for the server and\n * for `ph switchboard --reset` (which must touch the same paths). Without a\n * user-data root these are the classic literals, verbatim — byte-identical\n * to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they\n * are the same names inside `${userData}/.ph`.\n */\nexport function defaultStoreDirs(\n env: Record<string, string | undefined> = process.env,\n phDir?: string,\n): { reactor: string; readModel: string } {\n const root =\n phDir ?? (env.PH_USER_DATA_DIR ? resolvePhDir(undefined, env) : undefined);\n if (root === undefined) {\n return { reactor: \"./.ph/reactor-storage\", readModel: \".ph/read-storage\" };\n }\n return {\n reactor: path.join(root, \"reactor-storage\"),\n readModel: path.join(root, \"read-storage\"),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,aACd,OAAe,QAAQ,IAAI,GAC3B,MAA0C,QAAQ,KAC1C;CACR,OAAO,KAAK,KAAK,IAAI,oBAAoB,MAAM,KAAK;AACtD;;;;;;;;AASA,SAAgB,iBACd,MAA0C,QAAQ,KAClD,OACwC;CACxC,MAAM,OACJ,UAAU,IAAI,mBAAmB,aAAa,KAAA,GAAW,GAAG,IAAI,KAAA;CAClE,IAAI,SAAS,KAAA,GACX,OAAO;EAAE,SAAS;EAAyB,WAAW;CAAmB;CAE3E,OAAO;EACL,SAAS,KAAK,KAAK,MAAM,iBAAiB;EAC1C,WAAW,KAAK,KAAK,MAAM,cAAc;CAC3C;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/shared",
3
- "version": "6.2.3-dev.64",
3
+ "version": "6.2.3-dev.65",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "publishConfig": {
@@ -95,6 +95,10 @@
95
95
  "source": "./clis/project-env.ts",
96
96
  "import": "./dist/clis/project-env.mjs"
97
97
  },
98
+ "./clis/ph-dir": {
99
+ "source": "./clis/ph-dir.ts",
100
+ "import": "./dist/clis/ph-dir.mjs"
101
+ },
98
102
  "./clis/utils": {
99
103
  "source": "./clis/utils.ts",
100
104
  "import": "./dist/clis/utils.mjs"