@lowgular/code-graph 0.0.1 → 0.1.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 (155) hide show
  1. package/bin/cli.js +2463 -0
  2. package/lib.js +2430 -0
  3. package/package.json +26 -7
  4. package/apps/code-graph/src/main.js +0 -50
  5. package/libs/cli/code-graph/src/index.js +0 -39
  6. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
  7. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
  8. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
  9. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
  10. package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
  11. package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
  12. package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
  13. package/libs/cli/code-graph/src/lib/core/core.js +0 -58
  14. package/libs/cli/code-graph/src/lib/core.js +0 -85
  15. package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
  16. package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
  17. package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
  18. package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
  19. package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
  20. package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
  21. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
  22. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
  23. package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
  24. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
  25. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
  26. package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
  27. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
  28. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
  29. package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
  30. package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
  31. package/libs/cli/code-graph/src/lib/types/index.js +0 -99
  32. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
  33. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
  34. package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
  35. package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
  36. package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
  37. package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
  38. package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +0 -79
  39. package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
  40. package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
  41. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
  42. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
  43. package/libs/cli/cypher/src/index.js +0 -25
  44. package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
  45. package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
  46. package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
  47. package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
  48. package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
  49. package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
  50. package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
  51. package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
  52. package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
  53. package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
  54. package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
  55. package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
  56. package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
  57. package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
  58. package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
  59. package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
  60. package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
  61. package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
  62. package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
  63. package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
  64. package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +0 -158
  65. package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
  66. package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
  67. package/libs/cli/cypher/src/lib/executor/match-engine.js +0 -153
  68. package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +0 -109
  69. package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +0 -64
  70. package/libs/cli/cypher/src/lib/executor/result-formatter.js +0 -143
  71. package/libs/cli/cypher/src/lib/executor/traverse-engine.js +0 -164
  72. package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
  73. package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
  74. package/libs/cli/cypher/src/lib/index.js +0 -74
  75. package/libs/cli/cypher/src/lib/lexer.js +0 -398
  76. package/libs/cli/cypher/src/lib/parser.js +0 -602
  77. package/libs/cli/cypher/src/lib/validator/query-validator.js +0 -95
  78. package/libs/cli/cypher/src/lib/validator/supported-features.config.js +0 -111
  79. package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +0 -150
  80. package/libs/cli/shared/src/index.js +0 -53
  81. package/libs/cli/shared/src/lib/admin-token.js +0 -121
  82. package/libs/cli/shared/src/lib/config.js +0 -49
  83. package/libs/cli/shared/src/lib/consts.js +0 -57
  84. package/libs/cli/shared/src/lib/core.js +0 -46
  85. package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
  86. package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
  87. package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
  88. package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
  89. package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
  90. package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
  91. package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
  92. package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
  93. package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
  94. package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
  95. package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
  96. package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
  97. package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
  98. package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
  99. package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
  100. package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
  101. package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
  102. package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
  103. package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
  104. package/libs/cli/shared/src/lib/token.js +0 -135
  105. package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
  106. package/libs/cli/shared/src/lib/utils/utils.js +0 -89
  107. package/libs/cli/typescript/src/index.js +0 -21
  108. package/libs/cli/typescript/src/lib/base/index.js +0 -23
  109. package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
  110. package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
  111. package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
  112. package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
  113. package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
  114. package/libs/cli/typescript/src/lib/core/index.js +0 -35
  115. package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
  116. package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
  117. package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
  118. package/libs/cli/typescript/src/lib/core/type.js +0 -374
  119. package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
  120. package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
  121. package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
  122. package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
  123. package/libs/cli/typescript/src/lib/index.js +0 -57
  124. package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
  125. package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
  126. package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
  127. package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
  128. package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
  129. package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
  130. package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
  131. package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
  132. package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
  133. package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
  134. package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
  135. package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
  136. package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
  137. package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
  138. package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
  139. package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
  140. package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
  141. package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
  142. package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
  143. package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
  144. package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
  145. package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
  146. package/libs/cli/typescript/src/lib/utils.js +0 -39
  147. package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
  148. package/libs/core/codegular/src/index.js +0 -21
  149. package/libs/core/codegular/src/lib/index.js +0 -29
  150. package/libs/core/codegular/src/lib/node.js +0 -112
  151. package/libs/core/codegular/src/lib/program.js +0 -92
  152. package/libs/core/codegular/src/lib/string.js +0 -168
  153. package/libs/core/codegular/src/lib/type-checker.js +0 -170
  154. package/libs/core/codegular/src/lib/utils.js +0 -347
  155. package/main.js +0 -43
