@ifunny/ifunny-api-types 1.0.4 → 1.2.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.
Files changed (215) hide show
  1. package/.devenv/bootstrap/bootstrapLib.nix +630 -0
  2. package/.devenv/bootstrap/default.nix +22 -0
  3. package/.devenv/bootstrap/resolve-lock.nix +190 -0
  4. package/.devenv/changelog-cache.json +9 -0
  5. package/.devenv/devenv.fish +252 -0
  6. package/.devenv/imports.txt +0 -0
  7. package/.devenv/input-paths.txt +10 -0
  8. package/.devenv/load-exports +1 -0
  9. package/.devenv/nix-eval-cache.db +0 -0
  10. package/.devenv/nix-eval-cache.db-shm +0 -0
  11. package/.devenv/nix-eval-cache.db-wal +0 -0
  12. package/.devenv/nix-eval-cache.db.init.lock +0 -0
  13. package/.devenv/nixpkgs-config-99f33fda17d41bc9.nix +17 -0
  14. package/.devenv/nixpkgs-config-c46eff8321b73149.nix +29 -0
  15. package/.devenv/profiles/nix/bootstrap/bootstrapLib.nix +571 -0
  16. package/.devenv/profiles/nix/bootstrap/default.nix +19 -0
  17. package/.devenv/profiles/nix/bootstrap/resolve-lock.nix +157 -0
  18. package/.devenv/profiles/nix/imports.txt +0 -0
  19. package/.devenv/profiles/nix/input-paths.txt +4 -0
  20. package/.devenv/profiles/nix/load-exports +1 -0
  21. package/.devenv/profiles/nix/nix-eval-cache.db +0 -0
  22. package/.devenv/profiles/nix/nix-eval-cache.db-shm +0 -0
  23. package/.devenv/profiles/nix/nix-eval-cache.db-wal +0 -0
  24. package/.devenv/profiles/nix/nixpkgs-config-99f33fda17d41bc9.nix +17 -0
  25. package/.devenv/profiles/nix/shell-0d722b4fe4724c8e.sh +2270 -0
  26. package/.devenv/profiles/nix/shell-314b72302fb2c916.sh +2270 -0
  27. package/.devenv/profiles/nix/shell-6a4b00b5ca837a3b.sh +2270 -0
  28. package/.devenv/profiles/nix/shell-956adc1e664f64c3.sh +2270 -0
  29. package/.devenv/profiles/nix/shell-9dbff87fad44e8d9.sh +2270 -0
  30. package/.devenv/profiles/nix/shell-b1e9e1f82076662f.sh +2270 -0
  31. package/.devenv/profiles/nix/shell-b4f4bbfa36797bee.sh +2270 -0
  32. package/.devenv/profiles/nix/shell-c4b190d331c48d67.sh +2270 -0
  33. package/.devenv/profiles/nix/state/files.json +1 -0
  34. package/.devenv/profiles/nix/state/tasks.db +0 -0
  35. package/.devenv/profiles/nix/state/tasks.db-shm +0 -0
  36. package/.devenv/profiles/nix/state/tasks.db-wal +0 -0
  37. package/.devenv/profiles/nix/task-names.txt +5 -0
  38. package/.devenv/shell-086ca2c39799e6a6.sh +2270 -0
  39. package/.devenv/shell-2c06a35dd99be3d1.sh +2270 -0
  40. package/.devenv/shell-36f1fe0faec08873.sh +2270 -0
  41. package/.devenv/shell-676361065bda5b43.sh +2270 -0
  42. package/.devenv/shell-9f6cb513d1721fef.sh +2270 -0
  43. package/.devenv/shell-c0e4459b4f5922d7.sh +2270 -0
  44. package/.devenv/shell-c862a0db6e9ad5f4.sh +2270 -0
  45. package/.devenv/shell-d71ade933a43e837.sh +2270 -0
  46. package/.devenv/shell-dd73aac05b182946.sh +2270 -0
  47. package/.devenv/shell-e39d0b30a7e0eb13.sh +2270 -0
  48. package/.devenv/shell-env.sh +2263 -0
  49. package/.devenv/shell-f924d749ff8c17ee.sh +2270 -0
  50. package/.devenv/shell-rcfile.sh +152 -0
  51. package/.devenv/state/files.json +1 -0
  52. package/.devenv/state/tasks.db +0 -0
  53. package/.devenv/state/tasks.db-shm +0 -0
  54. package/.devenv/state/tasks.db-wal +0 -0
  55. package/.devenv/state/tasks.db.init.lock +0 -0
  56. package/.devenv/task-names.txt +5 -0
  57. package/.github/workflows/codeql.yml +72 -72
  58. package/.github/workflows/test.yml +31 -31
  59. package/CHANGELOG.md +8405 -427
  60. package/LICENSE +121 -121
  61. package/README.md +2 -2
  62. package/devenv.lock +65 -0
  63. package/devenv.nix +38 -0
  64. package/devenv.yaml +18 -0
  65. package/eslint.config.mjs +18 -0
  66. package/package.json +59 -50
  67. package/prettier.config.js +15 -0
  68. package/dist/errors/bad_request.js +0 -8
  69. package/dist/errors/bad_request.js.map +0 -1
  70. package/dist/errors/captcha_required.js +0 -19
  71. package/dist/errors/captcha_required.js.map +0 -1
  72. package/dist/errors/email_exists.js +0 -8
  73. package/dist/errors/email_exists.js.map +0 -1
  74. package/dist/errors/error.js +0 -3
  75. package/dist/errors/error.js.map +0 -1
  76. package/dist/errors/error_base.js +0 -43
  77. package/dist/errors/error_base.js.map +0 -1
  78. package/dist/errors/index.js +0 -29
  79. package/dist/errors/index.js.map +0 -1
  80. package/dist/errors/invalid_client.js +0 -8
  81. package/dist/errors/invalid_client.js.map +0 -1
  82. package/dist/errors/invalid_email.js +0 -8
  83. package/dist/errors/invalid_email.js.map +0 -1
  84. package/dist/errors/invalid_grant.js +0 -8
  85. package/dist/errors/invalid_grant.js.map +0 -1
  86. package/dist/errors/not_found.js +0 -3
  87. package/dist/errors/not_found.js.map +0 -1
  88. package/dist/errors/permission_denied.js +0 -8
  89. package/dist/errors/permission_denied.js.map +0 -1
  90. package/dist/errors/unauthorized.js +0 -8
  91. package/dist/errors/unauthorized.js.map +0 -1
  92. package/dist/errors/wrong_params.js +0 -8
  93. package/dist/errors/wrong_params.js.map +0 -1
  94. package/dist/index.js +0 -21
  95. package/dist/index.js.map +0 -1
  96. package/dist/payloads/activity.js +0 -50
  97. package/dist/payloads/activity.js.map +0 -1
  98. package/dist/payloads/app.js +0 -3
  99. package/dist/payloads/app.js.map +0 -1
  100. package/dist/payloads/appeal.js +0 -14
  101. package/dist/payloads/appeal.js.map +0 -1
  102. package/dist/payloads/ban.js +0 -36
  103. package/dist/payloads/ban.js.map +0 -1
  104. package/dist/payloads/base.js +0 -3
  105. package/dist/payloads/base.js.map +0 -1
  106. package/dist/payloads/client.js +0 -13
  107. package/dist/payloads/client.js.map +0 -1
  108. package/dist/payloads/comment.js +0 -42
  109. package/dist/payloads/comment.js.map +0 -1
  110. package/dist/payloads/content.js +0 -176
  111. package/dist/payloads/content.js.map +0 -1
  112. package/dist/payloads/index.js +0 -27
  113. package/dist/payloads/index.js.map +0 -1
  114. package/dist/payloads/strike.js +0 -3
  115. package/dist/payloads/strike.js.map +0 -1
  116. package/dist/payloads/user.js +0 -215
  117. package/dist/payloads/user.js.map +0 -1
  118. package/dist/rest/account.js +0 -3
  119. package/dist/rest/account.js.map +0 -1
  120. package/dist/rest/content.js +0 -54
  121. package/dist/rest/content.js.map +0 -1
  122. package/dist/rest/counters.js +0 -3
  123. package/dist/rest/counters.js.map +0 -1
  124. package/dist/rest/endpoints.js +0 -199
  125. package/dist/rest/endpoints.js.map +0 -1
  126. package/dist/rest/explore.js +0 -82
  127. package/dist/rest/explore.js.map +0 -1
  128. package/dist/rest/feeds.js +0 -3
  129. package/dist/rest/feeds.js.map +0 -1
  130. package/dist/rest/index.js +0 -25
  131. package/dist/rest/index.js.map +0 -1
  132. package/dist/rest/issues.js +0 -3
  133. package/dist/rest/issues.js.map +0 -1
  134. package/dist/rest/oauth2.js +0 -9
  135. package/dist/rest/oauth2.js.map +0 -1
  136. package/dist/utils/index.js +0 -19
  137. package/dist/utils/index.js.map +0 -1
  138. package/dist/utils/rest.js +0 -3
  139. package/dist/utils/rest.js.map +0 -1
  140. package/dist/utils/util.js +0 -3
  141. package/dist/utils/util.js.map +0 -1
  142. package/types/errors/bad_request.d.ts +0 -12
  143. package/types/errors/bad_request.d.ts.map +0 -1
  144. package/types/errors/captcha_required.d.ts +0 -33
  145. package/types/errors/captcha_required.d.ts.map +0 -1
  146. package/types/errors/email_exists.d.ts +0 -15
  147. package/types/errors/email_exists.d.ts.map +0 -1
  148. package/types/errors/error.d.ts +0 -29
  149. package/types/errors/error.d.ts.map +0 -1
  150. package/types/errors/error_base.d.ts +0 -61
  151. package/types/errors/error_base.d.ts.map +0 -1
  152. package/types/errors/index.d.ts +0 -13
  153. package/types/errors/index.d.ts.map +0 -1
  154. package/types/errors/invalid_client.d.ts +0 -15
  155. package/types/errors/invalid_client.d.ts.map +0 -1
  156. package/types/errors/invalid_email.d.ts +0 -15
  157. package/types/errors/invalid_email.d.ts.map +0 -1
  158. package/types/errors/invalid_grant.d.ts +0 -12
  159. package/types/errors/invalid_grant.d.ts.map +0 -1
  160. package/types/errors/not_found.d.ts +0 -8
  161. package/types/errors/not_found.d.ts.map +0 -1
  162. package/types/errors/permission_denied.d.ts +0 -12
  163. package/types/errors/permission_denied.d.ts.map +0 -1
  164. package/types/errors/unauthorized.d.ts +0 -12
  165. package/types/errors/unauthorized.d.ts.map +0 -1
  166. package/types/errors/wrong_params.d.ts +0 -11
  167. package/types/errors/wrong_params.d.ts.map +0 -1
  168. package/types/index.d.ts +0 -5
  169. package/types/index.d.ts.map +0 -1
  170. package/types/payloads/activity.d.ts +0 -114
  171. package/types/payloads/activity.d.ts.map +0 -1
  172. package/types/payloads/app.d.ts +0 -266
  173. package/types/payloads/app.d.ts.map +0 -1
  174. package/types/payloads/appeal.d.ts +0 -22
  175. package/types/payloads/appeal.d.ts.map +0 -1
  176. package/types/payloads/ban.d.ts +0 -85
  177. package/types/payloads/ban.d.ts.map +0 -1
  178. package/types/payloads/base.d.ts +0 -5
  179. package/types/payloads/base.d.ts.map +0 -1
  180. package/types/payloads/client.d.ts +0 -108
  181. package/types/payloads/client.d.ts.map +0 -1
  182. package/types/payloads/comment.d.ts +0 -124
  183. package/types/payloads/comment.d.ts.map +0 -1
  184. package/types/payloads/content.d.ts +0 -678
  185. package/types/payloads/content.d.ts.map +0 -1
  186. package/types/payloads/index.d.ts +0 -11
  187. package/types/payloads/index.d.ts.map +0 -1
  188. package/types/payloads/strike.d.ts +0 -15
  189. package/types/payloads/strike.d.ts.map +0 -1
  190. package/types/payloads/user.d.ts +0 -523
  191. package/types/payloads/user.d.ts.map +0 -1
  192. package/types/rest/account.d.ts +0 -4
  193. package/types/rest/account.d.ts.map +0 -1
  194. package/types/rest/content.d.ts +0 -96
  195. package/types/rest/content.d.ts.map +0 -1
  196. package/types/rest/counters.d.ts +0 -10
  197. package/types/rest/counters.d.ts.map +0 -1
  198. package/types/rest/endpoints.d.ts +0 -153
  199. package/types/rest/endpoints.d.ts.map +0 -1
  200. package/types/rest/explore.d.ts +0 -113
  201. package/types/rest/explore.d.ts.map +0 -1
  202. package/types/rest/feeds.d.ts +0 -17
  203. package/types/rest/feeds.d.ts.map +0 -1
  204. package/types/rest/index.d.ts +0 -9
  205. package/types/rest/index.d.ts.map +0 -1
  206. package/types/rest/issues.d.ts +0 -16
  207. package/types/rest/issues.d.ts.map +0 -1
  208. package/types/rest/oauth2.d.ts +0 -37
  209. package/types/rest/oauth2.d.ts.map +0 -1
  210. package/types/utils/index.d.ts +0 -3
  211. package/types/utils/index.d.ts.map +0 -1
  212. package/types/utils/rest.d.ts +0 -50
  213. package/types/utils/rest.d.ts.map +0 -1
  214. package/types/utils/util.d.ts +0 -80
  215. package/types/utils/util.d.ts.map +0 -1
