@proofhound/db 0.1.6
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/LICENSE +190 -0
- package/dist/clean-test-residue.d.ts +2 -0
- package/dist/clean-test-residue.d.ts.map +1 -0
- package/dist/clean-test-residue.js +59 -0
- package/dist/clean-test-residue.js.map +1 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +87 -0
- package/dist/client.js.map +1 -0
- package/dist/ensure-e2e-database.d.ts +2 -0
- package/dist/ensure-e2e-database.d.ts.map +1 -0
- package/dist/ensure-e2e-database.js +87 -0
- package/dist/ensure-e2e-database.js.map +1 -0
- package/dist/fixtures/dev/connectors.d.ts +72 -0
- package/dist/fixtures/dev/connectors.d.ts.map +1 -0
- package/dist/fixtures/dev/connectors.js +90 -0
- package/dist/fixtures/dev/connectors.js.map +1 -0
- package/dist/fixtures/dev/experiments.d.ts +48 -0
- package/dist/fixtures/dev/experiments.d.ts.map +1 -0
- package/dist/fixtures/dev/experiments.js +1168 -0
- package/dist/fixtures/dev/experiments.js.map +1 -0
- package/dist/fixtures/dev/models.d.ts +20 -0
- package/dist/fixtures/dev/models.d.ts.map +1 -0
- package/dist/fixtures/dev/models.js +60 -0
- package/dist/fixtures/dev/models.js.map +1 -0
- package/dist/fixtures/dev/optimizations.d.ts +62 -0
- package/dist/fixtures/dev/optimizations.d.ts.map +1 -0
- package/dist/fixtures/dev/optimizations.js +124 -0
- package/dist/fixtures/dev/optimizations.js.map +1 -0
- package/dist/fixtures/dev/prompts.d.ts +31 -0
- package/dist/fixtures/dev/prompts.d.ts.map +1 -0
- package/dist/fixtures/dev/prompts.js +115 -0
- package/dist/fixtures/dev/prompts.js.map +1 -0
- package/dist/fixtures/dev/tokens.d.ts +10 -0
- package/dist/fixtures/dev/tokens.d.ts.map +1 -0
- package/dist/fixtures/dev/tokens.js +28 -0
- package/dist/fixtures/dev/tokens.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/migrate.d.ts +2 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +34 -0
- package/dist/migrate.js.map +1 -0
- package/dist/migrations/0000_woozy_thunderbolt.sql +688 -0
- package/dist/migrations/0001_webhook_token_scope.sql +28 -0
- package/dist/migrations/0002_tokens_table_unify_scope.sql +50 -0
- package/dist/migrations/0003_models_auto_concurrency.sql +4 -0
- package/dist/migrations/0004_webhook_token_attribution.sql +4 -0
- package/dist/migrations/0005_same_thor_girl.sql +34 -0
- package/dist/reset.d.ts +2 -0
- package/dist/reset.d.ts.map +1 -0
- package/dist/reset.js +78 -0
- package/dist/reset.js.map +1 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +23 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/ph_assets/index.d.ts +2012 -0
- package/dist/schema/ph_assets/index.d.ts.map +1 -0
- package/dist/schema/ph_assets/index.js +272 -0
- package/dist/schema/ph_assets/index.js.map +1 -0
- package/dist/schema/ph_core/index.d.ts +424 -0
- package/dist/schema/ph_core/index.d.ts.map +1 -0
- package/dist/schema/ph_core/index.js +69 -0
- package/dist/schema/ph_core/index.js.map +1 -0
- package/dist/schema/ph_releases/_schema.d.ts +2 -0
- package/dist/schema/ph_releases/_schema.d.ts.map +1 -0
- package/dist/schema/ph_releases/_schema.js +8 -0
- package/dist/schema/ph_releases/_schema.js.map +1 -0
- package/dist/schema/ph_releases/annotation-tasks.d.ts +263 -0
- package/dist/schema/ph_releases/annotation-tasks.d.ts.map +1 -0
- package/dist/schema/ph_releases/annotation-tasks.js +38 -0
- package/dist/schema/ph_releases/annotation-tasks.js.map +1 -0
- package/dist/schema/ph_releases/canary-releases.d.ts +672 -0
- package/dist/schema/ph_releases/canary-releases.d.ts.map +1 -0
- package/dist/schema/ph_releases/canary-releases.js +91 -0
- package/dist/schema/ph_releases/canary-releases.js.map +1 -0
- package/dist/schema/ph_releases/index.d.ts +6 -0
- package/dist/schema/ph_releases/index.d.ts.map +1 -0
- package/dist/schema/ph_releases/index.js +24 -0
- package/dist/schema/ph_releases/index.js.map +1 -0
- package/dist/schema/ph_releases/production-release-events.d.ts +527 -0
- package/dist/schema/ph_releases/production-release-events.d.ts.map +1 -0
- package/dist/schema/ph_releases/production-release-events.js +86 -0
- package/dist/schema/ph_releases/production-release-events.js.map +1 -0
- package/dist/schema/ph_releases/release-lines.d.ts +1442 -0
- package/dist/schema/ph_releases/release-lines.d.ts.map +1 -0
- package/dist/schema/ph_releases/release-lines.js +203 -0
- package/dist/schema/ph_releases/release-lines.js.map +1 -0
- package/dist/schema/ph_runs/_schema.d.ts +2 -0
- package/dist/schema/ph_runs/_schema.d.ts.map +1 -0
- package/dist/schema/ph_runs/_schema.js +6 -0
- package/dist/schema/ph_runs/_schema.js.map +1 -0
- package/dist/schema/ph_runs/experiments.d.ts +984 -0
- package/dist/schema/ph_runs/experiments.d.ts.map +1 -0
- package/dist/schema/ph_runs/experiments.js +134 -0
- package/dist/schema/ph_runs/experiments.js.map +1 -0
- package/dist/schema/ph_runs/index.d.ts +1027 -0
- package/dist/schema/ph_runs/index.d.ts.map +1 -0
- package/dist/schema/ph_runs/index.js +135 -0
- package/dist/schema/ph_runs/index.js.map +1 -0
- package/dist/seed-dev.d.ts +2 -0
- package/dist/seed-dev.d.ts.map +1 -0
- package/dist/seed-dev.js +605 -0
- package/dist/seed-dev.js.map +1 -0
- package/dist/seed.d.ts +2 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +13 -0
- package/dist/seed.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 ZiqiXiao
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-test-residue.d.ts","sourceRoot":"","sources":["../src/clean-test-residue.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* One-shot cleanup of DBOS integration test leftovers.
|
|
5
|
+
*
|
|
6
|
+
* Purpose: clean up the dangling `dbos_test_*` schemas left by previously interrupted/crashed vitest runs in one go.
|
|
7
|
+
* After that, setup.ts's beforeAll backstop logic + schema-level isolation ensure new tests no longer dirty the database.
|
|
8
|
+
*
|
|
9
|
+
* Only drops schemas where information_schema.schemata's schema_name LIKE 'dbos_test_%' (DROP CASCADE).
|
|
10
|
+
*
|
|
11
|
+
* Untouched:
|
|
12
|
+
* - The default dbos schema (we cannot distinguish test and production rows by application_id / name)
|
|
13
|
+
* - Any business tables (models/datasets/prompts/...) data
|
|
14
|
+
*
|
|
15
|
+
* Usage: pnpm db:clean-test-residue
|
|
16
|
+
*/
|
|
17
|
+
const node_path_1 = require("node:path");
|
|
18
|
+
const drizzle_orm_1 = require("drizzle-orm");
|
|
19
|
+
const client_1 = require("./client");
|
|
20
|
+
function writeLine(message = '') {
|
|
21
|
+
process.stdout.write(`${message}\n`);
|
|
22
|
+
}
|
|
23
|
+
async function main() {
|
|
24
|
+
try {
|
|
25
|
+
process.loadEnvFile((0, node_path_1.resolve)(process.cwd(), '../../.env'));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// CI / other environments already with env injected
|
|
29
|
+
}
|
|
30
|
+
const databaseUrl = process.env['DATABASE_URL'];
|
|
31
|
+
if (!databaseUrl) {
|
|
32
|
+
console.error('❌ DATABASE_URL is not configured');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const db = (0, client_1.createDbClient)(databaseUrl);
|
|
36
|
+
// DBOS system db leftover schemas
|
|
37
|
+
const rawRows = await db.execute((0, drizzle_orm_1.sql) `
|
|
38
|
+
SELECT schema_name FROM information_schema.schemata WHERE schema_name LIKE 'dbos_test_%'
|
|
39
|
+
`);
|
|
40
|
+
const rows = Array.isArray(rawRows)
|
|
41
|
+
? rawRows
|
|
42
|
+
: (rawRows.rows ?? []);
|
|
43
|
+
const droppedSchemas = [];
|
|
44
|
+
for (const row of rows) {
|
|
45
|
+
await db.execute((0, drizzle_orm_1.sql) `DROP SCHEMA IF EXISTS ${drizzle_orm_1.sql.identifier(row.schema_name)} CASCADE`);
|
|
46
|
+
droppedSchemas.push(row.schema_name);
|
|
47
|
+
}
|
|
48
|
+
writeLine('✅ DBOS integration test leftovers cleaned up');
|
|
49
|
+
writeLine(` • DBOS system schemas (dbos_test_*): ${droppedSchemas.length}`);
|
|
50
|
+
if (droppedSchemas.length > 0) {
|
|
51
|
+
writeLine(` ${droppedSchemas.join(', ')}`);
|
|
52
|
+
}
|
|
53
|
+
process.exit(0);
|
|
54
|
+
}
|
|
55
|
+
main().catch((err) => {
|
|
56
|
+
console.error('❌ Cleanup failed:', err);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=clean-test-residue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-test-residue.js","sourceRoot":"","sources":["../src/clean-test-residue.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;GAaG;AACH,yCAAoC;AACpC,6CAAkC;AAClC,qCAA0C;AAE1C,SAAS,SAAS,CAAC,OAAO,GAAG,EAAE;IAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,OAAO,CAAC,WAAW,CAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,oDAAoD;IACtD,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;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"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC;AAiDjE,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,CAG5D"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.createDbClient = createDbClient;
|
|
40
|
+
const postgres_js_1 = require("drizzle-orm/postgres-js");
|
|
41
|
+
const postgres_1 = __importDefault(require("postgres"));
|
|
42
|
+
const schema = __importStar(require("./schema"));
|
|
43
|
+
function encodeUrlCredentialPart(value) {
|
|
44
|
+
try {
|
|
45
|
+
return encodeURIComponent(decodeURIComponent(value));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return encodeURIComponent(value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function normalizeDatabaseUrl(databaseUrl) {
|
|
52
|
+
const trimmed = databaseUrl.trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
53
|
+
try {
|
|
54
|
+
new URL(trimmed);
|
|
55
|
+
return trimmed;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Fall through and tolerate common unescaped password characters.
|
|
59
|
+
}
|
|
60
|
+
const match = /^(postgres(?:ql)?:\/\/)(.+)$/iu.exec(trimmed);
|
|
61
|
+
if (!match) {
|
|
62
|
+
return trimmed;
|
|
63
|
+
}
|
|
64
|
+
const protocol = match[1];
|
|
65
|
+
const rest = match[2];
|
|
66
|
+
if (!protocol || !rest) {
|
|
67
|
+
return trimmed;
|
|
68
|
+
}
|
|
69
|
+
const atIndex = rest.lastIndexOf('@');
|
|
70
|
+
if (atIndex === -1) {
|
|
71
|
+
return trimmed;
|
|
72
|
+
}
|
|
73
|
+
const credentials = rest.slice(0, atIndex);
|
|
74
|
+
const hostAndPath = rest.slice(atIndex + 1);
|
|
75
|
+
const separatorIndex = credentials.indexOf(':');
|
|
76
|
+
if (separatorIndex === -1) {
|
|
77
|
+
return trimmed;
|
|
78
|
+
}
|
|
79
|
+
const user = credentials.slice(0, separatorIndex);
|
|
80
|
+
const password = credentials.slice(separatorIndex + 1);
|
|
81
|
+
return `${protocol}${encodeUrlCredentialPart(user)}:${encodeUrlCredentialPart(password)}@${hostAndPath}`;
|
|
82
|
+
}
|
|
83
|
+
function createDbClient(databaseUrl) {
|
|
84
|
+
const sql = (0, postgres_1.default)(normalizeDatabaseUrl(databaseUrl));
|
|
85
|
+
return (0, postgres_js_1.drizzle)(sql, { schema });
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,wCAGC;AAxDD,yDAAkD;AAClD,wDAAgC;AAChC,iDAAmC;AAInC,SAAS,uBAAuB,CAAC,KAAa;IAC5C,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,WAAmB;IAC/C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAEnE,IAAI,CAAC;QACH,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACjB,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;IACpE,CAAC;IAED,MAAM,KAAK,GAAG,gCAAgC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AAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-e2e-database.d.ts","sourceRoot":"","sources":["../src/ensure-e2e-database.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const postgres_1 = __importDefault(require("postgres"));
|
|
8
|
+
const DEFAULT_E2E_DATABASE_URL = 'postgres://postgres:postgres@localhost:5432/proofhound_e2e';
|
|
9
|
+
const DEFAULT_ADMIN_DATABASE = 'postgres';
|
|
10
|
+
const LOCAL_HOSTNAMES = new Set(['localhost', '127.0.0.1', '::1']);
|
|
11
|
+
function writeLine(message = '') {
|
|
12
|
+
process.stdout.write(`${message}\n`);
|
|
13
|
+
}
|
|
14
|
+
function loadRootEnv() {
|
|
15
|
+
try {
|
|
16
|
+
process.loadEnvFile((0, node_path_1.resolve)(process.cwd(), '../../.env'));
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// CI / container deployments can provide env vars externally.
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function unwrapEnvValue(value) {
|
|
23
|
+
return value.trim().replace(/^(['"])(.*)\1$/, '$2');
|
|
24
|
+
}
|
|
25
|
+
function parseDatabaseUrl(databaseUrl) {
|
|
26
|
+
const url = new URL(unwrapEnvValue(databaseUrl));
|
|
27
|
+
if (!['postgres:', 'postgresql:'].includes(url.protocol)) {
|
|
28
|
+
throw new Error('E2E_DATABASE_URL_must_use_postgres_protocol');
|
|
29
|
+
}
|
|
30
|
+
if (!url.pathname || url.pathname === '/') {
|
|
31
|
+
throw new Error('E2E_DATABASE_URL_must_include_database_name');
|
|
32
|
+
}
|
|
33
|
+
return url;
|
|
34
|
+
}
|
|
35
|
+
function getDatabaseName(url) {
|
|
36
|
+
return decodeURIComponent(url.pathname.slice(1));
|
|
37
|
+
}
|
|
38
|
+
function isLocalDatabaseHost(url) {
|
|
39
|
+
return LOCAL_HOSTNAMES.has(url.hostname);
|
|
40
|
+
}
|
|
41
|
+
function getAdminDatabaseUrl(targetUrl) {
|
|
42
|
+
const explicitAdminUrl = process.env['E2E_DATABASE_ADMIN_URL'];
|
|
43
|
+
if (explicitAdminUrl)
|
|
44
|
+
return unwrapEnvValue(explicitAdminUrl);
|
|
45
|
+
const adminUrl = new URL(targetUrl.toString());
|
|
46
|
+
adminUrl.pathname = `/${process.env['E2E_DATABASE_ADMIN_DB'] ?? DEFAULT_ADMIN_DATABASE}`;
|
|
47
|
+
return adminUrl.toString();
|
|
48
|
+
}
|
|
49
|
+
function quoteIdentifier(value) {
|
|
50
|
+
return `"${value.replaceAll('"', '""')}"`;
|
|
51
|
+
}
|
|
52
|
+
async function main() {
|
|
53
|
+
loadRootEnv();
|
|
54
|
+
const databaseUrl = process.env['E2E_DATABASE_URL'] ?? DEFAULT_E2E_DATABASE_URL;
|
|
55
|
+
const targetUrl = parseDatabaseUrl(databaseUrl);
|
|
56
|
+
const databaseName = getDatabaseName(targetUrl);
|
|
57
|
+
if (!isLocalDatabaseHost(targetUrl) && process.env['ALLOW_E2E_DB_CREATE'] !== '1') {
|
|
58
|
+
console.error('❌ E2E_DATABASE_URL points to a remote database; refusing to auto-create');
|
|
59
|
+
console.error(' To create a remote e2e database, set ALLOW_E2E_DB_CREATE=1 explicitly');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
const adminUrl = getAdminDatabaseUrl(targetUrl);
|
|
63
|
+
const sql = (0, postgres_1.default)(adminUrl, { max: 1 });
|
|
64
|
+
try {
|
|
65
|
+
const rows = await sql `
|
|
66
|
+
SELECT 1 AS exists
|
|
67
|
+
FROM pg_database
|
|
68
|
+
WHERE datname = ${databaseName}
|
|
69
|
+
LIMIT 1
|
|
70
|
+
`;
|
|
71
|
+
if (rows.length > 0) {
|
|
72
|
+
writeLine(`✅ E2E database already exists: ${databaseName}`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
writeLine(`⏳ Creating E2E database: ${databaseName}`);
|
|
76
|
+
await sql.unsafe(`CREATE DATABASE ${quoteIdentifier(databaseName)}`);
|
|
77
|
+
writeLine(`✅ E2E database created: ${databaseName}`);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
await sql.end({ timeout: 5 });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
main().catch((error) => {
|
|
84
|
+
console.error('❌ Failed to ensure E2E database:', error);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=ensure-e2e-database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-e2e-database.js","sourceRoot":"","sources":["../src/ensure-e2e-database.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,wDAAgC;AAEhC,MAAM,wBAAwB,GAAG,4DAA4D,CAAC;AAC9F,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAC1C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAEnE,SAAS,SAAS,CAAC,OAAO,GAAG,EAAE;IAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,OAAO,CAAC,WAAW,CAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;IAChE,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK,CAAC,IA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,EAAE,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
declare const REDIS_CONNECTION: {
|
|
2
|
+
source: "local_config";
|
|
3
|
+
host: string;
|
|
4
|
+
port: number;
|
|
5
|
+
deploymentType: "standalone";
|
|
6
|
+
};
|
|
7
|
+
declare const KAFKA_CONNECTION: {
|
|
8
|
+
source: "local_config";
|
|
9
|
+
bootstrapBrokers: string[];
|
|
10
|
+
securityProtocol: "PLAINTEXT";
|
|
11
|
+
};
|
|
12
|
+
export type DevConnectorFixture = {
|
|
13
|
+
kind: 'redis-input';
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
config: {
|
|
18
|
+
connection: typeof REDIS_CONNECTION;
|
|
19
|
+
mode: 'list' | 'stream';
|
|
20
|
+
key: string;
|
|
21
|
+
consumerGroup?: string;
|
|
22
|
+
blockMs?: number;
|
|
23
|
+
batchSize?: number;
|
|
24
|
+
};
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'redis-output';
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
config: {
|
|
31
|
+
connection: typeof REDIS_CONNECTION;
|
|
32
|
+
mode: 'list' | 'stream';
|
|
33
|
+
key: string;
|
|
34
|
+
maxLen?: number;
|
|
35
|
+
};
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'kafka-input';
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
config: {
|
|
42
|
+
connection: typeof KAFKA_CONNECTION;
|
|
43
|
+
topic: string;
|
|
44
|
+
consumerGroup: string;
|
|
45
|
+
fromBeginning?: boolean;
|
|
46
|
+
batchSize?: number;
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'kafka-output';
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
config: {
|
|
54
|
+
connection: typeof KAFKA_CONNECTION;
|
|
55
|
+
topic: string;
|
|
56
|
+
partitionKey?: string;
|
|
57
|
+
};
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'webhook-input';
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
webhookPath: string;
|
|
64
|
+
config: {
|
|
65
|
+
webhookMode: 'sync' | 'async';
|
|
66
|
+
timeoutSeconds?: number;
|
|
67
|
+
expectedPayloadSchema?: Record<string, unknown>;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare const DEV_CONNECTORS: DevConnectorFixture[];
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=connectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../../src/fixtures/dev/connectors.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,gBAAgB;;;;;CAKrB,CAAC;AACF,QAAA,MAAM,gBAAgB;;;;CAIrB,CAAC;AAUF,MAAM,MAAM,mBAAmB,GAC3B;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,UAAU,EAAE,OAAO,gBAAgB,CAAC;QACpC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;QACxB,GAAG,EAAE,MAAM,CAAC;QACZ,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,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CAAC,CAAC;KACjD,CAAC;CACH,CAAC;AAEN,eAAO,MAAM,cAAc,EAAE,mBAAmB,EA0D/C,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Local connector fixtures: redis/kafka, each with input + output,
|
|
3
|
+
// plus two webhook input rows (sync + async, distinguished via config.webhookMode; type stays 'webhook').
|
|
4
|
+
// Business term: connector; physical table: ph_assets.connectors. See docs/specs/26-connectors.md.
|
|
5
|
+
//
|
|
6
|
+
// Internally fixtures use a `kind` field as the discriminator (convenient for seed-dev.ts switch); the actual table does not have this column,
|
|
7
|
+
// it is split into direction + type. The `config` shape mirrors the 6 (type, direction) config schemas in packages/shared/src/dto/connector.dto.ts.
|
|
8
|
+
// (no need to re-link)
|
|
9
|
+
//
|
|
10
|
+
// Note: inbound webhook tokens are not attached in this fixture; tokens are reverse-linked to the connector in fixtures/dev/api-tokens.ts via connectorId.
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DEV_CONNECTORS = void 0;
|
|
13
|
+
const REDIS_CONNECTION = {
|
|
14
|
+
source: 'local_config',
|
|
15
|
+
host: 'localhost',
|
|
16
|
+
port: 6379,
|
|
17
|
+
deploymentType: 'standalone',
|
|
18
|
+
};
|
|
19
|
+
const KAFKA_CONNECTION = {
|
|
20
|
+
source: 'local_config',
|
|
21
|
+
bootstrapBrokers: ['localhost:9092'],
|
|
22
|
+
securityProtocol: 'PLAINTEXT',
|
|
23
|
+
};
|
|
24
|
+
const WEBHOOK_INPUT_PAYLOAD_SCHEMA = {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
sample_id: { type: 'string', description: 'Sample ID' },
|
|
28
|
+
text: { type: 'string', description: 'Text content to be processed by the prompt' },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
exports.DEV_CONNECTORS = [
|
|
32
|
+
{
|
|
33
|
+
kind: 'redis-input',
|
|
34
|
+
id: 'aaaaaaaa-aaaa-4aaa-8aaa-000000000001',
|
|
35
|
+
name: 'yelp-polarity-redis-list-in',
|
|
36
|
+
description: 'Redis list input · 50 random Yelp Polarity samples',
|
|
37
|
+
config: { connection: REDIS_CONNECTION, mode: 'list', key: 'datasets:yelp-polarity:random-50' },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
kind: 'redis-output',
|
|
41
|
+
id: 'aaaaaaaa-aaaa-4aaa-8aaa-000000000002',
|
|
42
|
+
name: 'decisions-list-out',
|
|
43
|
+
description: 'Redis list output · decision push',
|
|
44
|
+
config: { connection: REDIS_CONNECTION, mode: 'list', key: 'datasets:yelp-polarity:random-50', maxLen: 100000 },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
kind: 'kafka-input',
|
|
48
|
+
id: 'aaaaaaaa-aaaa-4aaa-8aaa-000000000003',
|
|
49
|
+
name: 'yelp-polarity-kafka-topic-in',
|
|
50
|
+
description: 'Kafka input · 50 random Yelp Polarity samples',
|
|
51
|
+
config: {
|
|
52
|
+
connection: KAFKA_CONNECTION,
|
|
53
|
+
topic: 'datasets.yelp-polarity.random-50',
|
|
54
|
+
consumerGroup: 'yelp-polarity-dev-g1',
|
|
55
|
+
fromBeginning: false,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
kind: 'kafka-output',
|
|
60
|
+
id: 'aaaaaaaa-aaaa-4aaa-8aaa-000000000004',
|
|
61
|
+
name: 'decisions-topic-out',
|
|
62
|
+
description: 'Kafka output · decisions topic',
|
|
63
|
+
config: { connection: KAFKA_CONNECTION, topic: 'risk-decisions', partitionKey: 'orderId' },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
kind: 'webhook-input',
|
|
67
|
+
id: 'aaaaaaaa-aaaa-4aaa-8aaa-000000000005',
|
|
68
|
+
name: 'sync-webhook-in',
|
|
69
|
+
description: 'Webhook input · sync mode (upstream POST waits for the LLM to finish before returning)',
|
|
70
|
+
webhookPath: 'a3a1b2c3-d4e5-4f60-8788-aabbccddeeff',
|
|
71
|
+
config: {
|
|
72
|
+
webhookMode: 'sync',
|
|
73
|
+
timeoutSeconds: 30,
|
|
74
|
+
expectedPayloadSchema: WEBHOOK_INPUT_PAYLOAD_SCHEMA,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
kind: 'webhook-input',
|
|
79
|
+
id: 'aaaaaaaa-aaaa-4aaa-8aaa-000000000006',
|
|
80
|
+
name: 'async-webhook-in',
|
|
81
|
+
description: 'Webhook input · async mode (returns callId immediately; the result is retrieved via the output connector or the query API)',
|
|
82
|
+
webhookPath: 'b4b2c3d4-e5f6-4071-8899-bbccddeeff00',
|
|
83
|
+
config: {
|
|
84
|
+
webhookMode: 'async',
|
|
85
|
+
timeoutSeconds: 120,
|
|
86
|
+
expectedPayloadSchema: WEBHOOK_INPUT_PAYLOAD_SCHEMA,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
//# sourceMappingURL=connectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.js","sourceRoot":"","sources":["../../../src/fixtures/dev/connectors.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,0GAA0G;AAC1G,mGAAmG;AACnG,EAAE;AACF,+IAA+I;AAC/I,oJAAoJ;AACpJ,uBAAuB;AACvB,EAAE;AACF,2JAA2J;;;AAE3J,MAAM,gBAAgB,GAAG;IACvB,MAAM,EAAE,cAAuB;IAC/B,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,YAAqB;CACtC,CAAC;AACF,MAAM,gBAAgB,GAAG;IACvB,MAAM,EAAE,cAAuB;IAC/B,gBAAgB,EAAE,CAAC,gBAAgB,CAAC;IACpC,gBAAgB,EAAE,WAAoB;CACvC,CAAC;AAEF,MAAM,4BAA4B,GAAG;IACnC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,S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