@keshavsoft/api-tree 1.0.0 → 6.1.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 +77 -52
- package/docs/api.html +123 -0
- package/docs/examples.html +100 -0
- package/docs/how-it-works.html +69 -0
- package/docs/index.html +95 -26
- package/docs/style.css +272 -0
- package/docs/validation.html +88 -0
- package/package.json +7 -3
- package/src/index.d.ts +65 -19
- package/src/index.js +2 -2
- package/src/v2/blueprint/api.json +4 -0
- package/src/v2/blueprint/source.json +22 -0
- package/src/v2/index.js +33 -0
- package/src/v2/internal-working/route/attachPath.js +38 -0
- package/src/v2/internal-working/route/createLeafHandler.js +25 -0
- package/src/v2/internal-working/route/index.js +35 -0
- package/src/v2/internal-working/route/resolveLeafSpec.js +22 -0
- package/src/v2/internal-working/validate/index.js +42 -0
- package/src/v2/internal-working/validate/isPlainObject.js +12 -0
- package/src/v3/index.js +34 -0
- package/src/v3/internal-working/buildTree.js +35 -0
- package/src/v4/blueprint/api.json +13 -0
- package/src/v4/blueprint/source.json +228 -0
- package/src/v4/index.js +29 -0
- package/src/v4/internal-working/buildTree.js +35 -0
- package/src/v4/internal-working/guards/index.js +15 -0
- package/src/v4/internal-working/guards/isFunction.js +9 -0
- package/src/v4/internal-working/guards/isObject.js +9 -0
- package/src/v4/internal-working/guards/isStringArray.js +15 -0
- package/src/v5/blueprint/api.json +13 -0
- package/src/v5/blueprint/source.json +228 -0
- package/src/v5/engine/guards/index.js +15 -0
- package/src/v5/engine/guards/isFunction.js +9 -0
- package/src/v5/engine/guards/isObject.js +9 -0
- package/src/v5/engine/guards/isStringArray.js +15 -0
- package/src/v5/engine/run.js +35 -0
- package/src/v5/index.js +29 -0
- package/src/v6/blueprint/api.json +13 -0
- package/src/v6/blueprint/source.json +228 -0
- package/src/v6/engine/guards/index.js +15 -0
- package/src/v6/engine/guards/isFunction.js +9 -0
- package/src/v6/engine/guards/isObject.js +9 -0
- package/src/v6/engine/guards/isStringArray.js +15 -0
- package/src/v6/engine/run.js +35 -0
- package/src/v6/index.js +29 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": {
|
|
3
|
+
"ecosystem": {
|
|
4
|
+
"architecture": {
|
|
5
|
+
"philosophy": {
|
|
6
|
+
"fetch": {
|
|
7
|
+
"action": "fetch",
|
|
8
|
+
"resource": "philosophy",
|
|
9
|
+
"description": "Explains why endpoints as structured data eliminates conventional folder sprawl.",
|
|
10
|
+
"data": {
|
|
11
|
+
"concept": "Endpoints as Data",
|
|
12
|
+
"problem": "In conventional client libraries, adding 50 endpoints requires creating 50 directories and 50 repetitive boilerplate files, causing maintenance drag and import fragility.",
|
|
13
|
+
"solution": "Define endpoints declaratively in JSON contracts (source.json + api.json) and assemble the callable object tree in memory at startup.",
|
|
14
|
+
"benefits": [
|
|
15
|
+
"Zero directory sprawl across packages",
|
|
16
|
+
"Single point of query customization in engine/execution",
|
|
17
|
+
"Instant in-memory object tree generation without code duplication",
|
|
18
|
+
"Deterministic compile-time TypeScript typing directly from JSON"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"layers": {
|
|
24
|
+
"fetch": {
|
|
25
|
+
"action": "fetch",
|
|
26
|
+
"resource": "layers",
|
|
27
|
+
"description": "Details the three clean architectural layers of a JSON-driven NPM package.",
|
|
28
|
+
"data": {
|
|
29
|
+
"layers": [
|
|
30
|
+
{
|
|
31
|
+
"name": "1. Public Contract (api.json)",
|
|
32
|
+
"role": "Explicit array of allowed dot-separated paths controlling the public perimeter."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "2. Domain Specification (source.json)",
|
|
36
|
+
"role": "Single source of truth for resources, actions, schemas, JSDocs, and mock or real payloads."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "3. Engine (engine/)",
|
|
40
|
+
"role": "In-memory route tree assembly (engine/route/) and story-driven execution pipeline (engine/execution/)."
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"tools": {
|
|
48
|
+
"blueprint": {
|
|
49
|
+
"fetch": {
|
|
50
|
+
"action": "fetch",
|
|
51
|
+
"resource": "blueprint",
|
|
52
|
+
"description": "Specification for json-driven-npm: The Architectural Source of Truth.",
|
|
53
|
+
"data": {
|
|
54
|
+
"package": "json-driven-npm",
|
|
55
|
+
"role": "Architectural Source of Truth & Reference Specification",
|
|
56
|
+
"repository": "https://github.com/keshavsoft/json-driven-npm",
|
|
57
|
+
"npm": "https://www.npmjs.com/package/json-driven-npm",
|
|
58
|
+
"responsibilities": [
|
|
59
|
+
"Maintains reference versions (v1, v2, v3, v4)",
|
|
60
|
+
"Provides the in-memory route mounting engine",
|
|
61
|
+
"Provides the narrative execution coordinator",
|
|
62
|
+
"Exposes live CLI terminal inspector via npx json-driven-npm"
|
|
63
|
+
],
|
|
64
|
+
"rule": "Never transports code itself; acts as the authoritative template source."
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"scaffolder": {
|
|
69
|
+
"fetch": {
|
|
70
|
+
"action": "fetch",
|
|
71
|
+
"resource": "scaffolder",
|
|
72
|
+
"description": "Specification for create-json-driven-npm: The Zero-Dependency Code Transporter.",
|
|
73
|
+
"data": {
|
|
74
|
+
"package": "create-json-driven-npm",
|
|
75
|
+
"role": "The Scaffolder & Code Transporter",
|
|
76
|
+
"repository": "https://github.com/keshavsoft/create-json-driven-npm",
|
|
77
|
+
"npm": "https://www.npmjs.com/package/create-json-driven-npm",
|
|
78
|
+
"usage": "npm create json-driven-npm [target-directory] or npx create-json-driven-npm [target-directory]",
|
|
79
|
+
"mechanism": "Dynamically inspects node_modules/json-driven-npm/src, resolves the highest active version, and transports the clean skeleton into the target directory.",
|
|
80
|
+
"features": [
|
|
81
|
+
"Zero hardcoded templates (reads from json-driven-npm)",
|
|
82
|
+
"Built-in safety guards preventing overwrites",
|
|
83
|
+
"Instant scaffolding in 1 second"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"intellisense": {
|
|
89
|
+
"fetch": {
|
|
90
|
+
"action": "fetch",
|
|
91
|
+
"resource": "intellisense",
|
|
92
|
+
"description": "Specification for create-intellisense: The Automated TypeScript Generator.",
|
|
93
|
+
"data": {
|
|
94
|
+
"package": "create-intellisense",
|
|
95
|
+
"role": "Zero-Dependency TypeScript Type & JSDoc Generator",
|
|
96
|
+
"repository": "https://github.com/keshavsoft/create-intellisense",
|
|
97
|
+
"npm": "https://www.npmjs.com/package/create-intellisense",
|
|
98
|
+
"usage": "npx create-intellisense",
|
|
99
|
+
"mechanism": "Scans api.json and source.json in the project root or active version folder and emits index.d.ts with full IDE autocomplete and hover tooltips.",
|
|
100
|
+
"features": [
|
|
101
|
+
"Zero external dependencies (pure Node.js builtins)",
|
|
102
|
+
"Flexible path discovery (supports flattened and nested layouts)",
|
|
103
|
+
"Auto-infers types from package.json and active exports"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"workflow": {
|
|
110
|
+
"steps": {
|
|
111
|
+
"fetch": {
|
|
112
|
+
"action": "fetch",
|
|
113
|
+
"resource": "workflow",
|
|
114
|
+
"description": "The 3-step development guide for creating a new JSON-driven NPM package.",
|
|
115
|
+
"data": {
|
|
116
|
+
"steps": [
|
|
117
|
+
{
|
|
118
|
+
"step": 1,
|
|
119
|
+
"name": "Scaffold",
|
|
120
|
+
"command": "npm create json-driven-npm ./my-api-client",
|
|
121
|
+
"description": "create-json-driven-npm transports the clean v4 skeleton into your project directory with zero dependencies."
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"step": 2,
|
|
125
|
+
"name": "Customize",
|
|
126
|
+
"command": "Edit api.json & source.json",
|
|
127
|
+
"description": "Define your public routes in api.json and endpoint metadata in source.json. Implement your custom query/fetch logic in engine/execution/index.js."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"step": 3,
|
|
131
|
+
"name": "Generate Types",
|
|
132
|
+
"command": "npx create-intellisense",
|
|
133
|
+
"description": "create-intellisense scans your JSON contracts and emits index.d.ts, giving your users instant autocomplete and type safety."
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"principles": {
|
|
140
|
+
"fetch": {
|
|
141
|
+
"action": "fetch",
|
|
142
|
+
"resource": "principles",
|
|
143
|
+
"description": "Core KeshavSoft engineering standards and design conventions.",
|
|
144
|
+
"data": {
|
|
145
|
+
"standards": [
|
|
146
|
+
{
|
|
147
|
+
"rule": "Strictly One Default Export",
|
|
148
|
+
"syntax": "export default startFunc;",
|
|
149
|
+
"rationale": "Eliminates named export clutter and namespace ambiguity."
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"rule": "Standardized Parameter Unwrapping",
|
|
153
|
+
"syntax": "const startFunc = ({ inParam }) => { const localParam = inParam; ... };",
|
|
154
|
+
"rationale": "Prevents mutation of input objects and makes parameter origins explicit."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"rule": "Pure Domain Decoupling",
|
|
158
|
+
"syntax": "source.json contains business metadata only",
|
|
159
|
+
"rationale": "Keeps domain specifications independent from network protocols, headers, or runtime environments."
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"founder": {
|
|
168
|
+
"profile": {
|
|
169
|
+
"fetch": {
|
|
170
|
+
"action": "fetch",
|
|
171
|
+
"resource": "profile",
|
|
172
|
+
"description": "Fetches founder and software architect profile.",
|
|
173
|
+
"data": {
|
|
174
|
+
"name": "Keshav Nalam",
|
|
175
|
+
"role": "Software Architect & Developer",
|
|
176
|
+
"company": "KeshavSoft",
|
|
177
|
+
"location": "India",
|
|
178
|
+
"bio": "Creator of zero-dependency, declarative, JSON-driven NPM architectures."
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"links": {
|
|
183
|
+
"fetch": {
|
|
184
|
+
"action": "fetch",
|
|
185
|
+
"resource": "links",
|
|
186
|
+
"description": "Fetches official website, GitHub, NPM, and LinkedIn profile links.",
|
|
187
|
+
"data": {
|
|
188
|
+
"website": "https://keshavsoft.com/",
|
|
189
|
+
"github": "https://github.com/keshavsoft",
|
|
190
|
+
"npm": "https://www.npmjs.com/~keshavsoft",
|
|
191
|
+
"linkedin": "https://www.linkedin.com/in/keshav-nalam"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"company": {
|
|
197
|
+
"info": {
|
|
198
|
+
"fetch": {
|
|
199
|
+
"action": "fetch",
|
|
200
|
+
"resource": "info",
|
|
201
|
+
"description": "Fetches KeshavSoft organization information and engineering philosophy.",
|
|
202
|
+
"data": {
|
|
203
|
+
"name": "KeshavSoft",
|
|
204
|
+
"tagline": "Pure, declarative, and config-driven software engineering",
|
|
205
|
+
"website": "https://keshavsoft.com/",
|
|
206
|
+
"philosophy": "Zero-dependency architectures, declarative pipelines, and zero folder sprawl"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"packages": {
|
|
211
|
+
"fetch": {
|
|
212
|
+
"action": "fetch",
|
|
213
|
+
"resource": "packages",
|
|
214
|
+
"description": "Lists flagship packages in the KeshavSoft ecosystem.",
|
|
215
|
+
"data": [
|
|
216
|
+
{ "name": "tally-simple", "description": "Raw TDL transport client & CLI for Tally ERP/Prime" },
|
|
217
|
+
{ "name": "tally-simple-json", "description": "Fast XML-to-JSON parsing client for Tally" },
|
|
218
|
+
{ "name": "create-intellisense", "description": "Zero-dependency TypeScript declaration generator for JSON-driven architectures" },
|
|
219
|
+
{ "name": "create-json-driven-npm", "description": "Official scaffolding tool to transport JSON-driven client architectures" },
|
|
220
|
+
{ "name": "json-renderers", "description": "Browser DOM mounting runtime for declarative UI specifications" },
|
|
221
|
+
{ "name": "json-renderers-build", "description": "Headless UI component specification compiler" },
|
|
222
|
+
{ "name": "json-driven-npm", "description": "Architectural reference implementation and CLI runner for declarative, JSON-driven NPM packages" }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import isObject from "./isObject.js";
|
|
2
|
+
import isStringArray from "./isStringArray.js";
|
|
3
|
+
import isFunction from "./isFunction.js";
|
|
4
|
+
|
|
5
|
+
const startFunc = ({ inSource, inApiPaths, inExecutor }) => {
|
|
6
|
+
const localSource = inSource;
|
|
7
|
+
const localApiPaths = inApiPaths;
|
|
8
|
+
const localExecutor = inExecutor;
|
|
9
|
+
|
|
10
|
+
isObject({ inSource: localSource });
|
|
11
|
+
isStringArray({ inApiPaths: localApiPaths });
|
|
12
|
+
isFunction({ inExecutor: localExecutor });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default startFunc;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const startFunc = ({ inApiPaths }) => {
|
|
2
|
+
const localApiPaths = inApiPaths;
|
|
3
|
+
|
|
4
|
+
if (!Array.isArray(localApiPaths)) {
|
|
5
|
+
throw new TypeError("apiPaths must be an array of strings.");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < localApiPaths.length; i++) {
|
|
9
|
+
if (typeof localApiPaths[i] !== "string") {
|
|
10
|
+
throw new TypeError(`apiPaths must be an array of strings. apiPaths[${i}] must be a string.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default startFunc;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const startFunc = ({ inSource, inApiPaths, inExecutor }) => {
|
|
2
|
+
const localSource = inSource;
|
|
3
|
+
const localApiPaths = inApiPaths;
|
|
4
|
+
const localExecutor = inExecutor;
|
|
5
|
+
|
|
6
|
+
const tree = {};
|
|
7
|
+
|
|
8
|
+
for (const path of localApiPaths) {
|
|
9
|
+
const parts = path.split(".");
|
|
10
|
+
const leaf = parts.pop();
|
|
11
|
+
|
|
12
|
+
let branch = tree;
|
|
13
|
+
for (const segment of parts) {
|
|
14
|
+
branch[segment] ??= {};
|
|
15
|
+
branch = branch[segment];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
branch[leaf] = async (param, ...args) => {
|
|
19
|
+
const localParam = param;
|
|
20
|
+
const localArgs = args;
|
|
21
|
+
|
|
22
|
+
return await localExecutor({
|
|
23
|
+
inRoutePath: path,
|
|
24
|
+
inParam: localParam,
|
|
25
|
+
inArgs: localArgs,
|
|
26
|
+
inSource: localSource
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const root = localApiPaths[0]?.split(".")[0];
|
|
32
|
+
return root && tree[root] ? tree[root] : tree;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default startFunc;
|
package/src/v5/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import guards from "./engine/guards/index.js";
|
|
2
|
+
import run from "./engine/run.js";
|
|
3
|
+
|
|
4
|
+
const apiTree = (source, apiPaths, executor) => {
|
|
5
|
+
let localSource = source;
|
|
6
|
+
let localApiPaths = apiPaths;
|
|
7
|
+
let localExecutor = executor;
|
|
8
|
+
|
|
9
|
+
if (source && typeof source === "object" && "inSource" in source) {
|
|
10
|
+
localSource = source.inSource;
|
|
11
|
+
localApiPaths = source.inApiPaths;
|
|
12
|
+
localExecutor = source.inExecutor;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
guards({
|
|
16
|
+
inSource: localSource,
|
|
17
|
+
inApiPaths: localApiPaths,
|
|
18
|
+
inExecutor: localExecutor
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return run({
|
|
22
|
+
inSource: localSource,
|
|
23
|
+
inApiPaths: localApiPaths,
|
|
24
|
+
inExecutor: localExecutor
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default apiTree;
|
|
29
|
+
export { apiTree, apiTree as start };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[
|
|
2
|
+
"app.ecosystem.architecture.philosophy.fetch",
|
|
3
|
+
"app.ecosystem.architecture.layers.fetch",
|
|
4
|
+
"app.ecosystem.tools.blueprint.fetch",
|
|
5
|
+
"app.ecosystem.tools.scaffolder.fetch",
|
|
6
|
+
"app.ecosystem.tools.intellisense.fetch",
|
|
7
|
+
"app.ecosystem.workflow.steps.fetch",
|
|
8
|
+
"app.ecosystem.workflow.principles.fetch",
|
|
9
|
+
"app.founder.profile.fetch",
|
|
10
|
+
"app.founder.links.fetch",
|
|
11
|
+
"app.company.info.fetch",
|
|
12
|
+
"app.company.packages.fetch"
|
|
13
|
+
]
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": {
|
|
3
|
+
"ecosystem": {
|
|
4
|
+
"architecture": {
|
|
5
|
+
"philosophy": {
|
|
6
|
+
"fetch": {
|
|
7
|
+
"action": "fetch",
|
|
8
|
+
"resource": "philosophy",
|
|
9
|
+
"description": "Explains why endpoints as structured data eliminates conventional folder sprawl.",
|
|
10
|
+
"data": {
|
|
11
|
+
"concept": "Endpoints as Data",
|
|
12
|
+
"problem": "In conventional client libraries, adding 50 endpoints requires creating 50 directories and 50 repetitive boilerplate files, causing maintenance drag and import fragility.",
|
|
13
|
+
"solution": "Define endpoints declaratively in JSON contracts (source.json + api.json) and assemble the callable object tree in memory at startup.",
|
|
14
|
+
"benefits": [
|
|
15
|
+
"Zero directory sprawl across packages",
|
|
16
|
+
"Single point of query customization in engine/execution",
|
|
17
|
+
"Instant in-memory object tree generation without code duplication",
|
|
18
|
+
"Deterministic compile-time TypeScript typing directly from JSON"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"layers": {
|
|
24
|
+
"fetch": {
|
|
25
|
+
"action": "fetch",
|
|
26
|
+
"resource": "layers",
|
|
27
|
+
"description": "Details the three clean architectural layers of a JSON-driven NPM package.",
|
|
28
|
+
"data": {
|
|
29
|
+
"layers": [
|
|
30
|
+
{
|
|
31
|
+
"name": "1. Public Contract (api.json)",
|
|
32
|
+
"role": "Explicit array of allowed dot-separated paths controlling the public perimeter."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "2. Domain Specification (source.json)",
|
|
36
|
+
"role": "Single source of truth for resources, actions, schemas, JSDocs, and mock or real payloads."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "3. Engine (engine/)",
|
|
40
|
+
"role": "In-memory route tree assembly (engine/route/) and story-driven execution pipeline (engine/execution/)."
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"tools": {
|
|
48
|
+
"blueprint": {
|
|
49
|
+
"fetch": {
|
|
50
|
+
"action": "fetch",
|
|
51
|
+
"resource": "blueprint",
|
|
52
|
+
"description": "Specification for json-driven-npm: The Architectural Source of Truth.",
|
|
53
|
+
"data": {
|
|
54
|
+
"package": "json-driven-npm",
|
|
55
|
+
"role": "Architectural Source of Truth & Reference Specification",
|
|
56
|
+
"repository": "https://github.com/keshavsoft/json-driven-npm",
|
|
57
|
+
"npm": "https://www.npmjs.com/package/json-driven-npm",
|
|
58
|
+
"responsibilities": [
|
|
59
|
+
"Maintains reference versions (v1, v2, v3, v4)",
|
|
60
|
+
"Provides the in-memory route mounting engine",
|
|
61
|
+
"Provides the narrative execution coordinator",
|
|
62
|
+
"Exposes live CLI terminal inspector via npx json-driven-npm"
|
|
63
|
+
],
|
|
64
|
+
"rule": "Never transports code itself; acts as the authoritative template source."
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"scaffolder": {
|
|
69
|
+
"fetch": {
|
|
70
|
+
"action": "fetch",
|
|
71
|
+
"resource": "scaffolder",
|
|
72
|
+
"description": "Specification for create-json-driven-npm: The Zero-Dependency Code Transporter.",
|
|
73
|
+
"data": {
|
|
74
|
+
"package": "create-json-driven-npm",
|
|
75
|
+
"role": "The Scaffolder & Code Transporter",
|
|
76
|
+
"repository": "https://github.com/keshavsoft/create-json-driven-npm",
|
|
77
|
+
"npm": "https://www.npmjs.com/package/create-json-driven-npm",
|
|
78
|
+
"usage": "npm create json-driven-npm [target-directory] or npx create-json-driven-npm [target-directory]",
|
|
79
|
+
"mechanism": "Dynamically inspects node_modules/json-driven-npm/src, resolves the highest active version, and transports the clean skeleton into the target directory.",
|
|
80
|
+
"features": [
|
|
81
|
+
"Zero hardcoded templates (reads from json-driven-npm)",
|
|
82
|
+
"Built-in safety guards preventing overwrites",
|
|
83
|
+
"Instant scaffolding in 1 second"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"intellisense": {
|
|
89
|
+
"fetch": {
|
|
90
|
+
"action": "fetch",
|
|
91
|
+
"resource": "intellisense",
|
|
92
|
+
"description": "Specification for create-intellisense: The Automated TypeScript Generator.",
|
|
93
|
+
"data": {
|
|
94
|
+
"package": "create-intellisense",
|
|
95
|
+
"role": "Zero-Dependency TypeScript Type & JSDoc Generator",
|
|
96
|
+
"repository": "https://github.com/keshavsoft/create-intellisense",
|
|
97
|
+
"npm": "https://www.npmjs.com/package/create-intellisense",
|
|
98
|
+
"usage": "npx create-intellisense",
|
|
99
|
+
"mechanism": "Scans api.json and source.json in the project root or active version folder and emits index.d.ts with full IDE autocomplete and hover tooltips.",
|
|
100
|
+
"features": [
|
|
101
|
+
"Zero external dependencies (pure Node.js builtins)",
|
|
102
|
+
"Flexible path discovery (supports flattened and nested layouts)",
|
|
103
|
+
"Auto-infers types from package.json and active exports"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"workflow": {
|
|
110
|
+
"steps": {
|
|
111
|
+
"fetch": {
|
|
112
|
+
"action": "fetch",
|
|
113
|
+
"resource": "workflow",
|
|
114
|
+
"description": "The 3-step development guide for creating a new JSON-driven NPM package.",
|
|
115
|
+
"data": {
|
|
116
|
+
"steps": [
|
|
117
|
+
{
|
|
118
|
+
"step": 1,
|
|
119
|
+
"name": "Scaffold",
|
|
120
|
+
"command": "npm create json-driven-npm ./my-api-client",
|
|
121
|
+
"description": "create-json-driven-npm transports the clean v4 skeleton into your project directory with zero dependencies."
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"step": 2,
|
|
125
|
+
"name": "Customize",
|
|
126
|
+
"command": "Edit api.json & source.json",
|
|
127
|
+
"description": "Define your public routes in api.json and endpoint metadata in source.json. Implement your custom query/fetch logic in engine/execution/index.js."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"step": 3,
|
|
131
|
+
"name": "Generate Types",
|
|
132
|
+
"command": "npx create-intellisense",
|
|
133
|
+
"description": "create-intellisense scans your JSON contracts and emits index.d.ts, giving your users instant autocomplete and type safety."
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"principles": {
|
|
140
|
+
"fetch": {
|
|
141
|
+
"action": "fetch",
|
|
142
|
+
"resource": "principles",
|
|
143
|
+
"description": "Core KeshavSoft engineering standards and design conventions.",
|
|
144
|
+
"data": {
|
|
145
|
+
"standards": [
|
|
146
|
+
{
|
|
147
|
+
"rule": "Strictly One Default Export",
|
|
148
|
+
"syntax": "export default startFunc;",
|
|
149
|
+
"rationale": "Eliminates named export clutter and namespace ambiguity."
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"rule": "Standardized Parameter Unwrapping",
|
|
153
|
+
"syntax": "const startFunc = ({ inParam }) => { const localParam = inParam; ... };",
|
|
154
|
+
"rationale": "Prevents mutation of input objects and makes parameter origins explicit."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"rule": "Pure Domain Decoupling",
|
|
158
|
+
"syntax": "source.json contains business metadata only",
|
|
159
|
+
"rationale": "Keeps domain specifications independent from network protocols, headers, or runtime environments."
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"founder": {
|
|
168
|
+
"profile": {
|
|
169
|
+
"fetch": {
|
|
170
|
+
"action": "fetch",
|
|
171
|
+
"resource": "profile",
|
|
172
|
+
"description": "Fetches founder and software architect profile.",
|
|
173
|
+
"data": {
|
|
174
|
+
"name": "Keshav Nalam",
|
|
175
|
+
"role": "Software Architect & Developer",
|
|
176
|
+
"company": "KeshavSoft",
|
|
177
|
+
"location": "India",
|
|
178
|
+
"bio": "Creator of zero-dependency, declarative, JSON-driven NPM architectures."
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"links": {
|
|
183
|
+
"fetch": {
|
|
184
|
+
"action": "fetch",
|
|
185
|
+
"resource": "links",
|
|
186
|
+
"description": "Fetches official website, GitHub, NPM, and LinkedIn profile links.",
|
|
187
|
+
"data": {
|
|
188
|
+
"website": "https://keshavsoft.com/",
|
|
189
|
+
"github": "https://github.com/keshavsoft",
|
|
190
|
+
"npm": "https://www.npmjs.com/~keshavsoft",
|
|
191
|
+
"linkedin": "https://www.linkedin.com/in/keshav-nalam"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"company": {
|
|
197
|
+
"info": {
|
|
198
|
+
"fetch": {
|
|
199
|
+
"action": "fetch",
|
|
200
|
+
"resource": "info",
|
|
201
|
+
"description": "Fetches KeshavSoft organization information and engineering philosophy.",
|
|
202
|
+
"data": {
|
|
203
|
+
"name": "KeshavSoft",
|
|
204
|
+
"tagline": "Pure, declarative, and config-driven software engineering",
|
|
205
|
+
"website": "https://keshavsoft.com/",
|
|
206
|
+
"philosophy": "Zero-dependency architectures, declarative pipelines, and zero folder sprawl"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"packages": {
|
|
211
|
+
"fetch": {
|
|
212
|
+
"action": "fetch",
|
|
213
|
+
"resource": "packages",
|
|
214
|
+
"description": "Lists flagship packages in the KeshavSoft ecosystem.",
|
|
215
|
+
"data": [
|
|
216
|
+
{ "name": "tally-simple", "description": "Raw TDL transport client & CLI for Tally ERP/Prime" },
|
|
217
|
+
{ "name": "tally-simple-json", "description": "Fast XML-to-JSON parsing client for Tally" },
|
|
218
|
+
{ "name": "create-intellisense", "description": "Zero-dependency TypeScript declaration generator for JSON-driven architectures" },
|
|
219
|
+
{ "name": "create-json-driven-npm", "description": "Official scaffolding tool to transport JSON-driven client architectures" },
|
|
220
|
+
{ "name": "json-renderers", "description": "Browser DOM mounting runtime for declarative UI specifications" },
|
|
221
|
+
{ "name": "json-renderers-build", "description": "Headless UI component specification compiler" },
|
|
222
|
+
{ "name": "json-driven-npm", "description": "Architectural reference implementation and CLI runner for declarative, JSON-driven NPM packages" }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import isObject from "./isObject.js";
|
|
2
|
+
import isStringArray from "./isStringArray.js";
|
|
3
|
+
import isFunction from "./isFunction.js";
|
|
4
|
+
|
|
5
|
+
const startFunc = ({ inSource, inApiPaths, inExecutor }) => {
|
|
6
|
+
const localSource = inSource;
|
|
7
|
+
const localApiPaths = inApiPaths;
|
|
8
|
+
const localExecutor = inExecutor;
|
|
9
|
+
|
|
10
|
+
isObject({ inSource: localSource });
|
|
11
|
+
isStringArray({ inApiPaths: localApiPaths });
|
|
12
|
+
isFunction({ inExecutor: localExecutor });
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default startFunc;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const startFunc = ({ inApiPaths }) => {
|
|
2
|
+
const localApiPaths = inApiPaths;
|
|
3
|
+
|
|
4
|
+
if (!Array.isArray(localApiPaths)) {
|
|
5
|
+
throw new TypeError("apiPaths must be an array of strings.");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
for (let i = 0; i < localApiPaths.length; i++) {
|
|
9
|
+
if (typeof localApiPaths[i] !== "string") {
|
|
10
|
+
throw new TypeError(`apiPaths must be an array of strings. apiPaths[${i}] must be a string.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default startFunc;
|