@suss/packs 0.16.0 → 0.17.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/dist/activerecord.d.ts +1 -0
- package/dist/activerecord.js +2 -0
- package/dist/apollo-client.js +2 -0
- package/dist/apollo.js +2 -0
- package/dist/aws-dynamodb.js +2 -0
- package/dist/aws-eventbridge.js +2 -0
- package/dist/aws-lambda.js +2 -0
- package/dist/aws-s3.js +2 -0
- package/dist/aws-sqs.js +2 -0
- package/dist/axios.js +2 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/cloudflare-workers.js +2 -0
- package/dist/drizzle.js +2 -0
- package/dist/express.js +2 -0
- package/dist/fastapi.js +2 -0
- package/dist/fastify.js +2 -0
- package/dist/fetch.js +2 -0
- package/dist/flask-restx.js +2 -0
- package/dist/gcs.js +2 -0
- package/dist/graphql-ruby.js +2 -0
- package/dist/hono.js +2 -0
- package/dist/mongoose.js +2 -0
- package/dist/nestjs-graphql.js +2 -0
- package/dist/nestjs-microservices.js +2 -0
- package/dist/nestjs-rest.js +2 -0
- package/dist/nextjs.js +268558 -0
- package/dist/node.js +2 -0
- package/dist/package-exports.js +2 -0
- package/dist/prisma.js +2 -0
- package/dist/react-query.d.ts +1 -0
- package/dist/react-query.js +143 -0
- package/dist/react-router.js +2 -0
- package/dist/react.js +2 -0
- package/dist/redis.js +2 -0
- package/dist/sqlalchemy.js +2 -0
- package/dist/ts-rest.js +2 -0
- package/package.json +15 -10
package/dist/node.js
CHANGED
package/dist/package-exports.js
CHANGED
package/dist/prisma.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@suss/framework-react-query';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import "./chunk-3RG5ZIWI.js";
|
|
2
|
+
|
|
3
|
+
// ../framework/react-query/dist/index.js
|
|
4
|
+
import { Node } from "ts-morph";
|
|
5
|
+
import { functionCallBinding } from "@suss/behavioral-ir";
|
|
6
|
+
var QUERY_MODULES = ["@tanstack/react-query", "react-query"];
|
|
7
|
+
var HOOK_CALLBACK_PROPERTY = {
|
|
8
|
+
useQuery: "queryFn",
|
|
9
|
+
useSuspenseQuery: "queryFn",
|
|
10
|
+
useInfiniteQuery: "queryFn",
|
|
11
|
+
useSuspenseInfiniteQuery: "queryFn",
|
|
12
|
+
useMutation: "mutationFn"
|
|
13
|
+
};
|
|
14
|
+
function importedHooksOf(sourceFile) {
|
|
15
|
+
const hooks = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const decl of sourceFile.getImportDeclarations()) {
|
|
17
|
+
if (!QUERY_MODULES.includes(decl.getModuleSpecifierValue())) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
for (const named of decl.getNamedImports()) {
|
|
21
|
+
const name = named.getName();
|
|
22
|
+
if (name in HOOK_CALLBACK_PROPERTY) {
|
|
23
|
+
hooks.set(named.getAliasNode()?.getText() ?? name, name);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return hooks;
|
|
28
|
+
}
|
|
29
|
+
function hookOf(call) {
|
|
30
|
+
const callee = call.getExpression();
|
|
31
|
+
if (!Node.isIdentifier(callee)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const local = callee.getText();
|
|
35
|
+
const hook = importedHooksOf(call.getSourceFile()).get(local);
|
|
36
|
+
return hook === void 0 ? null : { local, hook };
|
|
37
|
+
}
|
|
38
|
+
function callbackExpressionOf(call, hook) {
|
|
39
|
+
const property = HOOK_CALLBACK_PROPERTY[hook];
|
|
40
|
+
for (const arg of call.getArguments()) {
|
|
41
|
+
if (Node.isObjectLiteralExpression(arg)) {
|
|
42
|
+
const prop = arg.getProperty(property);
|
|
43
|
+
if (prop !== void 0 && Node.isPropertyAssignment(prop)) {
|
|
44
|
+
return prop.getInitializer() ?? null;
|
|
45
|
+
}
|
|
46
|
+
if (prop !== void 0 && Node.isShorthandPropertyAssignment(prop)) {
|
|
47
|
+
return prop.getNameNode();
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (Node.isArrowFunction(arg) || Node.isFunctionExpression(arg) || Node.isIdentifier(arg)) {
|
|
52
|
+
if (call.getArguments().indexOf(arg) > 0 || hook === "useMutation") {
|
|
53
|
+
return arg;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
function callbackRefOf(expression) {
|
|
60
|
+
if (expression === null) {
|
|
61
|
+
return { type: "opaque", reason: "missing-query-function" };
|
|
62
|
+
}
|
|
63
|
+
if (Node.isArrowFunction(expression) || Node.isFunctionExpression(expression)) {
|
|
64
|
+
return { type: "literal" };
|
|
65
|
+
}
|
|
66
|
+
if (Node.isIdentifier(expression)) {
|
|
67
|
+
return { type: "identifier", name: expression.getText() };
|
|
68
|
+
}
|
|
69
|
+
return { type: "opaque", reason: "non-literal-query-function" };
|
|
70
|
+
}
|
|
71
|
+
var queryHookRecognizer = (call, _ctx) => {
|
|
72
|
+
const c = call;
|
|
73
|
+
if (!Node.isCallExpression(c)) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const found = hookOf(c);
|
|
77
|
+
if (found === null) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const effect = {
|
|
81
|
+
type: "interaction",
|
|
82
|
+
binding: functionCallBinding({
|
|
83
|
+
transport: "in-process",
|
|
84
|
+
recognition: "react-query"
|
|
85
|
+
}),
|
|
86
|
+
callee: found.local,
|
|
87
|
+
interaction: {
|
|
88
|
+
class: "schedule",
|
|
89
|
+
via: found.local,
|
|
90
|
+
callbackRef: callbackRefOf(callbackExpressionOf(c, found.hook)),
|
|
91
|
+
hasDelay: false
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return [effect];
|
|
95
|
+
};
|
|
96
|
+
function reactQuerySubUnits(parent, _ctx) {
|
|
97
|
+
const parentFunc = parent.func;
|
|
98
|
+
const out = [];
|
|
99
|
+
const counters = /* @__PURE__ */ new Map();
|
|
100
|
+
parentFunc.forEachDescendant((node, traversal) => {
|
|
101
|
+
if (node !== parentFunc && (Node.isFunctionDeclaration(node) || Node.isMethodDeclaration(node))) {
|
|
102
|
+
traversal.skip();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!Node.isCallExpression(node)) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const found = hookOf(node);
|
|
109
|
+
if (found === null) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const expression = callbackExpressionOf(node, found.hook);
|
|
113
|
+
if (expression === null || !(Node.isArrowFunction(expression) || Node.isFunctionExpression(expression))) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const idx = counters.get(found.local) ?? 0;
|
|
117
|
+
counters.set(found.local, idx + 1);
|
|
118
|
+
out.push({
|
|
119
|
+
func: expression,
|
|
120
|
+
kind: "scheduled-callback",
|
|
121
|
+
name: `${parent.name}.${found.local}#${idx}`,
|
|
122
|
+
inputMapping: { type: "positionalParams", params: [] }
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
function reactQueryFramework() {
|
|
128
|
+
return {
|
|
129
|
+
name: "react-query",
|
|
130
|
+
languages: ["typescript"],
|
|
131
|
+
protocol: "in-process",
|
|
132
|
+
discovery: [],
|
|
133
|
+
terminals: [],
|
|
134
|
+
inputMapping: { type: "positionalParams", params: [] },
|
|
135
|
+
requiresImport: QUERY_MODULES,
|
|
136
|
+
invocationRecognizers: [queryHookRecognizer],
|
|
137
|
+
subUnits: reactQuerySubUnits
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
var index_default = reactQueryFramework;
|
|
141
|
+
export {
|
|
142
|
+
index_default as default
|
|
143
|
+
};
|
package/dist/react-router.js
CHANGED
package/dist/react.js
CHANGED
package/dist/redis.js
CHANGED
package/dist/sqlalchemy.js
CHANGED
package/dist/ts-rest.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/packs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Every pack suss ships, as one package with a subpath per pack.",
|
|
6
6
|
"keywords": [
|
|
@@ -132,6 +132,10 @@
|
|
|
132
132
|
"types": "./dist/react.d.ts",
|
|
133
133
|
"import": "./dist/react.js"
|
|
134
134
|
},
|
|
135
|
+
"./react-query": {
|
|
136
|
+
"types": "./dist/react-query.d.ts",
|
|
137
|
+
"import": "./dist/react-query.js"
|
|
138
|
+
},
|
|
135
139
|
"./react-router": {
|
|
136
140
|
"types": "./dist/react-router.d.ts",
|
|
137
141
|
"import": "./dist/react-router.js"
|
|
@@ -165,15 +169,15 @@
|
|
|
165
169
|
"ts-morph": "^23.0.0"
|
|
166
170
|
},
|
|
167
171
|
"dependencies": {
|
|
168
|
-
"@suss/adapter-python": "0.
|
|
169
|
-
"@suss/adapter-ruby": "0.
|
|
170
|
-
"@suss/adapter-typescript": "0.
|
|
171
|
-
"@suss/behavioral-ir": "0.
|
|
172
|
-
"@suss/contract-graphql": "0.
|
|
173
|
-
"@suss/extractor": "0.
|
|
174
|
-
"@suss/manifest-aws": "0.
|
|
175
|
-
"@suss/recognize": "0.
|
|
176
|
-
"@suss/sql": "0.
|
|
172
|
+
"@suss/adapter-python": "0.17.0",
|
|
173
|
+
"@suss/adapter-ruby": "0.17.0",
|
|
174
|
+
"@suss/adapter-typescript": "0.17.0",
|
|
175
|
+
"@suss/behavioral-ir": "0.17.0",
|
|
176
|
+
"@suss/contract-graphql": "0.17.0",
|
|
177
|
+
"@suss/extractor": "0.17.0",
|
|
178
|
+
"@suss/manifest-aws": "0.17.0",
|
|
179
|
+
"@suss/recognize": "0.17.0",
|
|
180
|
+
"@suss/sql": "0.17.0"
|
|
177
181
|
},
|
|
178
182
|
"devDependencies": {
|
|
179
183
|
"@suss/client-apollo": "*",
|
|
@@ -203,6 +207,7 @@
|
|
|
203
207
|
"@suss/framework-package-exports": "*",
|
|
204
208
|
"@suss/framework-prisma": "*",
|
|
205
209
|
"@suss/framework-react": "*",
|
|
210
|
+
"@suss/framework-react-query": "*",
|
|
206
211
|
"@suss/framework-react-router": "*",
|
|
207
212
|
"@suss/framework-redis": "*",
|
|
208
213
|
"@suss/framework-sqlalchemy": "*",
|