@suss/packs 0.32.0 → 0.33.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.
@@ -0,0 +1,50 @@
1
+ // ../framework/pg-ruby/dist/index.js
2
+ var STORAGE_SYSTEM = "postgresql";
3
+ var STATEMENTS = {
4
+ exec: { at: 0 },
5
+ exec_params: { at: 0 },
6
+ async_exec: { at: 0 },
7
+ async_exec_params: { at: 0 },
8
+ sync_exec: { at: 0 },
9
+ sync_exec_params: { at: 0 },
10
+ query: { at: 0 },
11
+ send_query: { at: 0 },
12
+ send_query_params: { at: 0 },
13
+ prepare: { at: 1 },
14
+ async_prepare: { at: 1 },
15
+ sync_prepare: { at: 1 }
16
+ };
17
+ function pgRawSql() {
18
+ const calls = {
19
+ statements: STATEMENTS,
20
+ storageSystem: STORAGE_SYSTEM,
21
+ dialect: STORAGE_SYSTEM
22
+ };
23
+ return [
24
+ { constantName: "PG", clientBuilders: ["connect"], ...calls },
25
+ {
26
+ constantName: "PG::Connection",
27
+ clientBuilders: ["new", "connect", "open"],
28
+ ...calls
29
+ }
30
+ ];
31
+ }
32
+ function pgRubyFramework() {
33
+ return {
34
+ name: "pg-ruby",
35
+ protocol: STORAGE_SYSTEM,
36
+ discovery: [],
37
+ rawSql: pgRawSql()
38
+ };
39
+ }
40
+ var declares = {
41
+ kind: "effects",
42
+ package: "@suss/framework-pg-ruby",
43
+ dependencies: [{ ecosystem: "rubygems", name: "pg" }],
44
+ reads: "pg gem calls (Ruby): a call matches when its receiver follows back to a connection the gem handed out, and the statement it was given is parsed for the tables it touches."
45
+ };
46
+ var index_default = pgRubyFramework;
47
+ export {
48
+ declares,
49
+ index_default as default
50
+ };
package/dist/pg.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { declares, default } from '@suss/framework-pg';
package/dist/pg.js ADDED
@@ -0,0 +1,28 @@
1
+ // ../framework/pg/dist/index.js
2
+ import { declaredBy, pack, sqlStatements } from "@suss/recognize";
3
+ var CLIENT_MODULES = ["pg", "@types/pg"];
4
+ var STATEMENT = {
5
+ statement: [{ at: 0 }, { at: 0, property: ["text"] }]
6
+ };
7
+ var QUERIES = sqlStatements({
8
+ system: "postgresql",
9
+ dialect: "postgresql",
10
+ client: declaredBy(...CLIENT_MODULES)
11
+ }).methods({ query: STATEMENT }).example('pool.query("SELECT id, email FROM users WHERE id = $1", [id])');
12
+ function pgFramework() {
13
+ return pack("pg", [QUERIES], {
14
+ languages: ["typescript", "javascript"],
15
+ recognizedAs: "@suss/framework-pg"
16
+ });
17
+ }
18
+ var declares = {
19
+ kind: "effects",
20
+ package: "@suss/framework-pg",
21
+ dependencies: [{ ecosystem: "npm", name: "pg" }],
22
+ reads: "node-postgres queries, emits storage-access interactions with the tables each statement touches."
23
+ };
24
+ var index_default = pgFramework;
25
+ export {
26
+ declares,
27
+ index_default as default
28
+ };
package/dist/prisma.js CHANGED
@@ -1,4 +1,6 @@
1
1
  // ../framework/prisma/dist/index.js
2
+ import fs from "fs";
3
+ import path from "path";
2
4
  import {
3
5
  Node as N
4
6
  } from "ts-morph";
@@ -141,7 +143,7 @@ function nestedReads(optionsArg) {
141
143
  collectRelations(optionsArg, [], found);
142
144
  return found;
143
145
  }
