@suss/packs 0.25.0 → 0.27.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/axios.js +44 -3
- package/dist/chunk-SKGM3QL5.js +101 -0
- package/dist/express.js +11 -1
- package/dist/fastify.js +0 -1
- package/dist/graphql-ruby.js +18 -2
- package/dist/prisma.js +14 -14
- package/dist/rails.js +614 -122
- package/dist/sqlalchemy.js +5 -93
- package/dist/sqlmodel.d.ts +1 -0
- package/dist/sqlmodel.js +113 -0
- package/package.json +15 -10
package/dist/sqlalchemy.js
CHANGED
|
@@ -1,96 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Which database is behind the connection. SQLAlchemy talks to all of
|
|
7
|
-
* them and the URL says which, so this is the project's own choice
|
|
8
|
-
* rather than something the library settles.
|
|
9
|
-
*/
|
|
10
|
-
storageSystem: storageSystemOption
|
|
11
|
-
}).strict();
|
|
12
|
-
function sqlalchemyStorage(options) {
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
module: "sqlalchemy.orm",
|
|
16
|
-
queryTypes: ["Query", "Session"],
|
|
17
|
-
writes: [
|
|
18
|
-
"update",
|
|
19
|
-
"delete",
|
|
20
|
-
"add",
|
|
21
|
-
"add_all",
|
|
22
|
-
"merge",
|
|
23
|
-
"flush",
|
|
24
|
-
"commit",
|
|
25
|
-
"bulk_save_objects",
|
|
26
|
-
"bulk_insert_mappings",
|
|
27
|
-
"bulk_update_mappings"
|
|
28
|
-
],
|
|
29
|
-
// A Session runs a statement built by `select`/`update`/... whose
|
|
30
|
-
// own chain is read, and the rest of these manage the session.
|
|
31
|
-
recordsNothing: [
|
|
32
|
-
"execute",
|
|
33
|
-
"scalars",
|
|
34
|
-
"scalar",
|
|
35
|
-
"begin",
|
|
36
|
-
"rollback",
|
|
37
|
-
"close",
|
|
38
|
-
"expire",
|
|
39
|
-
"expire_all",
|
|
40
|
-
"expunge",
|
|
41
|
-
"expunge_all"
|
|
42
|
-
],
|
|
43
|
-
storageSystem: options.storageSystem
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
module: "sqlalchemy",
|
|
47
|
-
queryTypes: ["Select", "Update", "Delete", "Insert"],
|
|
48
|
-
writes: ["update", "delete", "insert", "commit"],
|
|
49
|
-
// 2.0 style writes `select(User.id).where(...)`, importing the
|
|
50
|
-
// constructor rather than reaching it through a mapped class, so there
|
|
51
|
-
// is no project method in between whose return says what it is.
|
|
52
|
-
queryFunctions: ["select", "insert", "update", "delete"],
|
|
53
|
-
valueMethods: ["values"],
|
|
54
|
-
storageSystem: options.storageSystem
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
function sqlalchemyRawSql(options) {
|
|
59
|
-
return [
|
|
60
|
-
{
|
|
61
|
-
module: "sqlalchemy",
|
|
62
|
-
functions: ["text"],
|
|
63
|
-
storageSystem: options.storageSystem
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
function sqlalchemyFramework(options) {
|
|
68
|
-
if (typeof options?.storageSystem !== "string") {
|
|
69
|
-
throw new Error(
|
|
70
|
-
"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."
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
name: "sqlalchemy",
|
|
75
|
-
protocol: options.storageSystem,
|
|
76
|
-
discovery: [],
|
|
77
|
-
storage: sqlalchemyStorage(options),
|
|
78
|
-
rawSql: sqlalchemyRawSql(options)
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
var declares = {
|
|
82
|
-
kind: "effects",
|
|
83
|
-
package: "@suss/framework-sqlalchemy",
|
|
84
|
-
dependencies: [{ ecosystem: "pypi", name: "sqlalchemy" }],
|
|
85
|
-
reads: `SQLAlchemy calls (Python): says which types a query comes back as and which methods write, and the adapter matches a call chain by resolving through a project's own base class to what the method behind it says it returns.`,
|
|
86
|
-
configuration: {
|
|
87
|
-
file: "suss.sqlalchemy.json",
|
|
88
|
-
example: { storageSystem: "postgresql" },
|
|
89
|
-
required: true,
|
|
90
|
-
why: "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."
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var index_default = sqlalchemyFramework;
|
|
1
|
+
import {
|
|
2
|
+
declares,
|
|
3
|
+
index_default,
|
|
4
|
+
optionsSchema
|
|
5
|
+
} from "./chunk-SKGM3QL5.js";
|
|
94
6
|
export {
|
|
95
7
|
declares,
|
|
96
8
|
index_default as default,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { declares, default, optionsSchema } from '@suss/framework-sqlmodel';
|
package/dist/sqlmodel.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sqlalchemyRawSql,
|
|
3
|
+
sqlalchemyStorage
|
|
4
|
+
} from "./chunk-SKGM3QL5.js";
|
|
5
|
+
|
|
6
|
+
// ../framework/sqlmodel/dist/index.js
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { storageSystemOption } from "@suss/extractor";
|
|
9
|
+
var optionsSchema = z.object({
|
|
10
|
+
/**
|
|
11
|
+
* Which database is behind the engine. SQLModel talks to all of them
|
|
12
|
+
* and the URL says which, so this is the project's own choice rather
|
|
13
|
+
* than something the library settles.
|
|
14
|
+
*/
|
|
15
|
+
storageSystem: storageSystemOption
|
|
16
|
+
}).strict();
|
|
17
|
+
var SESSION_WRITES = [
|
|
18
|
+
"update",
|
|
19
|
+
"delete",
|
|
20
|
+
"add",
|
|
21
|
+
"add_all",
|
|
22
|
+
"merge",
|
|
23
|
+
"flush",
|
|
24
|
+
"commit",
|
|
25
|
+
"bulk_save_objects",
|
|
26
|
+
"bulk_insert_mappings",
|
|
27
|
+
"bulk_update_mappings"
|
|
28
|
+
];
|
|
29
|
+
var SESSION_RECORDS_NOTHING = [
|
|
30
|
+
"exec",
|
|
31
|
+
"execute",
|
|
32
|
+
"scalars",
|
|
33
|
+
"scalar",
|
|
34
|
+
"begin",
|
|
35
|
+
"rollback",
|
|
36
|
+
"close",
|
|
37
|
+
"expire",
|
|
38
|
+
"expire_all",
|
|
39
|
+
"expunge",
|
|
40
|
+
"expunge_all"
|
|
41
|
+
];
|
|
42
|
+
function sqlmodelStorage(options) {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
module: "sqlmodel",
|
|
46
|
+
queryTypes: ["Session"],
|
|
47
|
+
writes: SESSION_WRITES,
|
|
48
|
+
recordsNothing: SESSION_RECORDS_NOTHING,
|
|
49
|
+
storageSystem: options.storageSystem
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
module: "sqlmodel.ext.asyncio.session",
|
|
53
|
+
queryTypes: ["AsyncSession"],
|
|
54
|
+
writes: SESSION_WRITES,
|
|
55
|
+
recordsNothing: SESSION_RECORDS_NOTHING,
|
|
56
|
+
storageSystem: options.storageSystem
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
module: "sqlmodel",
|
|
60
|
+
queryTypes: ["Select", "SelectOfScalar", "Update", "Delete", "Insert"],
|
|
61
|
+
writes: ["update", "delete", "insert", "commit"],
|
|
62
|
+
// `select(Item).where(...)` imports the constructor from the package
|
|
63
|
+
// root, so there is no project method in between whose return says
|
|
64
|
+
// what it is.
|
|
65
|
+
queryFunctions: ["select", "insert", "update", "delete"],
|
|
66
|
+
valueMethods: ["values"],
|
|
67
|
+
storageSystem: options.storageSystem
|
|
68
|
+
},
|
|
69
|
+
...sqlalchemyStorage(options)
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
function sqlmodelRawSql(options) {
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
module: "sqlmodel",
|
|
76
|
+
functions: ["text"],
|
|
77
|
+
storageSystem: options.storageSystem
|
|
78
|
+
},
|
|
79
|
+
...sqlalchemyRawSql(options)
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
function sqlmodelFramework(options) {
|
|
83
|
+
if (typeof options?.storageSystem !== "string") {
|
|
84
|
+
throw new Error(
|
|
85
|
+
"it needs `storageSystem`, which database is behind the engine: postgresql, mysql, or sqlite. SQLModel talks to all of them and the connection URL settles which, so the pack cannot."
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
name: "sqlmodel",
|
|
90
|
+
protocol: options.storageSystem,
|
|
91
|
+
discovery: [],
|
|
92
|
+
storage: sqlmodelStorage(options),
|
|
93
|
+
rawSql: sqlmodelRawSql(options)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var declares = {
|
|
97
|
+
kind: "effects",
|
|
98
|
+
package: "@suss/framework-sqlmodel",
|
|
99
|
+
dependencies: [{ ecosystem: "pypi", name: "sqlmodel" }],
|
|
100
|
+
reads: "SQLModel calls (Python): says which types a query comes back as and which methods write, under the modules SQLModel exports them from, and includes the SQLAlchemy patterns a SQLModel project also reaches.",
|
|
101
|
+
configuration: {
|
|
102
|
+
file: "suss.sqlmodel.json",
|
|
103
|
+
example: { storageSystem: "postgresql" },
|
|
104
|
+
required: true,
|
|
105
|
+
why: "which database is behind the engine: postgresql, mysql, or sqlite. SQLModel talks to all of them and the connection URL settles which, so the pack cannot."
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var index_default = sqlmodelFramework;
|
|
109
|
+
export {
|
|
110
|
+
declares,
|
|
111
|
+
index_default as default,
|
|
112
|
+
optionsSchema
|
|
113
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/packs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Every pack suss ships in one install, so it can read Express, Hono, NestJS, FastAPI, Rails, Prisma, OpenAPI and the rest.",
|
|
6
6
|
"keywords": [
|
|
@@ -193,6 +193,10 @@
|
|
|
193
193
|
"types": "./dist/sqlalchemy.d.ts",
|
|
194
194
|
"import": "./dist/sqlalchemy.js"
|
|
195
195
|
},
|
|
196
|
+
"./sqlmodel": {
|
|
197
|
+
"types": "./dist/sqlmodel.d.ts",
|
|
198
|
+
"import": "./dist/sqlmodel.js"
|
|
199
|
+
},
|
|
196
200
|
"./ts-rest": {
|
|
197
201
|
"types": "./dist/ts-rest.d.ts",
|
|
198
202
|
"import": "./dist/ts-rest.js"
|
|
@@ -214,15 +218,15 @@
|
|
|
214
218
|
"ts-morph": "^23.0.0"
|
|
215
219
|
},
|
|
216
220
|
"dependencies": {
|
|
217
|
-
"@suss/adapter-python": "0.
|
|
218
|
-
"@suss/adapter-ruby": "0.
|
|
219
|
-
"@suss/adapter-typescript": "0.
|
|
220
|
-
"@suss/behavioral-ir": "0.
|
|
221
|
-
"@suss/contract-graphql": "0.
|
|
222
|
-
"@suss/extractor": "0.
|
|
223
|
-
"@suss/manifest-aws": "0.
|
|
224
|
-
"@suss/recognize": "0.
|
|
225
|
-
"@suss/sql": "0.
|
|
221
|
+
"@suss/adapter-python": "0.27.0",
|
|
222
|
+
"@suss/adapter-ruby": "0.27.0",
|
|
223
|
+
"@suss/adapter-typescript": "0.27.0",
|
|
224
|
+
"@suss/behavioral-ir": "0.27.0",
|
|
225
|
+
"@suss/contract-graphql": "0.27.0",
|
|
226
|
+
"@suss/extractor": "0.27.0",
|
|
227
|
+
"@suss/manifest-aws": "0.27.0",
|
|
228
|
+
"@suss/recognize": "0.27.0",
|
|
229
|
+
"@suss/sql": "0.27.0",
|
|
226
230
|
"zod": "^4.0.0"
|
|
227
231
|
},
|
|
228
232
|
"devDependencies": {
|
|
@@ -267,6 +271,7 @@
|
|
|
267
271
|
"@suss/framework-react-router": "*",
|
|
268
272
|
"@suss/framework-redis": "*",
|
|
269
273
|
"@suss/framework-sqlalchemy": "*",
|
|
274
|
+
"@suss/framework-sqlmodel": "*",
|
|
270
275
|
"@suss/framework-ts-rest": "*",
|
|
271
276
|
"@suss/runtime-node": "*",
|
|
272
277
|
"tsup": "*",
|