@@ -1,237 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var yaml_exports = {};
19
- __export(yaml_exports, {
20
- parseTopLevelYamlStringsAndArrays: () => parseTopLevelYamlStringsAndArrays
21
- });
22
- module.exports = __toCommonJS(yaml_exports);
23
- function parseTopLevelYamlStringsAndArrays(yaml) {
24
- const lines = yaml.replace(/\r\n/g, "\n").split("\n");
25
- const result = {};
26
- let i = 0;
27
- while (i < lines.length) {
28
- const line = lines[i];
29
- if (!line.trim() || line.trimStart().startsWith("#")) {
30
- i++;
31
- continue;
32
- }
33
- const keyMatch = /^([A-Za-z0-9_-]+):\s*(.*)$/.exec(line);
34
- if (!keyMatch) {
35
- i++;
36
- continue;
37
- }
38
- const key = keyMatch[1];
39
- const afterColon = keyMatch[2] ?? "";
40
- const parentIndent = leadingSpaces(line);
41
- const blockMatch = /^([|>])([+-]?)(\d+)?\s*$/.exec(afterColon);
42
- if (blockMatch) {
43
- const style = blockMatch[1];
44
- const chomp = blockMatch[2] || "";
45
- const { blockLines, nextIndex } = collectIndentedBlock(
46
- lines,
47
- i + 1,
48
- parentIndent
49
- );
50
- i = nextIndex;
51
- const deindented = deindentBlock(blockLines);
52
- let content = deindented.join("\n");
53
- if (style === ">")
54
- content = foldYaml(content);
55
- if (chomp === "-")
56
- content = content.replace(/\n$/, "");
57
- else if (chomp === "" && !content.endsWith("\n"))
58
- content += "\n";
59
- result[key] = content.replace(/\n$/, "");
60
- continue;
61
- }
62
- if (afterColon.trim() === "") {
63
- const { arrayItems, nextIndex } = tryCollectArray(
64
- lines,
65
- i + 1,
66
- parentIndent
67
- );
68
- if (arrayItems) {
69
- result[key] = arrayItems;
70
- i = nextIndex;
71
- continue;
72
- }
73
- }
74
- const flowArray = /^\[(.*)\]\s*$/.exec(afterColon.trim());
75
- if (flowArray) {
76
- const items = flowArray[1].split(",").map((s) => s.trim()).filter(Boolean);
77
- result[key] = items;
78
- i++;
79
- continue;
80
- }
81
- result[key] = afterColon.trim();
82
- i++;
83
- while (i < lines.length) {
84
- const next = lines[i];
85
- if (!next.trim()) {
86
- result[key] += "\n";
87
- i++;
88
- continue;
89
- }
90
- const nextIndent = leadingSpaces(next);
91
- if (nextIndent === 0 && /^[A-Za-z0-9_-]+:\s*/.test(next))
92
- break;
93
- if (nextIndent > parentIndent) {
94
- result[key] += (result[key].endsWith("\n") || result[key] === "" ? "" : " ") + next.trim();
95
- i++;
96
- continue;
97
- }
98
- break;
99
- }
100
- }
101
- return result;
102
- }
103
- function tryCollectArray(lines, startIndex, parentIndent) {
104
- const items = [];
105
- let i = startIndex;
106
- const firstNonEmpty = findFirstNonEmpty(lines, i);
107
- if (firstNonEmpty === -1)
108
- return { arrayItems: null, nextIndex: startIndex };
109
- const firstLine = lines[firstNonEmpty];
110
- const firstIndent = leadingSpaces(firstLine);
111
- if (firstIndent <= parentIndent || !/^\s*-\s+/.test(firstLine)) {
112
- return { arrayItems: null, nextIndex: startIndex };
113
- }
114
- const arrayIndent = firstIndent;
115
- i = firstNonEmpty;
116
- while (i < lines.length) {
117
- const l = lines[i];
118
- if (!l.trim()) {
119
- if (items.length > 0 && !items[items.length - 1].endsWith("\n")) {
120
- items[items.length - 1] += "\n";
121
- }
122
- i++;
123
- continue;
124
- }
125
- const indent = leadingSpaces(l);
126
- if (indent < arrayIndent)
127
- break;
128
- if (indent > arrayIndent) {
129
- if (items.length === 0) {
130
- i++;
131
- continue;
132
- }
133
- items[items.length - 1] += (items[items.length - 1].endsWith("\n") ? "" : " ") + l.trim();
134
- i++;
135
- continue;
136
- }
137
- const dashMatch = /^\s*-\s+(.*)$/.exec(l);
138
- if (!dashMatch) {
139
- if (indent <= parentIndent)
140
- break;
141
- i++;
142
- continue;
143
- }
144
- const value = dashMatch[1] ?? "";
145
- items.push(value.trim());
146
- i++;
147
- while (i < lines.length) {
148
- const cont = lines[i];
149
- if (!cont.trim()) {
150
- items[items.length - 1] += "\n";
151
- i++;
152
- continue;
153
- }
154
- const contIndent = leadingSpaces(cont);
155
- if (contIndent > arrayIndent && !/^\s*-\s+/.test(cont)) {
156
- items[items.length - 1] += (items[items.length - 1].endsWith("\n") ? "" : " ") + cont.trim();
157
- i++;
158
- continue;
159
- }
160
- break;
161
- }
162
- }
163
- for (let j = 0; j < items.length; j++) {
164
- items[j] = items[j].replace(/\n+$/, "");
165
- }
166
- return { arrayItems: items, nextIndex: i };
167
- }
168
- function collectIndentedBlock(lines, startIndex, parentIndent) {
169
- const blockLines = [];
170
- let i = startIndex;
171
- while (i < lines.length) {
172
- const l = lines[i];
173
- if (!l.trim()) {
174
- blockLines.push(l);
175
- i++;
176
- continue;
177
- }
178
- const indent = leadingSpaces(l);
179
- if (indent <= parentIndent)
180
- break;
181
- blockLines.push(l);
182
- i++;
183
- }
184
- return { blockLines, nextIndex: i };
185
- }
186
- function deindentBlock(blockLines) {
187
- let minIndent = null;
188
- for (const l of blockLines) {
189
- if (!l.trim())
190
- continue;
191
- const indent = leadingSpaces(l);
192
- if (minIndent === null || indent < minIndent)
193
- minIndent = indent;
194
- }
195
- const effectiveIndent = minIndent ?? 0;
196
- return blockLines.map(
197
- (l) => l.length >= effectiveIndent ? l.slice(effectiveIndent) : ""
198
- );
199
- }
200
- function leadingSpaces(s) {
201
- let n = 0;
202
- while (n < s.length && s.charCodeAt(n) === 32)
203
- n++;
204
- return n;
205
- }
206
- function foldYaml(s) {
207
- const lines = s.split("\n");
208
- const out = [];
209
- let paragraph = [];
210
- const flush = () => {
211
- if (paragraph.length) {
212
- out.push(paragraph.join(" ").replace(/ +/g, " "));
213
- paragraph = [];
214
- }
215
- };
216
- for (const line of lines) {
217
- if (line.trim() === "") {
218
- flush();
219
- out.push("");
220
- } else {
221
- paragraph.push(line);
222
- }
223
- }
224
- flush();
225
- return out.join("\n");
226
- }
227
- function findFirstNonEmpty(lines, start) {
228
- for (let i = start; i < lines.length; i++) {
229
- if (lines[i].trim())
230
- return i;
231
- }
232
- return -1;
233
- }
234
- // Annotate the CommonJS export names for ESM import in node:
235
- 0 && (module.exports = {
236
- parseTopLevelYamlStringsAndArrays
237
- });
@@ -1,120 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var lowgular_config_exports = {};
29
- __export(lowgular_config_exports, {
30
- createOrGetLowgularDir: () => createOrGetLowgularDir,
31
- getLowgularConfigOrThrow: () => getLowgularConfigOrThrow,
32
- getLowgularConfigWithIdOrThrow: () => getLowgularConfigWithIdOrThrow,
33
- readLowgularConfig: () => readLowgularConfig,
34
- readLowgularConfigFromMarkdown: () => readLowgularConfigFromMarkdown,
35
- validateLowgularConfig: () => validateLowgularConfig
36
- });
37
- module.exports = __toCommonJS(lowgular_config_exports);
38
- var fs = __toESM(require("fs"));
39
- var os = __toESM(require("os"));
40
- var import_consts = require("./consts");
41
- var import_markdown = require("./infrastructure/markdown");
42
- const getLowgularConfigOrThrow = (ctx, files) => {
43
- const lgConfig = readLowgularConfig(files);
44
- const type = ctx.type ?? lgConfig.type;
45
- const id = ctx.id ?? lgConfig.id;
46
- if (!type) {
47
- throw new Error(
48
- `You need to provide type property in '${import_consts.LG_CONFIG_FILE}' file or by providing type as cli parameter. To make it easier you can clone first.`
49
- );
50
- }
51
- return {
52
- ...lgConfig,
53
- id,
54
- type
55
- };
56
- };
57
- const getLowgularConfigWithIdOrThrow = (ctx, files) => {
58
- const lgConfig = readLowgularConfig(files);
59
- const type = ctx.type ?? lgConfig.type;
60
- const id = ctx.id ?? lgConfig.id;
61
- if (!id) {
62
- throw new Error(
63
- `You need to provide id property in '${import_consts.LG_CONFIG_FILE}' file or by providing id as cli parameter.`
64
- );
65
- }
66
- if (!type) {
67
- throw new Error(
68
- `You need to provide type property in '${import_consts.LG_CONFIG_FILE}' file or by providing type as cli parameter.`
69
- );
70
- }
71
- return {
72
- ...lgConfig,
73
- id,
74
- type
75
- };
76
- };
77
- function readLowgularConfig(files) {
78
- const lgConfigFile = files[import_consts.LG_CONFIG_FILE];
79
- if (!lgConfigFile) {
80
- return {};
81
- }
82
- const lgConfig = JSON.parse(lgConfigFile);
83
- if (!lgConfig) {
84
- return {};
85
- }
86
- return lgConfig;
87
- }
88
- function createOrGetLowgularDir() {
89
- const homeDir = os.homedir();
90
- const lowgularDir = `${homeDir}/${import_consts.LG_TEMP_DIR}`;
91
- if (!fs.existsSync(lowgularDir)) {
92
- fs.mkdirSync(lowgularDir, { recursive: true });
93
- }
94
- return lowgularDir;
95
- }
96
- const readLowgularConfigFromMarkdown = () => {
97
- const readme = fs.readFileSync("./README.md", "utf8");
98
- return (0, import_markdown.extractMarkdownMetadata)(readme);
99
- };
100
- function validateLowgularConfig(lgConf) {
101
- if (!lgConf) {
102
- throw new Error("No lowgular config found");
103
- }
104
- if (!lgConf.id) {
105
- throw new Error('You need to provide "id"');
106
- }
107
- if (!lgConf.type) {
108
- throw new Error('You need to provide "type"');
109
- }
110
- return lgConf;
111
- }
112
- // Annotate the CommonJS export names for ESM import in node:
113
- 0 && (module.exports = {
114
- createOrGetLowgularDir,
115
- getLowgularConfigOrThrow,
116
- getLowgularConfigWithIdOrThrow,
117
- readLowgularConfig,
118
- readLowgularConfigFromMarkdown,
119
- validateLowgularConfig
120
- });
@@ -1,135 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var token_exports = {};
19
- __export(token_exports, {
20
- AuthError: () => AuthError,
21
- deleteRefreshToken: () => deleteRefreshToken,
22
- deleteToken: () => deleteToken,
23
- getUserDataFromToken: () => getUserDataFromToken,
24
- me: () => me,
25
- readRefreshToken: () => readRefreshToken,
26
- readToken: () => readToken,
27
- refresh: () => refresh,
28
- saveRefreshToken: () => saveRefreshToken,
29
- saveToken: () => saveToken,
30
- tokenGuard: () => tokenGuard
31
- });
32
- module.exports = __toCommonJS(token_exports);
33
- var import_prompts = require("@clack/prompts");
34
- var import_fs = require("fs");
35
- var import_consts = require("./consts.js");
36
- var import_http = require("./infrastructure/http.js");
37
- var import_lowgular_config = require("./lowgular.config.js");
38
- const getUserDataFromToken = () => {
39
- const token = readToken();
40
- const base64Payload = token.split(".")[1];
41
- const payload = JSON.parse(atob(base64Payload));
42
- return payload;
43
- };
44
- class AuthError extends Error {
45
- constructor(message) {
46
- super(message);
47
- this.name = "AuthError";
48
- }
49
- }
50
- const tokenGuard = () => {
51
- const token = readToken();
52
- const refreshToken = readRefreshToken();
53
- if (!token || !refreshToken) {
54
- throw new AuthError("Access token or refresh token not found");
55
- }
56
- return {
57
- token,
58
- refreshToken
59
- };
60
- };
61
- const refresh = async () => {
62
- const s = (0, import_prompts.spinner)();
63
- s.start("Refreshing token...");
64
- const refreshToken = readRefreshToken();
65
- return new import_http.AuthClient().post(`/auth/refresh`, {
66
- data: { refreshToken }
67
- }).then(({ data }) => {
68
- s.stop("Token refreshed");
69
- saveToken(data.accessToken);
70
- saveRefreshToken(data.refreshToken);
71
- }).catch(() => {
72
- s.stop();
73
- throw new AuthError("Refresh token cannot be refreshed");
74
- });
75
- };
76
- const me = async () => {
77
- const payload = getUserDataFromToken();
78
- import_prompts.log.success(
79
- `You are logged in as ${payload.email} and your user id is ${payload.user_id || payload.uid}`
80
- );
81
- };
82
- const saveToken = (accessToken) => {
83
- const lowgularDir = (0, import_lowgular_config.createOrGetLowgularDir)();
84
- (0, import_fs.writeFileSync)(`${lowgularDir}/${import_consts.LG_TOKEN_FILE}`, accessToken, {
85
- flag: "w",
86
- encoding: "utf-8"
87
- });
88
- };
89
- const readToken = () => {
90
- const lowgularDir = (0, import_lowgular_config.createOrGetLowgularDir)();
91
- if (!(0, import_fs.existsSync)(`${lowgularDir}/${import_consts.LG_TOKEN_FILE}`)) {
92
- return "";
93
- }
94
- return (0, import_fs.readFileSync)(`${lowgularDir}/${import_consts.LG_TOKEN_FILE}`, "utf-8");
95
- };
96
- const deleteToken = () => {
97
- const lowgularDir = (0, import_lowgular_config.createOrGetLowgularDir)();
98
- if ((0, import_fs.existsSync)(`${lowgularDir}/${import_consts.LG_TOKEN_FILE}`)) {
99
- (0, import_fs.unlinkSync)(`${lowgularDir}/${import_consts.LG_TOKEN_FILE}`);
100
- }
101
- };
102
- const saveRefreshToken = (refreshToken) => {
103
- const lowgularDir = (0, import_lowgular_config.createOrGetLowgularDir)();
104
- (0, import_fs.writeFileSync)(`${lowgularDir}/${import_consts.LG_REFRESH_TOKEN_FILE}`, refreshToken, {
105
- flag: "w",
106
- encoding: "utf-8"
107
- });
108
- };
109
- const readRefreshToken = () => {
110
- const lowgularDir = (0, import_lowgular_config.createOrGetLowgularDir)();
111
- if (!(0, import_fs.existsSync)(`${lowgularDir}/${import_consts.LG_REFRESH_TOKEN_FILE}`)) {
112
- return "";
113
- }
114
- return (0, import_fs.readFileSync)(`${lowgularDir}/${import_consts.LG_REFRESH_TOKEN_FILE}`, "utf-8");
115
- };
116
- const deleteRefreshToken = () => {
117
- const lowgularDir = (0, import_lowgular_config.createOrGetLowgularDir)();
118
- if ((0, import_fs.existsSync)(`${lowgularDir}/${import_consts.LG_REFRESH_TOKEN_FILE}`)) {
119
- (0, import_fs.unlinkSync)(`${lowgularDir}/${import_consts.LG_REFRESH_TOKEN_FILE}`);
120
- }
121
- };
122
- // Annotate the CommonJS export names for ESM import in node:
123
- 0 && (module.exports = {
124
- AuthError,
125
- deleteRefreshToken,
126
- deleteToken,
127
- getUserDataFromToken,
128
- me,
129
- readRefreshToken,
130
- readToken,
131
- refresh,
132
- saveRefreshToken,
133
- saveToken,
134
- tokenGuard
135
- });
@@ -1,35 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var solution_util_exports = {};
19
- __export(solution_util_exports, {
20
- filterSolutionFiles: () => filterSolutionFiles,
21
- mergeSolutionFiles: () => mergeSolutionFiles
22
- });
23
- module.exports = __toCommonJS(solution_util_exports);
24
- function mergeSolutionFiles(initState, solution = {}) {
25
- const solutionFilesWithoutSpecs = filterSolutionFiles(solution);
26
- return { ...initState, ...solutionFilesWithoutSpecs };
27
- }
28
- function filterSolutionFiles(solution = {}) {
29
- return Object.keys(solution).filter((key) => !key.includes(".spec.")).reduce((acc, key) => ({ ...acc, [key]: solution[key] }), {});
30
- }
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- filterSolutionFiles,
34
- mergeSolutionFiles
35
- });
@@ -1,89 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var utils_exports = {};
19
- __export(utils_exports, {
20
- escapeRegExp: () => escapeRegExp,
21
- generateId: () => generateId,
22
- getIdFromSortablePath: () => getIdFromSortablePath,
23
- getNameFromSortablePath: () => getNameFromSortablePath,
24
- kebabize: () => kebabize,
25
- makeIdFromSortablePath: () => makeIdFromSortablePath,
26
- removeOrderPrefix: () => removeOrderPrefix,
27
- splitCamelCase: () => splitCamelCase,
28
- stringifyJSON: () => stringifyJSON,
29
- titelizeEach: () => titelizeEach,
30
- titleize: () => titleize,
31
- verboseLog: () => verboseLog
32
- });
33
- module.exports = __toCommonJS(utils_exports);
34
- var import_config = require("../infrastructure/config.js");
35
- function kebabize(str) {
36
- return str.toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-");
37
- }
38
- const splitCamelCase = (s) => s.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_\-\.]/g, " ").toLowerCase().split(/\s+/).filter(Boolean);
39
- const titleize = (value) => {
40
- return value.charAt(0).toUpperCase() + value.replace(/_|-/g, " ").toLowerCase().slice(1);
41
- };
42
- const titelizeEach = (value) => {
43
- return value.replace(/_|-/g, " ").split(" ").map((w) => w.charAt(0).toUpperCase() + w.toLowerCase().slice(1)).join(" ");
44
- };
45
- const removeOrderPrefix = (value) => {
46
- return value.replace(/^\d+_/, "");
47
- };
48
- const getNameFromSortablePath = (path) => {
49
- return titelizeEach(path.replace(/^\d+_/, "").replace(/\.[a-z0-9]+$/, ""));
50
- };
51
- const makeIdFromSortablePath = (path) => {
52
- return path.split("/").map(kebabize).join("--");
53
- };
54
- const getIdFromSortablePath = (path) => kebabize(path.replace(/^\d+_/, "").replace(/\.[a-z0-9]+$/, ""));
55
- const escapeRegExp = (str) => {
56
- return str.replace(/[.*?+^${}()|[\]\\\\/]/g, "\\$&");
57
- };
58
- const stringifyJSON = (obj) => {
59
- return JSON.stringify(obj, null, 2);
60
- };
61
- const generateId = () => {
62
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
63
- const length = 20;
64
- let result = "";
65
- for (let i = 0; i < length; i++) {
66
- result += chars.charAt(Math.floor(Math.random() * chars.length));
67
- }
68
- return result;
69
- };
70
- function verboseLog(...params) {
71
- if (import_config.config.hasParam("verbose")) {
72
- console.log("[lowgular:verbose]", ...params);
73
- }
74
- }
75
- // Annotate the CommonJS export names for ESM import in node:
76
- 0 && (module.exports = {
77
- escapeRegExp,
78
- generateId,
79
- getIdFromSortablePath,
80
- getNameFromSortablePath,
81
- kebabize,
82
- makeIdFromSortablePath,
83
- removeOrderPrefix,
84
- splitCamelCase,
85
- stringifyJSON,
86
- titelizeEach,
87
- titleize,
88
- verboseLog
89
- });
@@ -1,21 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var src_exports = {};
16
- module.exports = __toCommonJS(src_exports);
17
- __reExport(src_exports, require("./lib/index"), module.exports);
18
- // Annotate the CommonJS export names for ESM import in node:
19
- 0 && (module.exports = {
20
- ...require("./lib/index")
21
- });
@@ -1,23 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var base_exports = {};
16
- module.exports = __toCommonJS(base_exports);
17
- __reExport(base_exports, require("./nameable"), module.exports);
18
- __reExport(base_exports, require("./nodeable"), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require("./nameable"),
22
- ...require("./nodeable")
23
- });
@@ -1,34 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var nameable_exports = {};
19
- __export(nameable_exports, {
20
- NameableImpl: () => NameableImpl
21
- });
22
- module.exports = __toCommonJS(nameable_exports);
23
- var import_codegular = require("@core/codegular");
24
- var import_nodeable = require("./nodeable");
25
- class NameableImpl extends import_nodeable.NodableImpl {
26
- constructor(node) {
27
- super(node);
28
- this.name = (0, import_codegular.getNameByIdentifier)(node);
29
- }
30
- }
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- NameableImpl
34
- });