@@ -0,0 +1,190 @@
1
+ # Adapted from https://git.lix.systems/lix-project/flake-compat/src/branch/main/default.nix
2
+ {
3
+ src,
4
+ lockFilePath,
5
+ system ? builtins.currentSystem or "unknown-system",
6
+ }:
7
+
8
+ let
9
+ lockFile = builtins.fromJSON (builtins.readFile lockFilePath);
10
+
11
+ rootSrc = {
12
+ lastModified = 0;
13
+ lastModifiedDate = formatSecondsSinceEpoch 0;
14
+ # *hacker voice*: it's definitely a store path, I promise (actually a
15
+ # nixlang path value, likely not pointing at the store).
16
+ outPath = src;
17
+ };
18
+
19
+ # Format number of seconds in the Unix epoch as %Y%m%d%H%M%S.
20
+ formatSecondsSinceEpoch =
21
+ t:
22
+ let
23
+ rem = x: y: x - x / y * y;
24
+ days = t / 86400;
25
+ secondsInDay = rem t 86400;
26
+ hours = secondsInDay / 3600;
27
+ minutes = (rem secondsInDay 3600) / 60;
28
+ seconds = rem t 60;
29
+
30
+ # Courtesy of https://stackoverflow.com/a/32158604.
31
+ z = days + 719468;
32
+ era = (if z >= 0 then z else z - 146096) / 146097;
33
+ doe = z - era * 146097;
34
+ yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
35
+ y = yoe + era * 400;
36
+ doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
37
+ mp = (5 * doy + 2) / 153;
38
+ d = doy - (153 * mp + 2) / 5 + 1;
39
+ m = mp + (if mp < 10 then 3 else -9);
40
+ y' = y + (if m <= 2 then 1 else 0);
41
+
42
+ pad = s: if builtins.stringLength s < 2 then "0" + s else s;
43
+ in
44
+ "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}";
45
+
46
+ allNodes = builtins.mapAttrs (
47
+ key: node:
48
+ let
49
+ sourceInfo =
50
+ if key == lockFile.root then
51
+ rootSrc
52
+ # Path inputs pointing to project root (path = ".") should use rootSrc
53
+ # to avoid fetchTree hashing the entire project directory
54
+ else if node.locked.type or null == "path" && node.locked.path or null == "." then
55
+ rootSrc
56
+ else
57
+ let
58
+ locked = node.locked;
59
+ isRelativePath =
60
+ p: p != null && (builtins.substring 0 2 p == "./" || builtins.substring 0 3 p == "../");
61
+ # Resolve relative paths against src
62
+ resolvedLocked =
63
+ locked
64
+ // (
65
+ if locked.type or null == "path" && isRelativePath (locked.path or null) then
66
+ { path = toString src + "/${locked.path}"; }
67
+ else
68
+ { }
69
+ )
70
+ // (
71
+ if locked.type or null == "git" && isRelativePath (locked.url or null) then
72
+ { url = toString src + "/${locked.url}"; }
73
+ else
74
+ { }
75
+ );
76
+
77
+ # Local path inputs without a pinned narHash resolve to the live
78
+ # filesystem path instead of a fetchTree store copy. The lock file
79
+ # never carries a narHash for them (Nix strips volatile attributes
80
+ # from local inputs), so a store copy would hide edits from the
81
+ # eval cache: nothing in the cache key changes when the directory
82
+ # content changes. Evaluating from the live path makes the eval
83
+ # cache track every file that is read, so edits invalidate it.
84
+ isLivePath =
85
+ locked.type or null == "path"
86
+ && !(locked ? narHash)
87
+ && builtins.substring 0 1 (resolvedLocked.path or "") == "/";
88
+
89
+ fetchedSource = builtins.fetchTree (node.info or { } // removeAttrs resolvedLocked [ "dir" ]);
90
+ in
91
+ if isLivePath then
92
+ {
93
+ # Keep fetchTree's public metadata available to flakes that use
94
+ # self.narHash or self.lastModified. These inherited values stay
95
+ # lazy, so the live input is only hashed if metadata is read.
96
+ inherit (fetchedSource) lastModified lastModifiedDate narHash;
97
+ outPath = /. + resolvedLocked.path;
98
+ }
99
+ else
100
+ fetchedSource;
101
+
102
+ subdir = if key == lockFile.root then "" else node.locked.dir or "";
103
+
104
+ # Concatenate on sourceInfo.outPath directly (not the attrset, whose
105
+ # string coercion would turn live path values into context-free
106
+ # strings) so live path inputs keep a path-typed outPath. Path values
107
+ # copy to the store on string interpolation, which keeps derivation
108
+ # references to input files working.
109
+ outPath = sourceInfo.outPath + ((if subdir == "" then "" else "/") + subdir);
110
+
111
+ # Resolve a input spec into a node name. An input spec is
112
+ # either a node name, or a 'follows' path from the root
113
+ # node.
114
+ resolveInput =
115
+ inputSpec: if builtins.isList inputSpec then getInputByPath lockFile.root inputSpec else inputSpec;
116
+
117
+ # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the
118
+ # root node, returning the final node.
119
+ getInputByPath =
120
+ nodeName: path:
121
+ if path == [ ] then
122
+ nodeName
123
+ else
124
+ getInputByPath
125
+ # Since this could be a 'follows' input, call resolveInput.
126
+ (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path})
127
+ (builtins.tail path);
128
+
129
+ inputs = builtins.mapAttrs (inputName: inputSpec: allNodes.${resolveInput inputSpec}) (
130
+ node.inputs or { }
131
+ );
132
+
133
+ # Only import flake.nix for non-root nodes (root doesn't need it)
134
+ flake = if key == lockFile.root then null else import (outPath + "/flake.nix");
135
+
136
+ outputs = if key == lockFile.root then { } else flake.outputs (inputs // { self = result; });
137
+
138
+ # Lazy devenv evaluation for this input
139
+ devenvEval =
140
+ let
141
+ bootstrapLib = import ./bootstrapLib.nix { inputs = inputs; };
142
+ in
143
+ bootstrapLib.mkDevenvForInput {
144
+ input = { inherit outPath sourceInfo; };
145
+ allInputs = inputs;
146
+ inherit system;
147
+ };
148
+
149
+ result =
150
+ outputs
151
+ // sourceInfo
152
+ // {
153
+ inherit outPath;
154
+ inherit inputs;
155
+ inherit outputs;
156
+ inherit sourceInfo;
157
+ _type = "flake";
158
+ devenv = devenvEval;
159
+ };
160
+
161
+ nonFlakeResult = sourceInfo // {
162
+ inherit outPath;
163
+ inherit inputs;
164
+ inherit sourceInfo;
165
+ _type = "flake";
166
+ devenv = devenvEval;
167
+ };
168
+
169
+ in
170
+ if node.flake or true && key != lockFile.root then
171
+ assert builtins.isFunction flake.outputs;
172
+ result
173
+ else
174
+ nonFlakeResult
175
+ ) lockFile.nodes;
176
+
177
+ result =
178
+ if !(builtins.pathExists lockFilePath) then
179
+ throw "${lockFilePath} does not exist"
180
+ else if lockFile.version >= 5 && lockFile.version <= 7 then
181
+ allNodes.${lockFile.root}
182
+ else
183
+ throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}";
184
+
185
+ in
186
+ {
187
+ inputs = result.inputs or { } // {
188
+ self = result;
189
+ };
190
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "shown_hashes": [
3
+ "053d92e6228a113aaf85e8f544485eb3f64cc8b4ed6ec52abf21847cbc637b53",
4
+ "97c8d967408d5e8dbaefb984ff368930aa96af9c3655e6d867154992052f5881",
5
+ "c40a016aca4dd81dcdca91ff004d81492328aa4b5c49912d6b83a945c2feff84",
6
+ "e6825d4a5422d776d0eb3054f874bf73d8e32e9259f2d7be3a633cbce6bccdcd",
7
+ "5a589290b7df7d37070a19af3adb407d66ebcfeaa9cd6b628ea0c1998d7a6cde"
8
+ ]
9
+ }
@@ -0,0 +1,252 @@
1
+ # devenv fish init
2
+
3
+ # If this shell was spawned by the devenv hook (marked by `_DEVENV_HOOK_DIR`),
4
+ # `exit` when the user `cd`s outside the project so the parent shell can
5
+ # follow. Handled here (devenv's own init file, not the user's hook.fish) so
6
+ # it works regardless of whether the user's config.fish re-sources the hook
7
+ # for this non-login shell. Erase the marker as soon as it is read so it
8
+ # cannot leak into further descendants (a new tmux/zellij pane, a
9
+ # manually started nested shell, ...) which would otherwise wrongly conclude
10
+ # they too are hook-spawned.
11
+ if set -q _DEVENV_HOOK_DIR
12
+ set -e _DEVENV_HOOK_DIR
13
+ function _devenv_shell_exit_on_cd_out --on-variable PWD
14
+ switch $PWD
15
+ case "$DEVENV_ROOT" "$DEVENV_ROOT/*"
16
+ case '*'
17
+ printf '%s' $PWD > "$DEVENV_ROOT/.devenv/exit-dir"
18
+ exit
19
+ end
20
+ end
21
+ end
22
+
23
+ # Restore devenv PATH after user config may have modified it.
24
+ # _DEVENV_PATH is a colon-separated string from bash; split into fish list.
25
+ set -gx PATH (string split ":" -- $_DEVENV_PATH)
26
+
27
+ # Wrap fish_prompt for devenv reload hooks and prompt prefix.
28
+ if functions -q fish_prompt
29
+ functions -c fish_prompt __devenv_user_fish_prompt
30
+ function fish_prompt
31
+ __devenv_user_fish_prompt
32
+ __devenv_reload_apply
33
+ __devenv_restore_path
34
+ end
35
+ else
36
+ function fish_prompt
37
+ __devenv_reload_apply
38
+ __devenv_restore_path
39
+ echo -n "(devenv) > "
40
+ end
41
+ end
42
+
43
+ # Hot-reload hook
44
+
45
+ function __devenv_reload_apply
46
+ # Source new environment if a reload is pending
47
+ if test -f "/tmp/devenv-reload-528741.sh"
48
+ # Shell out to bash to handle the env diff (bash syntax).
49
+ # The bash subprocess inherits our current environment, reverses
50
+ # the previous diff, sources the new devenv env, computes a new
51
+ # diff, and outputs the resulting environment via export -p.
52
+ set -l reload_output (bash -c '
53
+
54
+ # Environment diff helpers (inspired by direnv)
55
+ # Diff is stored in _DEVENV_DIFF env var (not a file) so each shell has its own state
56
+ # Uses gzip+base64 encoding for compact storage
57
+
58
+ # Variables to ignore in diff (shell internals that change dynamically)
59
+ __devenv_ignored_var() {
60
+ case "$1" in
61
+ _*|PWD|OLDPWD|SHLVL|SHELL|SHELLOPTS|BASHOPTS|BASH_*|HISTCMD|HISTFILE)
62
+ return 0 ;;
63
+ PS1|PS2|PS3|PS4|PROMPT|PROMPT_COMMAND|PROMPT_DIRTRIM)
64
+ return 0 ;;
65
+ COMP_*|READLINE_*|MAILCHECK|COLUMNS|LINES|RANDOM|SECONDS|LINENO|EPOCHSECONDS|EPOCHREALTIME|SRANDOM)
66
+ return 0 ;;
67
+ STARSHIP_*|__fish*|DIRENV_*|nix_saved_*)
68
+ return 0 ;;
69
+ *)
70
+ return 1 ;;
71
+ esac
72
+ }
73
+
74
+ __devenv_capture_env() {
75
+ # Capture exported variables using declare -p for proper escaping
76
+ declare -p -x 2>/dev/null | LC_ALL=C sort
77
+ }
78
+
79
+ __devenv_serialize_diff() {
80
+ # Serialize diff (stdin) to base64-encoded gzip
81
+ gzip -c | base64 -w0
82
+ }
83
+
84
+ __devenv_deserialize_diff() {
85
+ # Deserialize diff from base64-encoded gzip to stdout
86
+ echo "$1" | base64 -d | gzip -d 2>/dev/null
87
+ }
88
+
89
+ __devenv_compute_diff() {
90
+ # Compare before ($1) and current env, return diff via _DEVENV_DIFF env var
91
+ local before_file="$1"
92
+
93
+ # Create temp files
94
+ local after_file diff_content
95
+ after_file=$(mktemp)
96
+ diff_content=$(mktemp)
97
+ __devenv_capture_env > "$after_file"
98
+
99
+ # Build associative arrays for before/after
100
+ local -A before_vars after_vars
101
+ while IFS= read -r line; do
102
+ [[ "$line" != declare\ -x\ * ]] && continue
103
+ local vardef="${line#declare -x }"
104
+ local var="${vardef%%=*}"
105
+ [[ -z "$var" ]] && continue
106
+ __devenv_ignored_var "$var" && continue
107
+ before_vars["$var"]="$line"
108
+ done < "$before_file"
109
+
110
+ while IFS= read -r line; do
111
+ [[ "$line" != declare\ -x\ * ]] && continue
112
+ local vardef="${line#declare -x }"
113
+ local var="${vardef%%=*}"
114
+ [[ -z "$var" ]] && continue
115
+ __devenv_ignored_var "$var" && continue
116
+ after_vars["$var"]="$line"
117
+ done < "$after_file"
118
+
119
+ # Find PREV entries (vars that were modified or removed)
120
+ for var in "${!before_vars[@]}"; do
121
+ if [[ "${after_vars[$var]}" != "${before_vars[$var]}" ]]; then
122
+ echo "P:${before_vars[$var]}" >> "$diff_content"
123
+ fi
124
+ done
125
+
126
+ # Find NEXT entries (vars that were added or modified)
127
+ for var in "${!after_vars[@]}"; do
128
+ if [[ -z "${before_vars[$var]+x}" ]]; then
129
+ echo "N:$var" >> "$diff_content"
130
+ elif [[ "${after_vars[$var]}" != "${before_vars[$var]}" ]]; then
131
+ echo "N:$var" >> "$diff_content"
132
+ fi
133
+ done
134
+
135
+ # Serialize and store in env var
136
+ _DEVENV_DIFF=$(__devenv_serialize_diff < "$diff_content")
137
+ export _DEVENV_DIFF
138
+
139
+ rm -f "$after_file" "$diff_content"
140
+ }
141
+
142
+ __devenv_apply_reverse_diff() {
143
+ # Reverse the diff: restore PREV values, unset NEXT-only vars
144
+ [[ -z "$_DEVENV_DIFF" ]] && return
145
+
146
+ local -A prev_vars
147
+ local diff_content
148
+ diff_content=$(__devenv_deserialize_diff "$_DEVENV_DIFF")
149
+
150
+ # First pass: collect and restore PREV declarations
151
+ while IFS= read -r line; do
152
+ if [[ "$line" == P:declare\ * ]]; then
153
+ local decl="${line#P:}"
154
+ local var="${decl#declare -x }"
155
+ var="${var%%=*}"
156
+ prev_vars["$var"]=1
157
+ # Use export instead of evaluating the declare statement directly,
158
+ # because declare -x inside a function creates a local variable
159
+ # in bash 5.0+.
160
+ eval "export ${decl#declare -x }" 2>/dev/null
161
+ fi
162
+ done <<< "$diff_content"
163
+
164
+ # Second pass: unset NEXT vars that were not in PREV (added vars)
165
+ while IFS= read -r line; do
166
+ if [[ "$line" == N:* ]]; then
167
+ local var="${line#N:}"
168
+ if [[ -z "${prev_vars[$var]+x}" ]]; then
169
+ unset "$var"
170
+ fi
171
+ fi
172
+ done <<< "$diff_content"
173
+ }
174
+
175
+
176
+ # Reverse previous diff
177
+ __devenv_apply_reverse_diff
178
+
179
+ # Capture env before sourcing new devenv
180
+ _before=$(mktemp)
181
+ __devenv_capture_env > "$_before"
182
+
183
+ # Send enterShell output to the terminal instead of the captured stdout.
184
+ # Probe by actually opening /dev/tty: it can exist with writable permission
185
+ # bits yet fail to open (ENXIO) when there is no controlling terminal.
186
+ if { : >/dev/tty; } 2>/dev/null; then
187
+ _devenv_reload_out=/dev/tty
188
+ else
189
+ _devenv_reload_out=/dev/null
190
+ fi
191
+
192
+ # Source new devenv environment
193
+ source "/tmp/devenv-reload-528741.sh" >"$_devenv_reload_out" 2>"$_devenv_reload_out"
194
+ rm -f "/tmp/devenv-reload-528741.sh"
195
+ unset _devenv_reload_out
196
+
197
+ # Compute new diff
198
+ __devenv_compute_diff "$_before"
199
+ rm -f "$_before"
200
+
201
+ # Output current environment for the calling shell to parse
202
+ export -p
203
+ ' 2>/dev/null)
204
+
205
+ # Parse bash export -p output (declare -x VAR="value") and apply
206
+ # each variable to the fish environment via set -gx.
207
+ for line in $reload_output
208
+ # Match lines of the form: declare -x VAR="value"
209
+ set -l parts (string match -r '^declare -x ([^=]+)="(.*)"$' -- $line)
210
+ if test (count $parts) -gt 0
211
+ set -l var $parts[2]
212
+ set -l val $parts[3]
213
+ # Skip fish read-only electric variables that bash exports.
214
+ # PWD and SHLVL are managed by fish; assigning to them errors.
215
+ if test "$var" = PWD -o "$var" = SHLVL
216
+ continue
217
+ end
218
+ # PATH, MANPATH, CDPATH are list variables in fish;
219
+ # split colon-separated values into proper lists.
220
+ if test "$var" = PATH -o "$var" = MANPATH -o "$var" = CDPATH
221
+ set -gx $var (string split ":" -- $val)
222
+ else
223
+ set -gx $var $val
224
+ end
225
+ else
226
+ # Variable exported without a value: declare -x VAR
227
+ set -l noval (string match -r '^declare -x ([^=]+)$' -- $line)
228
+ if test (count $noval) -gt 0
229
+ set -gx $noval[2] ""
230
+ end
231
+ end
232
+ end
233
+
234
+ # Update saved PATH
235
+ set -gx _DEVENV_PATH (string join ":" -- $PATH)
236
+ end
237
+ end
238
+
239
+ function __devenv_restore_path
240
+ # Restore devenv PATH (in case direnv or other tools modified it).
241
+ # _DEVENV_PATH is a colon-separated string; split into a list for fish.
242
+ set -gx PATH (string split ":" -- $_DEVENV_PATH)
243
+ end
244
+
245
+ # Keybinding for manual reload (Ctrl+Alt+R by default)
246
+ function __devenv_reload_keybind_handler
247
+ __devenv_reload_apply
248
+ commandline -f repaint
249
+ end
250
+ bind (string unescape '\x1b\x12') __devenv_reload_keybind_handler
251
+
252
+
File without changes
@@ -0,0 +1,10 @@
1
+ /home/shift/.config/nixpkgs/overlays
2
+ /home/shift/.config/nixpkgs/overlays.nix
3
+ /media/Code/@Open-iFunny/ifunny-api-types/.devenv/bootstrap/bootstrapLib.nix
4
+ /media/Code/@Open-iFunny/ifunny-api-types/.devenv/bootstrap/default.nix
5
+ /media/Code/@Open-iFunny/ifunny-api-types/.devenv/bootstrap/resolve-lock.nix
6
+ /media/Code/@Open-iFunny/ifunny-api-types/.env
7
+ /media/Code/@Open-iFunny/ifunny-api-types/devenv.local.nix
8
+ /media/Code/@Open-iFunny/ifunny-api-types/devenv.lock
9
+ /media/Code/@Open-iFunny/ifunny-api-types/devenv.nix
10
+ /media/Code/@Open-iFunny/ifunny-api-types/devenv.yaml
@@ -0,0 +1 @@
1
+
Binary file
Binary file
Binary file
File without changes
@@ -0,0 +1,17 @@
1
+ let
2
+ cfg = {};
3
+ getName = pkg: (builtins.parseDrvName (pkg.name or pkg.pname or "")).name;
4
+ in cfg // {
5
+ allowUnfreePredicate =
6
+ if cfg.allowUnfree or false then
7
+ (_: true)
8
+ else if (cfg.permittedUnfreePackages or []) != [] then
9
+ (pkg: builtins.elem (getName pkg) (cfg.permittedUnfreePackages or []))
10
+ else
11
+ (_: false);
12
+ allowInsecurePredicate =
13
+ if (cfg.permittedInsecurePackages or []) != [] then
14
+ (pkg: builtins.elem (getName pkg) (cfg.permittedInsecurePackages or []))
15
+ else
16
+ (_: false);
17
+ }
@@ -0,0 +1,29 @@
1
+ let
2
+ cfg = {};
3
+ getName = pkg: (builtins.parseDrvName (pkg.name or pkg.pname or "")).name;
4
+ unfreePackageError = pkg:
5
+ let
6
+ name = getName pkg;
7
+ in
8
+ throw ''
9
+ devenv: package '${name}' has an unfree license.
10
+
11
+ To allow all unfree packages, add this to devenv.yaml:
12
+
13
+ allow_unfree: true
14
+
15
+ To allow only this package, add this to devenv.yaml:
16
+
17
+ nixpkgs:
18
+ permitted_unfree_packages:
19
+ - ${name}
20
+ '';
21
+ in cfg // {
22
+ allowUnfreePredicate =
23
+ if cfg.allowUnfree or false then
24
+ (_: true)
25
+ else if (cfg.permittedUnfreePackages or []) != [] then
26
+ (pkg: builtins.elem (getName pkg) (cfg.permittedUnfreePackages or []) || unfreePackageError pkg)
27
+ else
28
+ unfreePackageError;
29
+ }