144
- function collectRelations(shape, path, found) {
146
+ function collectRelations(shape, path2, found) {
145
147
  const select = readObjectArg(shape.fields.select);
146
148
  if (select !== null) {
147
149
  for (const [name, value] of Object.entries(select.fields)) {
@@ -149,7 +151,7 @@ function collectRelations(shape, path, found) {
149
151
  if (nested === null) {
150
152
  continue;
151
153
  }
152
- recordRelation(name, nested, path, found);
154
+ recordRelation(name, nested, path2, found);
153
155
  }
154
156
  }
155
157
  const include = readObjectArg(shape.fields.include);
@@ -159,14 +161,14 @@ function collectRelations(shape, path, found) {
159
161
  for (const [name, value] of Object.entries(include.fields)) {
160
162
  const nested = readObjectArg(value);
161
163
  if (nested === null) {
162
- found.push({ relationPath: [...path, name], fields: ["*"] });
164
+ found.push({ relationPath: [...path2, name], fields: ["*"] });
163
165
  continue;
164
166
  }
165
- recordRelation(name, nested, path, found);
167
+ recordRelation(name, nested, path2, found);
166
168
  }
167
169
  }
168
- function recordRelation(name, nested, path, found) {
169
- const relationPath = [...path, name];
170
+ function recordRelation(name, nested, path2, found) {
171
+ const relationPath = [...path2, name];
170
172
  found.push({ relationPath, fields: extractFields(nested, "read") });
171
173
  collectRelations(nested, relationPath, found);
172
174
  }
@@ -220,13 +222,13 @@ function nestedWrites(optionsArg) {
220
222
  }
221
223
  return found;
222
224
  }
223
- function collectNestedWrites(row, path, found) {
225
+ function collectNestedWrites(row, path2, found) {
224
226
  for (const [field, value] of Object.entries(row.fields)) {
225
227
  const nested = readObjectArg(value);
226
228
  if (nested === null) {
227
229
  continue;
228
230
  }
229
- const relationPath = [...path, field];
231
+ const relationPath = [...path2, field];
230
232
  for (const [operation, payload] of Object.entries(nested.fields)) {
231
233
  const does = NESTED_OPERATIONS.get(operation);
232
234
  if (does === void 0) {
@@ -293,8 +295,13 @@ function extendsPrismaClient(type, seen) {
293
295
  }
294
296
  return type.getBaseTypes().some((base) => extendsPrismaClient(base, seen));
295
297
  }
298
+ var GENERATED_CLIENT_MARKER = "schema.prisma";
296
299
  function isPrismaClientPath(filePath) {
297
- return filePath.includes("/@prisma/client/") || filePath.includes("/.prisma/client/");
300
+ if (filePath.includes("/@prisma/client/") || filePath.includes("/.prisma/client/")) {
301
+ return true;
302
+ }
303
+ const beside = path.join(path.dirname(filePath), GENERATED_CLIENT_MARKER);
304
+ return fs.existsSync(beside);
298
305
  }
299
306
  function capitalizeFirst(name) {
300
307
  if (name.length === 0) {
@@ -402,6 +409,9 @@ function prismaFramework(options = {}) {
402
409
  // Skip files that don't import from @prisma/client: the
403
410
  // recognizer's type-resolution check would reject them anyway.
404
411
  requiresImport: ["@prisma/client"],
412
+ // A generator with its own `output` puts the client in the project,
413
+ // where the only way to reach it is a relative path.
414
+ generatedModuleMarkers: [GENERATED_CLIENT_MARKER],
405
415
  invocationRecognizers: [makeRecognizer(options)],
406
416
  // A tagged template is not an invocation, so the raw chain runs on
407
417
  // the access walk, which visits calls as well.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suss/packs",
3
- "version": "0.32.0",
3
+ "version": "0.33.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": [
@@ -69,10 +69,22 @@
69
69
  "types": "./dist/aws-sqs.d.ts",
70
70
  "import": "./dist/aws-sqs.js"
71
71
  },
72
+ "./bigquery-ruby": {
73
+ "types": "./dist/bigquery-ruby.d.ts",
74
+ "import": "./dist/bigquery-ruby.js"
75
+ },
72
76
  "./axios": {
73
77
  "types": "./dist/axios.d.ts",
74
78
  "import": "./dist/axios.js"
75
79
  },
80
+ "./bigquery": {
81
+ "types": "./dist/bigquery.d.ts",
82
+ "import": "./dist/bigquery.js"
83
+ },
84
+ "./bigquery-python": {
85
+ "types": "./dist/bigquery-python.d.ts",
86
+ "import": "./dist/bigquery-python.js"
87
+ },
76
88
  "./cloudflare-workers": {
77
89
  "types": "./dist/cloudflare-workers.d.ts",
78
90
  "import": "./dist/cloudflare-workers.js"
@@ -157,6 +169,14 @@
157
169
  "types": "./dist/package-exports.d.ts",
158
170
  "import": "./dist/package-exports.js"
159
171
  },
172
+ "./pg": {
173
+ "types": "./dist/pg.d.ts",
174
+ "import": "./dist/pg.js"
175
+ },
176
+ "./pg-ruby": {
177
+ "types": "./dist/pg-ruby.d.ts",
178
+ "import": "./dist/pg-ruby.js"
179
+ },
160
180
  "./prisma": {
161
181
  "types": "./dist/prisma.d.ts",
162
182
  "import": "./dist/prisma.js"
@@ -218,15 +238,15 @@
218
238
  "ts-morph": "^23.0.0"
219
239
  },
220
240
  "dependencies": {
221
- "@suss/adapter-python": "0.32.0",
222
- "@suss/adapter-ruby": "0.32.0",
223
- "@suss/adapter-typescript": "0.32.0",
224
- "@suss/behavioral-ir": "0.32.0",
225
- "@suss/contract-graphql": "0.32.0",
226
- "@suss/extractor": "0.32.0",
227
- "@suss/manifest-aws": "0.32.0",
228
- "@suss/recognize": "0.32.0",
229
- "@suss/sql": "0.32.0",
241
+ "@suss/adapter-python": "0.33.0",
242
+ "@suss/adapter-ruby": "0.33.0",
243
+ "@suss/adapter-typescript": "0.33.0",
244
+ "@suss/behavioral-ir": "0.33.0",
245
+ "@suss/contract-graphql": "0.33.0",
246
+ "@suss/extractor": "0.33.0",
247
+ "@suss/manifest-aws": "0.33.0",
248
+ "@suss/recognize": "0.33.0",
249
+ "@suss/sql": "0.33.0",
230
250
  "zod": "^4.0.0"
231
251
  },
232
252
  "devDependencies": {
@@ -248,6 +268,9 @@
248
268
  "@suss/framework-aws-sns": "*",
249
269
  "@suss/framework-aws-sqs": "*",
250
270
  "@suss/framework-aws-ssm": "*",
271
+ "@suss/framework-bigquery": "*",
272
+ "@suss/framework-bigquery-python": "*",
273
+ "@suss/framework-bigquery-ruby": "*",
251
274
  "@suss/framework-cloudflare-workers": "*",
252
275
  "@suss/framework-drizzle": "*",
253
276
  "@suss/framework-express": "*",
@@ -263,6 +286,8 @@
263
286
  "@suss/framework-nestjs-rest": "*",
264
287
  "@suss/framework-nextjs": "*",
265
288
  "@suss/framework-package-exports": "*",
289
+ "@suss/framework-pg": "*",
290
+ "@suss/framework-pg-ruby": "*",
266
291
  "@suss/framework-prisma": "*",
267
292
  "@suss/framework-rails": "*",
268
293
  "@suss/framework-react": "*",