@nordsym/apiclaw 2.2.0 → 2.3.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 +15 -2
- package/dist/bin-http.js +0 -0
- package/dist/bin.bundled.js +79288 -0
- package/dist/gateway-client.d.ts.map +1 -1
- package/dist/gateway-client.js +24 -2
- package/dist/gateway-client.js.map +1 -1
- package/dist/index.bundled.js +61263 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
- package/.claude/settings.local.json +0 -13
- package/.env.prod +0 -1
- package/apiclaw-README.md +0 -494
- package/convex/_generated/api.d.ts +0 -145
- package/convex/_generated/api.js +0 -23
- package/convex/_generated/dataModel.d.ts +0 -60
- package/convex/_generated/server.d.ts +0 -143
- package/convex/_generated/server.js +0 -93
- package/convex/_listWorkspaces.ts +0 -13
- package/convex/adminActivate.ts +0 -53
- package/convex/adminStats.ts +0 -306
- package/convex/agents.ts +0 -939
- package/convex/analytics.ts +0 -187
- package/convex/apiKeys.ts +0 -220
- package/convex/backfillAnalytics.ts +0 -272
- package/convex/backfillSearchLogs.ts +0 -35
- package/convex/billing.ts +0 -834
- package/convex/capabilities.ts +0 -157
- package/convex/chains.ts +0 -1318
- package/convex/credits.ts +0 -211
- package/convex/crons.ts +0 -65
- package/convex/debugFilestackLogs.ts +0 -16
- package/convex/debugGetToken.ts +0 -18
- package/convex/directCall.ts +0 -713
- package/convex/earnProgress.ts +0 -753
- package/convex/email.ts +0 -329
- package/convex/feedback.ts +0 -265
- package/convex/funnel.ts +0 -431
- package/convex/guards.ts +0 -174
- package/convex/http.ts +0 -3756
- package/convex/inbound.ts +0 -32
- package/convex/logs.ts +0 -701
- package/convex/migrateFilestack.ts +0 -81
- package/convex/migratePartnersProd.ts +0 -174
- package/convex/migratePratham.ts +0 -126
- package/convex/migrateProviderWorkspaces.ts +0 -175
- package/convex/mou.ts +0 -91
- package/convex/nurture.ts +0 -355
- package/convex/providerKeys.ts +0 -289
- package/convex/providers.ts +0 -1135
- package/convex/purchases.ts +0 -183
- package/convex/ratelimit.ts +0 -104
- package/convex/schema.ts +0 -926
- package/convex/searchLogs.ts +0 -265
- package/convex/seedAPILayerAPIs.ts +0 -191
- package/convex/seedDirectCallConfigs.ts +0 -336
- package/convex/seedPratham.ts +0 -149
- package/convex/spendAlerts.ts +0 -442
- package/convex/stripeActions.ts +0 -607
- package/convex/teams.ts +0 -243
- package/convex/telemetry.ts +0 -81
- package/convex/tsconfig.json +0 -25
- package/convex/updateAPIStatus.ts +0 -44
- package/convex/usage.ts +0 -260
- package/convex/usageReports.ts +0 -357
- package/convex/waitlist.ts +0 -55
- package/convex/webhooks.ts +0 -494
- package/convex/workspaceSettings.ts +0 -143
- package/convex/workspaces.ts +0 -1331
- package/convex.json +0 -3
- package/direct-test.mjs +0 -51
- package/email-templates/filestack-provider-outreach.html +0 -162
- package/email-templates/partnership-template.html +0 -116
- package/email-templates/pratham-draft-preview.txt +0 -57
- package/email-templates/pratham-partnership-draft.html +0 -141
- package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
- package/reports/pipeline/PIPELINE-REPORT.json +0 -153
- package/reports/pipeline/acquire_apisguru.json +0 -17
- package/reports/pipeline/capabilities.json +0 -38
- package/reports/pipeline/discover_azure_recursive.json +0 -1551
- package/reports/pipeline/discover_github.json +0 -25
- package/reports/pipeline/discover_github_repos.json +0 -49
- package/reports/pipeline/discover_swaggerhub.json +0 -24
- package/reports/pipeline/discover_well_known.json +0 -23
- package/reports/pipeline/fetch_specs.json +0 -19
- package/reports/pipeline/generate_providers.json +0 -14
- package/reports/pipeline/match_registry.json +0 -11
- package/reports/pipeline/parse_specs.json +0 -17
- package/reports/pipeline/promote_candidates.json +0 -34
- package/reports/pipeline/validate.json +0 -30
- package/reports/pipeline/validate_smoke_details.json +0 -3835
- package/reports/session-report-2026-04-05.html +0 -433
- package/seed-apis-direct.mjs +0 -106
- package/src/access-control.ts +0 -174
- package/src/adapters/base.ts +0 -364
- package/src/adapters/claude-desktop.ts +0 -41
- package/src/adapters/cline.ts +0 -88
- package/src/adapters/continue.ts +0 -91
- package/src/adapters/cursor.ts +0 -43
- package/src/adapters/custom.ts +0 -188
- package/src/adapters/detect.ts +0 -202
- package/src/adapters/index.ts +0 -47
- package/src/adapters/windsurf.ts +0 -44
- package/src/bin-http.ts +0 -45
- package/src/bin.ts +0 -34
- package/src/capability-router.ts +0 -331
- package/src/chainExecutor.ts +0 -730
- package/src/chainResolver.test.ts +0 -246
- package/src/chainResolver.ts +0 -658
- package/src/cli/commands/demo.ts +0 -109
- package/src/cli/commands/doctor.ts +0 -435
- package/src/cli/commands/index.ts +0 -9
- package/src/cli/commands/login.ts +0 -203
- package/src/cli/commands/mcp-install.ts +0 -373
- package/src/cli/commands/restore.ts +0 -333
- package/src/cli/commands/setup.ts +0 -297
- package/src/cli/commands/uninstall.ts +0 -240
- package/src/cli/index.ts +0 -148
- package/src/cli.ts +0 -370
- package/src/confirmation.ts +0 -296
- package/src/credentials.ts +0 -455
- package/src/credits.ts +0 -329
- package/src/crypto.ts +0 -75
- package/src/discovery.ts +0 -568
- package/src/enterprise/env.ts +0 -156
- package/src/enterprise/index.ts +0 -7
- package/src/enterprise/script-generator.ts +0 -481
- package/src/execute-dynamic.ts +0 -617
- package/src/execute.ts +0 -2386
- package/src/funnel-client.ts +0 -168
- package/src/funnel.test.ts +0 -187
- package/src/gateway-client.ts +0 -192
- package/src/hivr-whitelist.ts +0 -110
- package/src/http-api.ts +0 -286
- package/src/http-server-minimal.ts +0 -154
- package/src/index.ts +0 -2702
- package/src/intelligent-gateway.ts +0 -339
- package/src/mcp-analytics.ts +0 -156
- package/src/metered.ts +0 -149
- package/src/open-apis-generated.ts +0 -157
- package/src/open-apis.ts +0 -558
- package/src/postinstall.ts +0 -40
- package/src/product-whitelist.ts +0 -246
- package/src/proxy.ts +0 -36
- package/src/registration-guard.ts +0 -117
- package/src/session.ts +0 -129
- package/src/stripe.ts +0 -497
- package/src/telemetry.ts +0 -71
- package/src/test.ts +0 -135
- package/src/types/convex-api.d.ts +0 -20
- package/src/types/convex-api.ts +0 -21
- package/src/types.ts +0 -109
- package/src/ui/colors.ts +0 -219
- package/src/ui/errors.ts +0 -394
- package/src/ui/index.ts +0 -17
- package/src/ui/prompts.ts +0 -390
- package/src/ui/spinner.ts +0 -325
- package/src/utils/backup.ts +0 -224
- package/src/utils/config.ts +0 -318
- package/src/utils/os.ts +0 -124
- package/src/utils/paths.ts +0 -203
- package/src/webhook.ts +0 -107
- package/test-10-working.cjs +0 -97
- package/test-14-final.cjs +0 -96
- package/test-actual-handlers.ts +0 -92
- package/test-apilayer-all-14.ts +0 -249
- package/test-apilayer-fixed.ts +0 -248
- package/test-direct-endpoints.ts +0 -174
- package/test-exact-endpoints.ts +0 -144
- package/test-final.ts +0 -83
- package/test-full-routing.ts +0 -100
- package/test-handlers-correct.ts +0 -217
- package/test-numverify-key.ts +0 -41
- package/test-via-handlers.ts +0 -92
- package/test-worldnews.mjs +0 -26
- package/tsconfig.json +0 -20
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quick tests for chainResolver
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
extractReferences,
|
|
7
|
-
parseReference,
|
|
8
|
-
resolveReferences,
|
|
9
|
-
validateReferences,
|
|
10
|
-
evaluateCondition,
|
|
11
|
-
ChainContext,
|
|
12
|
-
ChainStep,
|
|
13
|
-
} from './chainResolver.js';
|
|
14
|
-
|
|
15
|
-
// Test data
|
|
16
|
-
const mockContext: ChainContext = {
|
|
17
|
-
results: {
|
|
18
|
-
step1: { url: 'https://example.com/image.png', id: '123' },
|
|
19
|
-
step2: { data: { items: [{ name: 'first' }, { name: 'second' }] } },
|
|
20
|
-
},
|
|
21
|
-
inputs: { email: 'test@example.com', count: 5 },
|
|
22
|
-
currentIndex: 2,
|
|
23
|
-
startedAt: '2024-01-01T00:00:00Z',
|
|
24
|
-
prevStepId: 'step2',
|
|
25
|
-
parallelResults: [
|
|
26
|
-
{ url: 'https://a.com' },
|
|
27
|
-
{ url: 'https://b.com' },
|
|
28
|
-
],
|
|
29
|
-
forEachItem: { id: 42, name: 'test-item' },
|
|
30
|
-
forEachIndex: 3,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// TESTS
|
|
35
|
-
// ============================================================================
|
|
36
|
-
|
|
37
|
-
function test(name: string, fn: () => void) {
|
|
38
|
-
try {
|
|
39
|
-
fn();
|
|
40
|
-
console.log(`✅ ${name}`);
|
|
41
|
-
} catch (e: any) {
|
|
42
|
-
console.log(`❌ ${name}: ${e.message}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function assertEqual(actual: any, expected: any, msg?: string) {
|
|
47
|
-
const a = JSON.stringify(actual);
|
|
48
|
-
const e = JSON.stringify(expected);
|
|
49
|
-
if (a !== e) {
|
|
50
|
-
throw new Error(`${msg || 'Assertion failed'}: expected ${e}, got ${a}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log('\n=== Reference Extraction ===\n');
|
|
55
|
-
|
|
56
|
-
test('extracts simple step reference', () => {
|
|
57
|
-
const refs = extractReferences('$step1.url');
|
|
58
|
-
assertEqual(refs.length, 1);
|
|
59
|
-
assertEqual(refs[0].type, 'step');
|
|
60
|
-
assertEqual(refs[0].stepId, 'step1');
|
|
61
|
-
assertEqual(refs[0].path, ['url']);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('extracts $prev reference', () => {
|
|
65
|
-
const refs = extractReferences('$prev.data');
|
|
66
|
-
assertEqual(refs.length, 1);
|
|
67
|
-
assertEqual(refs[0].type, 'prev');
|
|
68
|
-
assertEqual(refs[0].path, ['data']);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('extracts nested path', () => {
|
|
72
|
-
const refs = extractReferences('$step2.data.items[0].name');
|
|
73
|
-
assertEqual(refs.length, 1);
|
|
74
|
-
assertEqual(refs[0].path, ['data', 'items', '0', 'name']);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('extracts multiple references', () => {
|
|
78
|
-
const refs = extractReferences('Send $step1.url to $inputs.email');
|
|
79
|
-
assertEqual(refs.length, 2);
|
|
80
|
-
assertEqual(refs[0].raw, '$step1.url');
|
|
81
|
-
assertEqual(refs[1].raw, '$inputs.email');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test('extracts $parallel with index', () => {
|
|
85
|
-
const refs = extractReferences('$parallel[0].url');
|
|
86
|
-
assertEqual(refs.length, 1);
|
|
87
|
-
assertEqual(refs[0].type, 'parallel');
|
|
88
|
-
assertEqual(refs[0].arrayIndex, 0);
|
|
89
|
-
assertEqual(refs[0].path, ['url']);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('extracts built-in $chain variables', () => {
|
|
93
|
-
const refs = extractReferences('$chain.startedAt');
|
|
94
|
-
assertEqual(refs.length, 1);
|
|
95
|
-
assertEqual(refs[0].type, 'chain');
|
|
96
|
-
assertEqual(refs[0].path, ['startedAt']);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
console.log('\n=== Reference Resolution ===\n');
|
|
100
|
-
|
|
101
|
-
test('resolves step reference', () => {
|
|
102
|
-
const result = resolveReferences({ url: '$step1.url' }, mockContext);
|
|
103
|
-
assertEqual(result.url, 'https://example.com/image.png');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('resolves $prev reference', () => {
|
|
107
|
-
const result = resolveReferences({ data: '$prev.data' }, mockContext);
|
|
108
|
-
assertEqual(result.data, mockContext.results.step2.data);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
test('resolves nested path with array', () => {
|
|
112
|
-
const result = resolveReferences({ name: '$step2.data.items[1].name' }, mockContext);
|
|
113
|
-
assertEqual(result.name, 'second');
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
test('resolves $inputs reference', () => {
|
|
117
|
-
const result = resolveReferences({ to: '$inputs.email' }, mockContext);
|
|
118
|
-
assertEqual(result.to, 'test@example.com');
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
test('resolves $parallel reference', () => {
|
|
122
|
-
const result = resolveReferences({ url: '$parallel[1].url' }, mockContext);
|
|
123
|
-
assertEqual(result.url, 'https://b.com');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test('resolves $chain.startedAt', () => {
|
|
127
|
-
const result = resolveReferences({ time: '$chain.startedAt' }, mockContext);
|
|
128
|
-
assertEqual(result.time, '2024-01-01T00:00:00Z');
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('resolves $item in forEach', () => {
|
|
132
|
-
const result = resolveReferences({ id: '$item.id' }, mockContext);
|
|
133
|
-
assertEqual(result.id, 42);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
test('resolves $index in forEach', () => {
|
|
137
|
-
const result = resolveReferences({ idx: '$index' }, mockContext);
|
|
138
|
-
assertEqual(result.idx, 3);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test('preserves non-reference strings', () => {
|
|
142
|
-
const result = resolveReferences({ msg: 'Hello world' }, mockContext);
|
|
143
|
-
assertEqual(result.msg, 'Hello world');
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
test('interpolates multiple references in string', () => {
|
|
147
|
-
const result = resolveReferences({ msg: 'File at $step1.url for $inputs.email' }, mockContext);
|
|
148
|
-
assertEqual(result.msg, 'File at https://example.com/image.png for test@example.com');
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test('resolves nested objects', () => {
|
|
152
|
-
const result = resolveReferences({
|
|
153
|
-
outer: {
|
|
154
|
-
inner: '$step1.id',
|
|
155
|
-
deep: { value: '$inputs.count' }
|
|
156
|
-
}
|
|
157
|
-
}, mockContext);
|
|
158
|
-
assertEqual(result.outer.inner, '123');
|
|
159
|
-
assertEqual(result.outer.deep.value, 5);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('resolves arrays', () => {
|
|
163
|
-
const result = resolveReferences({
|
|
164
|
-
urls: ['$parallel[0].url', '$parallel[1].url']
|
|
165
|
-
}, mockContext);
|
|
166
|
-
assertEqual(result.urls, ['https://a.com', 'https://b.com']);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
console.log('\n=== Validation ===\n');
|
|
170
|
-
|
|
171
|
-
test('validates valid chain', () => {
|
|
172
|
-
const steps: ChainStep[] = [
|
|
173
|
-
{ id: 'step1', provider: 'brave', action: 'search', params: { query: 'test' } },
|
|
174
|
-
{ id: 'step2', provider: 'firecrawl', action: 'scrape', params: { url: '$step1.url' } },
|
|
175
|
-
];
|
|
176
|
-
const result = validateReferences(steps);
|
|
177
|
-
assertEqual(result.valid, true);
|
|
178
|
-
assertEqual(result.errors.length, 0);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
test('detects reference to undefined step', () => {
|
|
182
|
-
const steps: ChainStep[] = [
|
|
183
|
-
{ id: 'step1', provider: 'brave', action: 'search', params: { url: '$nonexistent.url' } },
|
|
184
|
-
];
|
|
185
|
-
const result = validateReferences(steps);
|
|
186
|
-
assertEqual(result.valid, false);
|
|
187
|
-
assertEqual(result.errors.length, 1);
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test('detects forward reference', () => {
|
|
191
|
-
const steps: ChainStep[] = [
|
|
192
|
-
{ id: 'step1', provider: 'brave', action: 'search', params: { url: '$step2.url' } },
|
|
193
|
-
{ id: 'step2', provider: 'firecrawl', action: 'scrape', params: {} },
|
|
194
|
-
];
|
|
195
|
-
const result = validateReferences(steps);
|
|
196
|
-
assertEqual(result.valid, false);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
test('detects $prev in first step', () => {
|
|
200
|
-
const steps: ChainStep[] = [
|
|
201
|
-
{ id: 'step1', provider: 'brave', action: 'search', params: { url: '$prev.url' } },
|
|
202
|
-
];
|
|
203
|
-
const result = validateReferences(steps);
|
|
204
|
-
assertEqual(result.valid, false);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
console.log('\n=== Condition Evaluation ===\n');
|
|
208
|
-
|
|
209
|
-
test('evaluates equality', () => {
|
|
210
|
-
assertEqual(evaluateCondition('"test" === "test"', mockContext), true);
|
|
211
|
-
assertEqual(evaluateCondition('"test" === "other"', mockContext), false);
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
test('evaluates inequality', () => {
|
|
215
|
-
assertEqual(evaluateCondition('5 !== 3', mockContext), true);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
test('evaluates comparison', () => {
|
|
219
|
-
assertEqual(evaluateCondition('10 > 5', mockContext), true);
|
|
220
|
-
assertEqual(evaluateCondition('3 < 2', mockContext), false);
|
|
221
|
-
assertEqual(evaluateCondition('5 >= 5', mockContext), true);
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
test('evaluates logical AND', () => {
|
|
225
|
-
assertEqual(evaluateCondition('true && true', mockContext), true);
|
|
226
|
-
assertEqual(evaluateCondition('true && false', mockContext), false);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('evaluates logical OR', () => {
|
|
230
|
-
assertEqual(evaluateCondition('false || true', mockContext), true);
|
|
231
|
-
assertEqual(evaluateCondition('false || false', mockContext), false);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
test('evaluates negation', () => {
|
|
235
|
-
assertEqual(evaluateCondition('!false', mockContext), true);
|
|
236
|
-
assertEqual(evaluateCondition('!true', mockContext), false);
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
test('evaluates with resolved references', () => {
|
|
240
|
-
// $inputs.count === 5
|
|
241
|
-
const ctx = { ...mockContext, results: { check: { status: 'success' } } };
|
|
242
|
-
ctx.prevStepId = 'check';
|
|
243
|
-
assertEqual(evaluateCondition('$prev.status === "success"', ctx), true);
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
console.log('\n=== All Tests Complete ===\n');
|