@suss/packs 0.11.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/LICENSE +205 -0
- package/README.md +29 -0
- package/dist/activerecord.d.ts +30 -0
- package/dist/activerecord.js +45 -0
- package/dist/apollo-client.d.ts +1 -0
- package/dist/apollo-client.js +137 -0
- package/dist/apollo.d.ts +1 -0
- package/dist/apollo.js +90 -0
- package/dist/aws-dynamodb.d.ts +1 -0
- package/dist/aws-dynamodb.js +386 -0
- package/dist/aws-eventbridge.d.ts +1 -0
- package/dist/aws-eventbridge.js +240 -0
- package/dist/aws-lambda.d.ts +1 -0
- package/dist/aws-lambda.js +382 -0
- package/dist/aws-s3.d.ts +1 -0
- package/dist/aws-s3.js +120 -0
- package/dist/aws-sqs.d.ts +1 -0
- package/dist/aws-sqs.js +296 -0
- package/dist/axios.d.ts +1 -0
- package/dist/axios.js +107 -0
- package/dist/cloudflare-workers.d.ts +1 -0
- package/dist/cloudflare-workers.js +562 -0
- package/dist/drizzle.d.ts +1 -0
- package/dist/drizzle.js +383 -0
- package/dist/express.d.ts +1 -0
- package/dist/express.js +124 -0
- package/dist/fastapi.d.ts +1 -0
- package/dist/fastapi.js +42 -0
- package/dist/fastify.d.ts +1 -0
- package/dist/fastify.js +116 -0
- package/dist/fetch.d.ts +1 -0
- package/dist/fetch.js +64 -0
- package/dist/flask-restx.d.ts +1 -0
- package/dist/flask-restx.js +59 -0
- package/dist/gcs.d.ts +1 -0
- package/dist/gcs.js +134 -0
- package/dist/graphql-ruby.d.ts +1 -0
- package/dist/graphql-ruby.js +84 -0
- package/dist/hono.d.ts +1 -0
- package/dist/hono.js +184 -0
- package/dist/mongoose.d.ts +1 -0
- package/dist/mongoose.js +379 -0
- package/dist/nestjs-graphql.d.ts +1 -0
- package/dist/nestjs-graphql.js +77 -0
- package/dist/nestjs-rest.d.ts +1 -0
- package/dist/nestjs-rest.js +89 -0
- package/dist/nextjs.d.ts +1 -0
- package/dist/nextjs.js +154 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.js +667 -0
- package/dist/prisma.d.ts +1 -0
- package/dist/prisma.js +448 -0
- package/dist/react-router.d.ts +1 -0
- package/dist/react-router.js +197 -0
- package/dist/react.d.ts +1 -0
- package/dist/react.js +221 -0
- package/dist/redis.d.ts +1 -0
- package/dist/redis.js +93 -0
- package/dist/sqlalchemy.d.ts +1 -0
- package/dist/sqlalchemy.js +48 -0
- package/dist/ts-rest.d.ts +1 -0
- package/dist/ts-rest.js +89 -0
- package/package.json +208 -0
package/dist/react.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
// ../framework/react/dist/index.js
|
|
2
|
+
var STORY_FILE_PATTERN = /\.stories\.tsx?$/;
|
|
3
|
+
var TEST_FILE_PATTERN = /\.(test|spec)\.tsx?$/;
|
|
4
|
+
function startsWithUppercase(name) {
|
|
5
|
+
if (name.length === 0) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const first = name[0];
|
|
9
|
+
return first >= "A" && first <= "Z";
|
|
10
|
+
}
|
|
11
|
+
var reactComponentExports = (sourceFile, ctx) => {
|
|
12
|
+
const sf = sourceFile;
|
|
13
|
+
const tsCtx = ctx;
|
|
14
|
+
const filePath = tsCtx.getFilePath(sf);
|
|
15
|
+
if (STORY_FILE_PATTERN.test(filePath) || TEST_FILE_PATTERN.test(filePath)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const out = [];
|
|
19
|
+
for (const { name, func, isDefault } of tsCtx.exportedFunctions(sf)) {
|
|
20
|
+
if (isDefault) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (!startsWithUppercase(name)) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (!tsCtx.hasJsxReturn(func)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
out.push({
|
|
30
|
+
func,
|
|
31
|
+
kind: "component",
|
|
32
|
+
name
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
};
|
|
37
|
+
var EVENT_HANDLER_INPUT = {
|
|
38
|
+
type: "positionalParams",
|
|
39
|
+
params: [{ position: 0, role: "event" }]
|
|
40
|
+
};
|
|
41
|
+
var USE_EFFECT_INPUT = {
|
|
42
|
+
type: "positionalParams",
|
|
43
|
+
params: []
|
|
44
|
+
};
|
|
45
|
+
function reactSubUnits(parent, ctx) {
|
|
46
|
+
const tsCtx = ctx;
|
|
47
|
+
const parentFunc = parent.func;
|
|
48
|
+
return [
|
|
49
|
+
...synthesizeEventHandlers(parent.name, parentFunc, tsCtx),
|
|
50
|
+
...synthesizeUseEffects(parent.name, parentFunc, tsCtx)
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function isEventHandlerPropName(name) {
|
|
54
|
+
if (name.length < 3) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (name[0] !== "o" || name[1] !== "n") {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const third = name[2];
|
|
61
|
+
return third === third.toUpperCase() && third !== third.toLowerCase();
|
|
62
|
+
}
|
|
63
|
+
function synthesizeEventHandlers(componentName, parentFunc, ctx) {
|
|
64
|
+
const raw = [];
|
|
65
|
+
for (const attr of ctx.findJsxAttributes(parentFunc)) {
|
|
66
|
+
if (!isEventHandlerPropName(attr.name)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const resolved = ctx.resolveAttributeValueFunction(attr, parentFunc);
|
|
70
|
+
if (resolved === null) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
raw.push({
|
|
74
|
+
func: resolved.func,
|
|
75
|
+
tag: attr.tag,
|
|
76
|
+
propName: attr.name,
|
|
77
|
+
localName: resolved.localName
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return disambiguateHandlers(raw, componentName);
|
|
81
|
+
}
|
|
82
|
+
function disambiguateHandlers(raw, componentName) {
|
|
83
|
+
const anonCounts = /* @__PURE__ */ new Map();
|
|
84
|
+
for (const m of raw) {
|
|
85
|
+
if (m.localName !== null) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const key = `${m.tag}.${m.propName}`;
|
|
89
|
+
anonCounts.set(key, (anonCounts.get(key) ?? 0) + 1);
|
|
90
|
+
}
|
|
91
|
+
const anonSeen = /* @__PURE__ */ new Map();
|
|
92
|
+
return raw.map((m) => {
|
|
93
|
+
const name = handlerUnitName(m, componentName, anonCounts, anonSeen);
|
|
94
|
+
return {
|
|
95
|
+
func: m.func,
|
|
96
|
+
kind: "handler",
|
|
97
|
+
name,
|
|
98
|
+
inputMapping: EVENT_HANDLER_INPUT,
|
|
99
|
+
// The element and prop a handler hangs off already shape the
|
|
100
|
+
// summary name; no reader consumes them as metadata (#462).
|
|
101
|
+
metadata: {
|
|
102
|
+
react: {
|
|
103
|
+
kind: "handler",
|
|
104
|
+
component: componentName
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function handlerUnitName(m, componentName, anonCounts, anonSeen) {
|
|
111
|
+
if (m.localName !== null) {
|
|
112
|
+
return `${componentName}.${m.localName}`;
|
|
113
|
+
}
|
|
114
|
+
const key = `${m.tag}.${m.propName}`;
|
|
115
|
+
const total = anonCounts.get(key) ?? 1;
|
|
116
|
+
if (total <= 1) {
|
|
117
|
+
return `${componentName}.${m.tag}.${m.propName}`;
|
|
118
|
+
}
|
|
119
|
+
const idx = anonSeen.get(key) ?? 0;
|
|
120
|
+
anonSeen.set(key, idx + 1);
|
|
121
|
+
return `${componentName}.${m.tag}.${m.propName}#${idx}`;
|
|
122
|
+
}
|
|
123
|
+
function synthesizeUseEffects(componentName, parentFunc, ctx) {
|
|
124
|
+
const out = [];
|
|
125
|
+
let index = 0;
|
|
126
|
+
for (const call of ctx.findCallExpressionsByName(parentFunc, "useEffect")) {
|
|
127
|
+
const body = ctx.getCallArgumentFunction(call, 0);
|
|
128
|
+
if (body === null) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const depsArg = ctx.getCallArgument(call, 1);
|
|
132
|
+
const deps = ctx.readArrayLiteralText(depsArg);
|
|
133
|
+
out.push({
|
|
134
|
+
func: body,
|
|
135
|
+
kind: "handler",
|
|
136
|
+
name: `${componentName}.effect#${index}`,
|
|
137
|
+
inputMapping: USE_EFFECT_INPUT,
|
|
138
|
+
metadata: {
|
|
139
|
+
react: {
|
|
140
|
+
kind: "effect",
|
|
141
|
+
component: componentName,
|
|
142
|
+
index,
|
|
143
|
+
// `null` deps means the second argument was absent
|
|
144
|
+
// (re-runs every render); `[]` means mount-only.
|
|
145
|
+
deps
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
index += 1;
|
|
150
|
+
}
|
|
151
|
+
return out;
|
|
152
|
+
}
|
|
153
|
+
function reactFramework() {
|
|
154
|
+
return {
|
|
155
|
+
name: "react",
|
|
156
|
+
languages: ["typescript", "javascript"],
|
|
157
|
+
// React doesn't have its own wire protocol: it's a framework
|
|
158
|
+
// running inside a JS runtime, and its boundaries
|
|
159
|
+
// (component ↔ DOM, render ↔ handler, etc.) don't cross a
|
|
160
|
+
// network hop. `"in-process"` is the name for that transport class and
|
|
161
|
+
// will be shared with future in-process packs (custom hooks,
|
|
162
|
+
// module-internal cross-unit work). Framework identity stays on
|
|
163
|
+
// `BoundaryBinding.framework` = "react": that's what
|
|
164
|
+
// distinguishes React-rendered boundaries from, say, a Preact
|
|
165
|
+
// pack or an arbitrary TS function-call boundary.
|
|
166
|
+
protocol: "in-process",
|
|
167
|
+
discovery: [
|
|
168
|
+
{
|
|
169
|
+
kind: "component",
|
|
170
|
+
match: { type: "namedExport", names: ["default"] },
|
|
171
|
+
// Empty gate: under the current JSX runtime, a file can export a
|
|
172
|
+
// component with no explicit `react` import at all. The named-export
|
|
173
|
+
// walk only looks at default exports, so paying for the dispatch on
|
|
174
|
+
// every file is better than missing those files.
|
|
175
|
+
requiresImport: []
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
terminals: [
|
|
179
|
+
{
|
|
180
|
+
// A return statement whose value is a JSX element or fragment.
|
|
181
|
+
// Captures the root element/component name as the render
|
|
182
|
+
// output's identity.
|
|
183
|
+
kind: "render",
|
|
184
|
+
match: { type: "jsxReturn" },
|
|
185
|
+
extraction: {}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
// `return null` (or anything non-JSX) in a component function
|
|
189
|
+
// is React's way of rendering nothing. Classify as a `return`
|
|
190
|
+
// terminal with a null value; the branching infrastructure
|
|
191
|
+
// picks up the guarding condition.
|
|
192
|
+
kind: "return",
|
|
193
|
+
match: { type: "returnStatement" },
|
|
194
|
+
extraction: {}
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
// Components can throw: error boundaries up the tree handle
|
|
198
|
+
// it. Record the thrown type so cross-boundary checks have a
|
|
199
|
+
// signal without resolving the specific exception.
|
|
200
|
+
kind: "throw",
|
|
201
|
+
match: { type: "throwExpression" },
|
|
202
|
+
extraction: {}
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
inputMapping: {
|
|
206
|
+
// The first positional parameter is conventionally the props
|
|
207
|
+
// object. When it's destructured (`function X({user, onDelete}: Props)`)
|
|
208
|
+
// each name becomes its own Input with role = the prop name;
|
|
209
|
+
// when not (`function X(props)`), one whole-object Input gets
|
|
210
|
+
// role "props". See `componentProps` in @suss/extractor.
|
|
211
|
+
type: "componentProps",
|
|
212
|
+
paramPosition: 0
|
|
213
|
+
},
|
|
214
|
+
subUnits: reactSubUnits,
|
|
215
|
+
discoverUnits: reactComponentExports
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
var index_default = reactFramework;
|
|
219
|
+
export {
|
|
220
|
+
index_default as default
|
|
221
|
+
};
|
package/dist/redis.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@suss/framework-redis';
|
package/dist/redis.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// ../framework/redis/dist/index.js
|
|
2
|
+
import { declaredBy, pack, storageCalls } from "@suss/recognize";
|
|
3
|
+
var CLIENT_MODULES = ["ioredis", "redis", "iovalkey"];
|
|
4
|
+
var READ_KEY = { kind: "read", selector: { at: 0 } };
|
|
5
|
+
var WRITE_KEY = { kind: "write", selector: { at: 0 } };
|
|
6
|
+
var READ_KEYS = { kind: "read", selector: { from: 0 } };
|
|
7
|
+
var WRITE_KEYS = { kind: "write", selector: { from: 0 } };
|
|
8
|
+
var READ_FIELD = {
|
|
9
|
+
kind: "read",
|
|
10
|
+
selector: { at: 0 },
|
|
11
|
+
fields: { at: 1 }
|
|
12
|
+
};
|
|
13
|
+
var WRITE_FIELD = {
|
|
14
|
+
kind: "write",
|
|
15
|
+
selector: { at: 0 },
|
|
16
|
+
fields: { at: 1 }
|
|
17
|
+
};
|
|
18
|
+
var COMMANDS = {
|
|
19
|
+
get: READ_KEY,
|
|
20
|
+
getdel: WRITE_KEY,
|
|
21
|
+
mget: READ_KEYS,
|
|
22
|
+
exists: READ_KEY,
|
|
23
|
+
ttl: READ_KEY,
|
|
24
|
+
strlen: READ_KEY,
|
|
25
|
+
set: WRITE_KEY,
|
|
26
|
+
setex: WRITE_KEY,
|
|
27
|
+
setnx: WRITE_KEY,
|
|
28
|
+
psetex: WRITE_KEY,
|
|
29
|
+
append: WRITE_KEY,
|
|
30
|
+
incr: WRITE_KEY,
|
|
31
|
+
incrby: WRITE_KEY,
|
|
32
|
+
decr: WRITE_KEY,
|
|
33
|
+
decrby: WRITE_KEY,
|
|
34
|
+
del: WRITE_KEYS,
|
|
35
|
+
unlink: WRITE_KEYS,
|
|
36
|
+
expire: WRITE_KEY,
|
|
37
|
+
expireat: WRITE_KEY,
|
|
38
|
+
persist: WRITE_KEY,
|
|
39
|
+
rename: WRITE_KEY,
|
|
40
|
+
hget: READ_FIELD,
|
|
41
|
+
hmget: READ_FIELD,
|
|
42
|
+
hgetall: READ_KEY,
|
|
43
|
+
hexists: READ_FIELD,
|
|
44
|
+
hset: WRITE_FIELD,
|
|
45
|
+
hmset: WRITE_FIELD,
|
|
46
|
+
hsetnx: WRITE_FIELD,
|
|
47
|
+
hincrby: WRITE_FIELD,
|
|
48
|
+
hdel: WRITE_FIELD,
|
|
49
|
+
sadd: WRITE_KEY,
|
|
50
|
+
srem: WRITE_KEY,
|
|
51
|
+
smembers: READ_KEY,
|
|
52
|
+
sismember: READ_KEY,
|
|
53
|
+
scard: READ_KEY,
|
|
54
|
+
zadd: WRITE_KEY,
|
|
55
|
+
zrem: WRITE_KEY,
|
|
56
|
+
zscore: READ_KEY,
|
|
57
|
+
zrange: READ_KEY,
|
|
58
|
+
zrevrange: READ_KEY,
|
|
59
|
+
zrangebyscore: READ_KEY,
|
|
60
|
+
zcard: READ_KEY,
|
|
61
|
+
lpush: WRITE_KEY,
|
|
62
|
+
rpush: WRITE_KEY,
|
|
63
|
+
lpop: WRITE_KEY,
|
|
64
|
+
rpop: WRITE_KEY,
|
|
65
|
+
lrange: READ_KEY,
|
|
66
|
+
llen: READ_KEY,
|
|
67
|
+
lrem: WRITE_KEY
|
|
68
|
+
};
|
|
69
|
+
var NAMESPACE_SEPARATOR = ":";
|
|
70
|
+
function namespaceOf(keys) {
|
|
71
|
+
const namespaces = new Set(
|
|
72
|
+
keys.map((key) => key.split(NAMESPACE_SEPARATOR)[0] ?? key)
|
|
73
|
+
);
|
|
74
|
+
if (namespaces.size !== 1) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const [only] = [...namespaces];
|
|
78
|
+
return only === void 0 || only.includes("{") ? null : only;
|
|
79
|
+
}
|
|
80
|
+
var COMMAND_CALLS = storageCalls({
|
|
81
|
+
system: "redis",
|
|
82
|
+
client: declaredBy(...CLIENT_MODULES)
|
|
83
|
+
}).methods(COMMANDS, { ignoringCase: true }).container(namespaceOf).example('redis.get("user_online:42")');
|
|
84
|
+
function redisFramework() {
|
|
85
|
+
return pack("redis", [COMMAND_CALLS], {
|
|
86
|
+
languages: ["typescript", "javascript"],
|
|
87
|
+
recognizedAs: "@suss/framework-redis"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
var index_default = redisFramework;
|
|
91
|
+
export {
|
|
92
|
+
index_default as default
|
|
93
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@suss/framework-sqlalchemy';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// ../framework/sqlalchemy/dist/index.js
|
|
2
|
+
function sqlalchemyStorage(options) {
|
|
3
|
+
return [
|
|
4
|
+
{
|
|
5
|
+
module: "sqlalchemy.orm",
|
|
6
|
+
queryTypes: ["Query", "Session"],
|
|
7
|
+
writes: ["update", "delete", "add", "add_all", "merge", "commit"],
|
|
8
|
+
storageSystem: options.storageSystem
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
module: "sqlalchemy",
|
|
12
|
+
queryTypes: ["Select", "Update", "Delete", "Insert"],
|
|
13
|
+
writes: ["update", "delete", "insert", "commit"],
|
|
14
|
+
// 2.0 style writes `select(User.id).where(...)`, importing the
|
|
15
|
+
// constructor rather than reaching it through a mapped class, so there
|
|
16
|
+
// is no project method in between whose return says what it is.
|
|
17
|
+
queryFunctions: ["select", "insert", "update", "delete"],
|
|
18
|
+
storageSystem: options.storageSystem
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
function sqlalchemyRawSql(options) {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
module: "sqlalchemy",
|
|
26
|
+
functions: ["text"],
|
|
27
|
+
storageSystem: options.storageSystem
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
function sqlalchemyFramework(options) {
|
|
32
|
+
if (typeof options?.storageSystem !== "string") {
|
|
33
|
+
throw new Error(
|
|
34
|
+
"it needs `storageSystem`, which database is behind the engine: postgresql, mysql, or sqlite. SQLAlchemy talks to all of them and the connection URL settles which, so the pack cannot."
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
name: "sqlalchemy",
|
|
39
|
+
protocol: options.storageSystem,
|
|
40
|
+
discovery: [],
|
|
41
|
+
storage: sqlalchemyStorage(options),
|
|
42
|
+
rawSql: sqlalchemyRawSql(options)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var index_default = sqlalchemyFramework;
|
|
46
|
+
export {
|
|
47
|
+
index_default as default
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@suss/framework-ts-rest';
|
package/dist/ts-rest.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// ../framework/ts-rest/dist/index.js
|
|
2
|
+
function tsRestFramework() {
|
|
3
|
+
return {
|
|
4
|
+
name: "ts-rest",
|
|
5
|
+
protocol: "http",
|
|
6
|
+
languages: ["typescript"],
|
|
7
|
+
discovery: [
|
|
8
|
+
{
|
|
9
|
+
kind: "handler",
|
|
10
|
+
match: {
|
|
11
|
+
type: "registrationCall",
|
|
12
|
+
importModule: "@ts-rest/express",
|
|
13
|
+
importName: "initServer",
|
|
14
|
+
registrationChain: [".router"]
|
|
15
|
+
},
|
|
16
|
+
bindingExtraction: {
|
|
17
|
+
method: { type: "fromContract" },
|
|
18
|
+
path: { type: "fromContract" }
|
|
19
|
+
},
|
|
20
|
+
// Pre-filter to ts-rest server callers. The `@ts-rest/`
|
|
21
|
+
// prefix sweeps any of the framework's adapters in one
|
|
22
|
+
// go (`@ts-rest/express` / `@ts-rest/fastify` /
|
|
23
|
+
// `@ts-rest/nest` / etc.).
|
|
24
|
+
requiresImport: ["@ts-rest"]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
kind: "client",
|
|
28
|
+
match: {
|
|
29
|
+
type: "clientCall",
|
|
30
|
+
importModule: "@ts-rest/core",
|
|
31
|
+
importName: "initClient"
|
|
32
|
+
},
|
|
33
|
+
bindingExtraction: {
|
|
34
|
+
method: { type: "fromClientMethod" },
|
|
35
|
+
path: { type: "fromClientMethod" }
|
|
36
|
+
},
|
|
37
|
+
requiresImport: ["@ts-rest"]
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
terminals: [
|
|
41
|
+
{
|
|
42
|
+
// ts-rest handlers return { status: N, body: ... }
|
|
43
|
+
kind: "response",
|
|
44
|
+
match: {
|
|
45
|
+
type: "returnShape",
|
|
46
|
+
requiredProperties: ["status", "body"]
|
|
47
|
+
},
|
|
48
|
+
extraction: {
|
|
49
|
+
statusCode: { from: "property", name: "status" },
|
|
50
|
+
body: { from: "property", name: "body" }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
// A consumer of a ts-rest client finishes the way any function
|
|
54
|
+
// does, by returning or throwing. Without these two it matches
|
|
55
|
+
// no terminal at all and its summary says nothing.
|
|
56
|
+
{ kind: "return", match: { type: "returnStatement" }, extraction: {} },
|
|
57
|
+
{ kind: "throw", match: { type: "throwExpression" }, extraction: {} }
|
|
58
|
+
],
|
|
59
|
+
contractReading: {
|
|
60
|
+
discovery: {
|
|
61
|
+
importModule: "@ts-rest/core",
|
|
62
|
+
importName: "initContract",
|
|
63
|
+
registrationChain: [".router"]
|
|
64
|
+
},
|
|
65
|
+
responseExtraction: { property: "responses" },
|
|
66
|
+
methodProperty: "method",
|
|
67
|
+
pathProperty: "path",
|
|
68
|
+
paramsExtraction: { property: "pathParams" }
|
|
69
|
+
},
|
|
70
|
+
inputMapping: {
|
|
71
|
+
type: "destructuredObject",
|
|
72
|
+
knownProperties: {
|
|
73
|
+
params: "pathParams",
|
|
74
|
+
body: "requestBody",
|
|
75
|
+
query: "queryParams",
|
|
76
|
+
headers: "headers"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
responseSemantics: [
|
|
80
|
+
{ name: "status", access: "property", semantics: { type: "statusCode" } },
|
|
81
|
+
{ name: "body", access: "property", semantics: { type: "body" } },
|
|
82
|
+
{ name: "headers", access: "property", semantics: { type: "headers" } }
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
var index_default = tsRestFramework;
|
|
87
|
+
export {
|
|
88
|
+
index_default as default
|
|
89
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@suss/packs",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Every pack suss ships, as one package with a subpath per pack.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"suss",
|
|
8
|
+
"behavioral-summary",
|
|
9
|
+
"packs"
|
|
10
|
+
],
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"author": "Nimbus Cloud AI LLC",
|
|
13
|
+
"homepage": "https://github.com/nimbuscloud-ai/suss/tree/main/packages/packs#readme",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/nimbuscloud-ai/suss.git",
|
|
17
|
+
"directory": "packages/packs"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/nimbuscloud-ai/suss/issues"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
"./activerecord": {
|
|
24
|
+
"types": "./dist/activerecord.d.ts",
|
|
25
|
+
"import": "./dist/activerecord.js"
|
|
26
|
+
},
|
|
27
|
+
"./apollo": {
|
|
28
|
+
"types": "./dist/apollo.d.ts",
|
|
29
|
+
"import": "./dist/apollo.js"
|
|
30
|
+
},
|
|
31
|
+
"./apollo-client": {
|
|
32
|
+
"types": "./dist/apollo-client.d.ts",
|
|
33
|
+
"import": "./dist/apollo-client.js"
|
|
34
|
+
},
|
|
35
|
+
"./aws-dynamodb": {
|
|
36
|
+
"types": "./dist/aws-dynamodb.d.ts",
|
|
37
|
+
"import": "./dist/aws-dynamodb.js"
|
|
38
|
+
},
|
|
39
|
+
"./aws-eventbridge": {
|
|
40
|
+
"types": "./dist/aws-eventbridge.d.ts",
|
|
41
|
+
"import": "./dist/aws-eventbridge.js"
|
|
42
|
+
},
|
|
43
|
+
"./aws-lambda": {
|
|
44
|
+
"types": "./dist/aws-lambda.d.ts",
|
|
45
|
+
"import": "./dist/aws-lambda.js"
|
|
46
|
+
},
|
|
47
|
+
"./aws-s3": {
|
|
48
|
+
"types": "./dist/aws-s3.d.ts",
|
|
49
|
+
"import": "./dist/aws-s3.js"
|
|
50
|
+
},
|
|
51
|
+
"./aws-sqs": {
|
|
52
|
+
"types": "./dist/aws-sqs.d.ts",
|
|
53
|
+
"import": "./dist/aws-sqs.js"
|
|
54
|
+
},
|
|
55
|
+
"./axios": {
|
|
56
|
+
"types": "./dist/axios.d.ts",
|
|
57
|
+
"import": "./dist/axios.js"
|
|
58
|
+
},
|
|
59
|
+
"./cloudflare-workers": {
|
|
60
|
+
"types": "./dist/cloudflare-workers.d.ts",
|
|
61
|
+
"import": "./dist/cloudflare-workers.js"
|
|
62
|
+
},
|
|
63
|
+
"./drizzle": {
|
|
64
|
+
"types": "./dist/drizzle.d.ts",
|
|
65
|
+
"import": "./dist/drizzle.js"
|
|
66
|
+
},
|
|
67
|
+
"./express": {
|
|
68
|
+
"types": "./dist/express.d.ts",
|
|
69
|
+
"import": "./dist/express.js"
|
|
70
|
+
},
|
|
71
|
+
"./fastapi": {
|
|
72
|
+
"types": "./dist/fastapi.d.ts",
|
|
73
|
+
"import": "./dist/fastapi.js"
|
|
74
|
+
},
|
|
75
|
+
"./fastify": {
|
|
76
|
+
"types": "./dist/fastify.d.ts",
|
|
77
|
+
"import": "./dist/fastify.js"
|
|
78
|
+
},
|
|
79
|
+
"./fetch": {
|
|
80
|
+
"types": "./dist/fetch.d.ts",
|
|
81
|
+
"import": "./dist/fetch.js"
|
|
82
|
+
},
|
|
83
|
+
"./flask-restx": {
|
|
84
|
+
"types": "./dist/flask-restx.d.ts",
|
|
85
|
+
"import": "./dist/flask-restx.js"
|
|
86
|
+
},
|
|
87
|
+
"./gcs": {
|
|
88
|
+
"types": "./dist/gcs.d.ts",
|
|
89
|
+
"import": "./dist/gcs.js"
|
|
90
|
+
},
|
|
91
|
+
"./graphql-ruby": {
|
|
92
|
+
"types": "./dist/graphql-ruby.d.ts",
|
|
93
|
+
"import": "./dist/graphql-ruby.js"
|
|
94
|
+
},
|
|
95
|
+
"./hono": {
|
|
96
|
+
"types": "./dist/hono.d.ts",
|
|
97
|
+
"import": "./dist/hono.js"
|
|
98
|
+
},
|
|
99
|
+
"./mongoose": {
|
|
100
|
+
"types": "./dist/mongoose.d.ts",
|
|
101
|
+
"import": "./dist/mongoose.js"
|
|
102
|
+
},
|
|
103
|
+
"./nestjs-graphql": {
|
|
104
|
+
"types": "./dist/nestjs-graphql.d.ts",
|
|
105
|
+
"import": "./dist/nestjs-graphql.js"
|
|
106
|
+
},
|
|
107
|
+
"./nestjs-rest": {
|
|
108
|
+
"types": "./dist/nestjs-rest.d.ts",
|
|
109
|
+
"import": "./dist/nestjs-rest.js"
|
|
110
|
+
},
|
|
111
|
+
"./nextjs": {
|
|
112
|
+
"types": "./dist/nextjs.d.ts",
|
|
113
|
+
"import": "./dist/nextjs.js"
|
|
114
|
+
},
|
|
115
|
+
"./node": {
|
|
116
|
+
"types": "./dist/node.d.ts",
|
|
117
|
+
"import": "./dist/node.js"
|
|
118
|
+
},
|
|
119
|
+
"./prisma": {
|
|
120
|
+
"types": "./dist/prisma.d.ts",
|
|
121
|
+
"import": "./dist/prisma.js"
|
|
122
|
+
},
|
|
123
|
+
"./react": {
|
|
124
|
+
"types": "./dist/react.d.ts",
|
|
125
|
+
"import": "./dist/react.js"
|
|
126
|
+
},
|
|
127
|
+
"./react-router": {
|
|
128
|
+
"types": "./dist/react-router.d.ts",
|
|
129
|
+
"import": "./dist/react-router.js"
|
|
130
|
+
},
|
|
131
|
+
"./redis": {
|
|
132
|
+
"types": "./dist/redis.d.ts",
|
|
133
|
+
"import": "./dist/redis.js"
|
|
134
|
+
},
|
|
135
|
+
"./sqlalchemy": {
|
|
136
|
+
"types": "./dist/sqlalchemy.d.ts",
|
|
137
|
+
"import": "./dist/sqlalchemy.js"
|
|
138
|
+
},
|
|
139
|
+
"./ts-rest": {
|
|
140
|
+
"types": "./dist/ts-rest.d.ts",
|
|
141
|
+
"import": "./dist/ts-rest.js"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"files": [
|
|
145
|
+
"dist",
|
|
146
|
+
"README.md",
|
|
147
|
+
"LICENSE"
|
|
148
|
+
],
|
|
149
|
+
"scripts": {
|
|
150
|
+
"build": "tsup",
|
|
151
|
+
"test": "vitest run --passWithNoTests",
|
|
152
|
+
"lint": "biome check .",
|
|
153
|
+
"lint:fix": "biome check --write .",
|
|
154
|
+
"typecheck": "tsc --noEmit"
|
|
155
|
+
},
|
|
156
|
+
"peerDependencies": {
|
|
157
|
+
"ts-morph": "^23.0.0"
|
|
158
|
+
},
|
|
159
|
+
"dependencies": {
|
|
160
|
+
"@suss/adapter-python": "0.11.0",
|
|
161
|
+
"@suss/adapter-ruby": "0.11.0",
|
|
162
|
+
"@suss/adapter-typescript": "0.11.0",
|
|
163
|
+
"@suss/behavioral-ir": "0.11.0",
|
|
164
|
+
"@suss/contract-graphql": "0.11.0",
|
|
165
|
+
"@suss/extractor": "0.11.0",
|
|
166
|
+
"@suss/manifest-aws": "0.11.0",
|
|
167
|
+
"@suss/recognize": "0.11.0",
|
|
168
|
+
"@suss/sql": "0.11.0"
|
|
169
|
+
},
|
|
170
|
+
"devDependencies": {
|
|
171
|
+
"@suss/client-apollo": "*",
|
|
172
|
+
"@suss/client-axios": "*",
|
|
173
|
+
"@suss/client-web": "*",
|
|
174
|
+
"@suss/framework-activerecord": "*",
|
|
175
|
+
"@suss/framework-apollo": "*",
|
|
176
|
+
"@suss/framework-aws-dynamodb": "*",
|
|
177
|
+
"@suss/framework-aws-eventbridge": "*",
|
|
178
|
+
"@suss/framework-aws-lambda": "*",
|
|
179
|
+
"@suss/framework-aws-s3": "*",
|
|
180
|
+
"@suss/framework-aws-sqs": "*",
|
|
181
|
+
"@suss/framework-cloudflare-workers": "*",
|
|
182
|
+
"@suss/framework-drizzle": "*",
|
|
183
|
+
"@suss/framework-express": "*",
|
|
184
|
+
"@suss/framework-fastapi": "*",
|
|
185
|
+
"@suss/framework-fastify": "*",
|
|
186
|
+
"@suss/framework-flask-restx": "*",
|
|
187
|
+
"@suss/framework-gcs": "*",
|
|
188
|
+
"@suss/framework-graphql-ruby": "*",
|
|
189
|
+
"@suss/framework-hono": "*",
|
|
190
|
+
"@suss/framework-mongoose": "*",
|
|
191
|
+
"@suss/framework-nestjs-graphql": "*",
|
|
192
|
+
"@suss/framework-nestjs-rest": "*",
|
|
193
|
+
"@suss/framework-nextjs": "*",
|
|
194
|
+
"@suss/framework-prisma": "*",
|
|
195
|
+
"@suss/framework-react": "*",
|
|
196
|
+
"@suss/framework-react-router": "*",
|
|
197
|
+
"@suss/framework-redis": "*",
|
|
198
|
+
"@suss/framework-sqlalchemy": "*",
|
|
199
|
+
"@suss/framework-ts-rest": "*",
|
|
200
|
+
"@suss/runtime-node": "*",
|
|
201
|
+
"tsup": "*",
|
|
202
|
+
"typescript": "*",
|
|
203
|
+
"vitest": "*"
|
|
204
|
+
},
|
|
205
|
+
"publishConfig": {
|
|
206
|
+
"access": "public"
|
|
207
|
+
}
|
|
208
|
+
}
|