@suss/packs 0.33.1 → 0.34.1
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/README.md +10 -11
- package/dist/activerecord.d.ts +7 -0
- package/dist/activerecord.js +53 -5
- package/dist/aiohttp.js +20 -9
- package/dist/apollo-client.js +26 -39
- package/dist/apollo.js +12 -20
- package/dist/aws-dynamodb.js +4 -4
- package/dist/aws-eventbridge.js +3 -3
- package/dist/aws-lambda.js +31 -54
- package/dist/aws-s3.js +1 -1
- package/dist/aws-secrets-manager.js +1 -1
- package/dist/aws-sns.js +2 -2
- package/dist/aws-sqs.js +20 -11
- package/dist/aws-ssm.js +1 -1
- package/dist/axios.js +36 -37
- package/dist/bigquery-python.js +3 -3
- package/dist/bigquery.js +1 -1
- package/dist/{chunk-NYWZHQBJ.js → chunk-GK4BILHB.js} +8 -9
- package/dist/cloudflare-workers.js +26 -35
- package/dist/drizzle.js +15 -20
- package/dist/express.js +3 -6
- package/dist/fabrication.d.ts +1 -0
- package/dist/fabrication.js +36 -0
- package/dist/factory-bot.d.ts +1 -0
- package/dist/factory-bot.js +36 -0
- package/dist/faraday.js +8 -6
- package/dist/fastapi.js +123 -5
- package/dist/fastify.js +10 -14
- package/dist/fetch.js +12 -6
- package/dist/flask-restx.js +19 -12
- package/dist/gcs.js +1 -1
- package/dist/graphql-ruby.js +20 -16
- package/dist/hono.js +17 -27
- package/dist/httpx.js +8 -6
- package/dist/minitest.d.ts +1 -0
- package/dist/minitest.js +59 -0
- package/dist/mongoose.js +7 -7
- package/dist/nestjs-graphql.js +14 -25
- package/dist/nestjs-microservices.js +9 -10
- package/dist/nestjs-rest.js +193 -23
- package/dist/net-http.js +9 -7
- package/dist/nextjs.js +16 -17
- package/dist/node.js +139 -23
- package/dist/package-exports.js +1 -1
- package/dist/pg.js +3 -2
- package/dist/prisma.js +375 -56
- package/dist/pytest.d.ts +1 -0
- package/dist/pytest.js +81 -0
- package/dist/rails.js +1792 -132
- package/dist/react-query.js +1 -1
- package/dist/react-router.js +21 -48
- package/dist/react.js +14 -5
- package/dist/redis.js +1 -1
- package/dist/requests.js +27 -19
- package/dist/rspec.d.ts +1 -0
- package/dist/rspec.js +135 -0
- package/dist/sqlalchemy.js +1 -1
- package/dist/sqlmodel.js +7 -8
- package/dist/ts-rest.js +6 -8
- package/dist/typeorm.d.ts +1 -0
- package/dist/typeorm.js +291 -0
- package/dist/vitest.d.ts +1 -0
- package/dist/vitest.js +64 -0
- package/package.json +47 -11
package/dist/nestjs-graphql.js
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
var optionsSchema = z.object({
|
|
4
4
|
/**
|
|
5
|
-
* Class decorators
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* resolves a class decorator to the function behind it and accepts it
|
|
10
|
-
* when calling that function calls `Resolver` from
|
|
11
|
-
* `@nestjs/graphql`. What is left for this option is a wrapper whose
|
|
12
|
-
* body is not in the project, so there is nothing to read.
|
|
5
|
+
* Class decorators that wrap `@Resolver()` in a package outside the
|
|
6
|
+
* project. A dependency stub fills this. A wrapper written in the
|
|
7
|
+
* project needs no entry, because the adapter reads its body and
|
|
8
|
+
* sees it call `Resolver` from `@nestjs/graphql`.
|
|
13
9
|
*/
|
|
14
10
|
classDecorators: z.array(z.string()).optional()
|
|
15
11
|
}).strict();
|
|
@@ -17,10 +13,8 @@ function nestjsGraphqlFramework(options = {}) {
|
|
|
17
13
|
return {
|
|
18
14
|
name: "nestjs-graphql",
|
|
19
15
|
languages: ["typescript"],
|
|
20
|
-
// Apollo Server runs underneath
|
|
21
|
-
//
|
|
22
|
-
// whether the resolver was discovered via decorator or via an
|
|
23
|
-
// object-literal resolver map.
|
|
16
|
+
// Apollo Server runs underneath `GraphQLModule.forRoot`, so the
|
|
17
|
+
// transport is HTTP here as it is for the apollo pack.
|
|
24
18
|
protocol: "http",
|
|
25
19
|
discovery: [
|
|
26
20
|
{
|
|
@@ -28,8 +22,8 @@ function nestjsGraphqlFramework(options = {}) {
|
|
|
28
22
|
match: {
|
|
29
23
|
type: "decoratedMethod",
|
|
30
24
|
importModule: "@nestjs/graphql",
|
|
31
|
-
//
|
|
32
|
-
// tried before any wrapper
|
|
25
|
+
// The first match wins, so the framework's own decorator is
|
|
26
|
+
// tried before any wrapper.
|
|
33
27
|
classDecorators: ["Resolver", ...options.classDecorators ?? []],
|
|
34
28
|
methodDecorators: [
|
|
35
29
|
"Query",
|
|
@@ -37,9 +31,8 @@ function nestjsGraphqlFramework(options = {}) {
|
|
|
37
31
|
"ResolveField",
|
|
38
32
|
"Subscription"
|
|
39
33
|
],
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
// absent: it is the one that needs the class decorator.
|
|
34
|
+
// `ResolveField` is left out because its type comes from the
|
|
35
|
+
// class decorator.
|
|
43
36
|
methodDecoratorTypeMap: {
|
|
44
37
|
Query: "Query",
|
|
45
38
|
Mutation: "Mutation",
|
|
@@ -50,10 +43,8 @@ function nestjsGraphqlFramework(options = {}) {
|
|
|
50
43
|
}
|
|
51
44
|
],
|
|
52
45
|
terminals: [
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
// outgoing response). No framework-specific response-call
|
|
56
|
-
// shape: return + throw cover the observable behaviour.
|
|
46
|
+
// A resolver has no response call. It returns a value or throws,
|
|
47
|
+
// and NestJS turns a thrown exception into `errors[]`.
|
|
57
48
|
{
|
|
58
49
|
kind: "return",
|
|
59
50
|
match: { type: "returnStatement" },
|
|
@@ -65,10 +56,8 @@ function nestjsGraphqlFramework(options = {}) {
|
|
|
65
56
|
extraction: {}
|
|
66
57
|
},
|
|
67
58
|
{
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
// default transition so the unit does not come out with no transitions
|
|
71
|
-
// at all.
|
|
59
|
+
// A resolver for an optional field can fall off the end. Without
|
|
60
|
+
// this terminal that unit would come out with no transitions.
|
|
72
61
|
kind: "return",
|
|
73
62
|
match: { type: "functionFallthrough" },
|
|
74
63
|
extraction: {}
|
|
@@ -7,14 +7,13 @@ var TRANSPORTS = [
|
|
|
7
7
|
];
|
|
8
8
|
var optionsSchema = z.object({
|
|
9
9
|
/**
|
|
10
|
-
* The broker
|
|
11
|
-
*
|
|
10
|
+
* The broker the project connects at bootstrap. The handler's file
|
|
11
|
+
* never mentions it. Defaults to NATS.
|
|
12
12
|
*/
|
|
13
13
|
transport: z.enum(TRANSPORTS).optional(),
|
|
14
14
|
/**
|
|
15
|
-
* Class decorators
|
|
16
|
-
*
|
|
17
|
-
* the project.
|
|
15
|
+
* Class decorators that wrap `@Controller()` in a package outside the
|
|
16
|
+
* project, as in the REST pack. A dependency stub fills this.
|
|
18
17
|
*/
|
|
19
18
|
classDecorators: z.array(z.string()).optional()
|
|
20
19
|
}).strict();
|
|
@@ -35,8 +34,8 @@ function nestjsMicroservicesFramework(options = {}) {
|
|
|
35
34
|
type: "decoratedRoute",
|
|
36
35
|
importModule: ["@nestjs/microservices", "@nestjs/common"],
|
|
37
36
|
classDecorators: ["Controller", ...options.classDecorators ?? []],
|
|
38
|
-
//
|
|
39
|
-
//
|
|
37
|
+
// These values only label the handler. The boundary comes from
|
|
38
|
+
// the declared binding.
|
|
40
39
|
methodDecoratorRouteMap: {
|
|
41
40
|
EventPattern: "event",
|
|
42
41
|
MessagePattern: "message"
|
|
@@ -47,9 +46,9 @@ function nestjsMicroservicesFramework(options = {}) {
|
|
|
47
46
|
}
|
|
48
47
|
],
|
|
49
48
|
terminals: [
|
|
50
|
-
// An
|
|
51
|
-
//
|
|
52
|
-
//
|
|
49
|
+
// An `@MessagePattern` handler's return value is the reply, and
|
|
50
|
+
// NestJS drops an `@EventPattern` handler's. Both are recorded as
|
|
51
|
+
// returns, and nothing pairs the reply yet.
|
|
53
52
|
{
|
|
54
53
|
kind: "return",
|
|
55
54
|
match: { type: "returnStatement", excludeCallReturns: false },
|
package/dist/nestjs-rest.js
CHANGED
|
@@ -1,18 +1,143 @@
|
|
|
1
1
|
// ../framework/nestjs-rest/dist/index.js
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
var HTTP_STATUS = {
|
|
4
|
+
CONTINUE: 100,
|
|
5
|
+
SWITCHING_PROTOCOLS: 101,
|
|
6
|
+
PROCESSING: 102,
|
|
7
|
+
EARLYHINTS: 103,
|
|
8
|
+
OK: 200,
|
|
9
|
+
CREATED: 201,
|
|
10
|
+
ACCEPTED: 202,
|
|
11
|
+
NON_AUTHORITATIVE_INFORMATION: 203,
|
|
12
|
+
NO_CONTENT: 204,
|
|
13
|
+
RESET_CONTENT: 205,
|
|
14
|
+
PARTIAL_CONTENT: 206,
|
|
15
|
+
MULTI_STATUS: 207,
|
|
16
|
+
ALREADY_REPORTED: 208,
|
|
17
|
+
CONTENT_DIFFERENT: 210,
|
|
18
|
+
AMBIGUOUS: 300,
|
|
19
|
+
MOVED_PERMANENTLY: 301,
|
|
20
|
+
FOUND: 302,
|
|
21
|
+
SEE_OTHER: 303,
|
|
22
|
+
NOT_MODIFIED: 304,
|
|
23
|
+
TEMPORARY_REDIRECT: 307,
|
|
24
|
+
PERMANENT_REDIRECT: 308,
|
|
25
|
+
BAD_REQUEST: 400,
|
|
26
|
+
UNAUTHORIZED: 401,
|
|
27
|
+
PAYMENT_REQUIRED: 402,
|
|
28
|
+
FORBIDDEN: 403,
|
|
29
|
+
NOT_FOUND: 404,
|
|
30
|
+
METHOD_NOT_ALLOWED: 405,
|
|
31
|
+
NOT_ACCEPTABLE: 406,
|
|
32
|
+
PROXY_AUTHENTICATION_REQUIRED: 407,
|
|
33
|
+
REQUEST_TIMEOUT: 408,
|
|
34
|
+
CONFLICT: 409,
|
|
35
|
+
GONE: 410,
|
|
36
|
+
LENGTH_REQUIRED: 411,
|
|
37
|
+
PRECONDITION_FAILED: 412,
|
|
38
|
+
PAYLOAD_TOO_LARGE: 413,
|
|
39
|
+
URI_TOO_LONG: 414,
|
|
40
|
+
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
41
|
+
REQUESTED_RANGE_NOT_SATISFIABLE: 416,
|
|
42
|
+
EXPECTATION_FAILED: 417,
|
|
43
|
+
I_AM_A_TEAPOT: 418,
|
|
44
|
+
MISDIRECTED: 421,
|
|
45
|
+
UNPROCESSABLE_ENTITY: 422,
|
|
46
|
+
LOCKED: 423,
|
|
47
|
+
FAILED_DEPENDENCY: 424,
|
|
48
|
+
PRECONDITION_REQUIRED: 428,
|
|
49
|
+
TOO_MANY_REQUESTS: 429,
|
|
50
|
+
UNRECOVERABLE_ERROR: 456,
|
|
51
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
52
|
+
NOT_IMPLEMENTED: 501,
|
|
53
|
+
BAD_GATEWAY: 502,
|
|
54
|
+
SERVICE_UNAVAILABLE: 503,
|
|
55
|
+
GATEWAY_TIMEOUT: 504,
|
|
56
|
+
HTTP_VERSION_NOT_SUPPORTED: 505,
|
|
57
|
+
INSUFFICIENT_STORAGE: 507,
|
|
58
|
+
LOOP_DETECTED: 508
|
|
59
|
+
};
|
|
60
|
+
var HTTP_STATUS_CONSTANTS = Object.fromEntries(
|
|
61
|
+
Object.entries(HTTP_STATUS).map(([member, status]) => [
|
|
62
|
+
`HttpStatus.${member}`,
|
|
63
|
+
status
|
|
64
|
+
])
|
|
65
|
+
);
|
|
3
66
|
var optionsSchema = z.object({
|
|
4
67
|
/**
|
|
5
|
-
* Class decorators
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* resolves a class decorator to the function behind it and accepts it
|
|
10
|
-
* when calling that function calls `Controller` from
|
|
11
|
-
* `@nestjs/common`. What is left for this option is a wrapper whose
|
|
12
|
-
* body is not in the project, so there is nothing to read.
|
|
68
|
+
* Class decorators that wrap `@Controller()` in a package outside the
|
|
69
|
+
* project. A dependency stub fills this. A wrapper written in the
|
|
70
|
+
* project needs no entry, because the adapter reads its body and
|
|
71
|
+
* sees it call `Controller` from `@nestjs/common`.
|
|
13
72
|
*/
|
|
14
73
|
classDecorators: z.array(z.string()).optional()
|
|
15
74
|
}).strict();
|
|
75
|
+
var NEST_APPLICATION = {
|
|
76
|
+
importModule: "@nestjs/core",
|
|
77
|
+
importName: "NestFactory",
|
|
78
|
+
factory: "create"
|
|
79
|
+
};
|
|
80
|
+
var REQUEST_METHODS = {
|
|
81
|
+
0: "GET",
|
|
82
|
+
1: "POST",
|
|
83
|
+
2: "PUT",
|
|
84
|
+
3: "DELETE",
|
|
85
|
+
4: "PATCH",
|
|
86
|
+
5: "*",
|
|
87
|
+
6: "OPTIONS",
|
|
88
|
+
7: "HEAD"
|
|
89
|
+
};
|
|
90
|
+
var NEST_EXCEPTION_STATUSES = {
|
|
91
|
+
BadRequestException: 400,
|
|
92
|
+
UnauthorizedException: 401,
|
|
93
|
+
ForbiddenException: 403,
|
|
94
|
+
NotFoundException: 404,
|
|
95
|
+
MethodNotAllowedException: 405,
|
|
96
|
+
NotAcceptableException: 406,
|
|
97
|
+
RequestTimeoutException: 408,
|
|
98
|
+
ConflictException: 409,
|
|
99
|
+
GoneException: 410,
|
|
100
|
+
PreconditionFailedException: 412,
|
|
101
|
+
PayloadTooLargeException: 413,
|
|
102
|
+
UnsupportedMediaTypeException: 415,
|
|
103
|
+
ImATeapotException: 418,
|
|
104
|
+
MisdirectedException: 421,
|
|
105
|
+
UnprocessableEntityException: 422,
|
|
106
|
+
InternalServerErrorException: 500,
|
|
107
|
+
NotImplementedException: 501,
|
|
108
|
+
BadGatewayException: 502,
|
|
109
|
+
ServiceUnavailableException: 503,
|
|
110
|
+
GatewayTimeoutException: 504,
|
|
111
|
+
HttpVersionNotSupportedException: 505
|
|
112
|
+
};
|
|
113
|
+
var SWAGGER_RESPONSE_DECORATORS = {
|
|
114
|
+
ApiResponse: null,
|
|
115
|
+
ApiOkResponse: 200,
|
|
116
|
+
ApiCreatedResponse: 201,
|
|
117
|
+
ApiAcceptedResponse: 202,
|
|
118
|
+
ApiNoContentResponse: 204,
|
|
119
|
+
ApiMovedPermanentlyResponse: 301,
|
|
120
|
+
ApiFoundResponse: 302,
|
|
121
|
+
ApiBadRequestResponse: 400,
|
|
122
|
+
ApiUnauthorizedResponse: 401,
|
|
123
|
+
ApiForbiddenResponse: 403,
|
|
124
|
+
ApiNotFoundResponse: 404,
|
|
125
|
+
ApiMethodNotAllowedResponse: 405,
|
|
126
|
+
ApiNotAcceptableResponse: 406,
|
|
127
|
+
ApiRequestTimeoutResponse: 408,
|
|
128
|
+
ApiConflictResponse: 409,
|
|
129
|
+
ApiGoneResponse: 410,
|
|
130
|
+
ApiPreconditionFailedResponse: 412,
|
|
131
|
+
ApiPayloadTooLargeResponse: 413,
|
|
132
|
+
ApiUnsupportedMediaTypeResponse: 415,
|
|
133
|
+
ApiUnprocessableEntityResponse: 422,
|
|
134
|
+
ApiTooManyRequestsResponse: 429,
|
|
135
|
+
ApiInternalServerErrorResponse: 500,
|
|
136
|
+
ApiNotImplementedResponse: 501,
|
|
137
|
+
ApiBadGatewayResponse: 502,
|
|
138
|
+
ApiServiceUnavailableResponse: 503,
|
|
139
|
+
ApiGatewayTimeoutResponse: 504
|
|
140
|
+
};
|
|
16
141
|
function nestjsRestFramework(options = {}) {
|
|
17
142
|
return {
|
|
18
143
|
name: "nestjs-rest",
|
|
@@ -24,8 +149,8 @@ function nestjsRestFramework(options = {}) {
|
|
|
24
149
|
match: {
|
|
25
150
|
type: "decoratedRoute",
|
|
26
151
|
importModule: "@nestjs/common",
|
|
27
|
-
//
|
|
28
|
-
// tried before any wrapper
|
|
152
|
+
// The first match wins, so the framework's own decorator is
|
|
153
|
+
// tried before any wrapper.
|
|
29
154
|
classDecorators: ["Controller", ...options.classDecorators ?? []],
|
|
30
155
|
methodDecoratorRouteMap: {
|
|
31
156
|
Get: "GET",
|
|
@@ -36,17 +161,62 @@ function nestjsRestFramework(options = {}) {
|
|
|
36
161
|
Options: "OPTIONS",
|
|
37
162
|
Head: "HEAD",
|
|
38
163
|
All: "*"
|
|
164
|
+
},
|
|
165
|
+
// Nest sends 201 for a POST and 200 for every other verb, and
|
|
166
|
+
// `@HttpCode(n)` sets the status for one handler.
|
|
167
|
+
defaultStatusCodes: { Post: 201 },
|
|
168
|
+
statusCodeDecorator: "HttpCode",
|
|
169
|
+
statusCodeConstants: HTTP_STATUS_CONSTANTS,
|
|
170
|
+
globalPrefix: {
|
|
171
|
+
method: "setGlobalPrefix",
|
|
172
|
+
application: NEST_APPLICATION,
|
|
173
|
+
// An exclusion is a path, or a `RouteInfo` whose method is a
|
|
174
|
+
// member of Nest's `RequestMethod` enum.
|
|
175
|
+
exclude: {
|
|
176
|
+
option: "exclude",
|
|
177
|
+
pathKey: "path",
|
|
178
|
+
methodKey: "method",
|
|
179
|
+
methods: REQUEST_METHODS
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
// A spec `@nestjs/swagger` generates declares these statuses
|
|
183
|
+
// because of the decorators, whether or not a path sends them.
|
|
184
|
+
declaredStatuses: {
|
|
185
|
+
importModule: "@nestjs/swagger",
|
|
186
|
+
decorators: SWAGGER_RESPONSE_DECORATORS,
|
|
187
|
+
statusKey: "status"
|
|
188
|
+
},
|
|
189
|
+
// `app.enableVersioning()` with no options is URI versioning,
|
|
190
|
+
// which serves version 1 of a route at `/v1/...`.
|
|
191
|
+
versioning: {
|
|
192
|
+
option: "version",
|
|
193
|
+
decorator: "Version",
|
|
194
|
+
neutral: "VERSION_NEUTRAL",
|
|
195
|
+
call: { method: "enableVersioning", application: NEST_APPLICATION },
|
|
196
|
+
typeKey: "type",
|
|
197
|
+
types: {
|
|
198
|
+
"VersioningType.URI": "path",
|
|
199
|
+
"VersioningType.HEADER": "outsidePath",
|
|
200
|
+
"VersioningType.MEDIA_TYPE": "outsidePath",
|
|
201
|
+
"VersioningType.CUSTOM": "outsidePath"
|
|
202
|
+
},
|
|
203
|
+
typeNumbers: {
|
|
204
|
+
0: "path",
|
|
205
|
+
1: "outsidePath",
|
|
206
|
+
2: "outsidePath",
|
|
207
|
+
3: "outsidePath"
|
|
208
|
+
},
|
|
209
|
+
defaultType: "path",
|
|
210
|
+
pathPrefix: { key: "prefix", default: "v" },
|
|
211
|
+
defaultVersionKey: "defaultVersion"
|
|
39
212
|
}
|
|
40
213
|
},
|
|
41
214
|
requiresImport: ["@nestjs/common"]
|
|
42
215
|
}
|
|
43
216
|
],
|
|
44
217
|
terminals: [
|
|
45
|
-
// NestJS
|
|
46
|
-
//
|
|
47
|
-
// declares `@HttpCode(N)` (deferred: that decorator is
|
|
48
|
-
// metadata-only). Match bare returns and treat object literals
|
|
49
|
-
// / identifiers / awaited calls as 200 responses.
|
|
218
|
+
// NestJS sends the returned value as the body. The route's own
|
|
219
|
+
// status, from its verb or `@HttpCode`, replaces this 200.
|
|
50
220
|
{
|
|
51
221
|
kind: "response",
|
|
52
222
|
match: { type: "returnStatement", excludeCallReturns: false },
|
|
@@ -55,19 +225,19 @@ function nestjsRestFramework(options = {}) {
|
|
|
55
225
|
}
|
|
56
226
|
},
|
|
57
227
|
{
|
|
58
|
-
// `throw new
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// contract-checking can pair it with the wire status that
|
|
62
|
-
// the framework would emit.
|
|
228
|
+
// `throw new BadRequestException()`: NestJS's exception filter
|
|
229
|
+
// sends the status that class is for. Any other throw keeps no
|
|
230
|
+
// status and stays a throw.
|
|
63
231
|
kind: "throw",
|
|
64
232
|
match: { type: "throwExpression" },
|
|
65
|
-
extraction: {
|
|
233
|
+
extraction: {
|
|
234
|
+
statusCode: { from: "constructor", codes: NEST_EXCEPTION_STATUSES }
|
|
235
|
+
},
|
|
236
|
+
producesResponse: true
|
|
66
237
|
},
|
|
67
238
|
{
|
|
68
239
|
// A method that runs off the end returns undefined, and Nest
|
|
69
|
-
// sends the same
|
|
70
|
-
// `return;`. Only `@HttpCode(N)` changes that.
|
|
240
|
+
// sends the same empty response it sends for a bare `return;`.
|
|
71
241
|
kind: "response",
|
|
72
242
|
match: { type: "functionFallthrough" },
|
|
73
243
|
extraction: {
|
package/dist/net-http.js
CHANGED
|
@@ -28,9 +28,9 @@ function netHttpClient() {
|
|
|
28
28
|
{
|
|
29
29
|
constantName: "Net::HTTP",
|
|
30
30
|
verbMethodNames: VERB_METHODS,
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
31
|
+
// These methods take a URI object. `URI(...)` and `URI.parse(...)`
|
|
32
|
+
// are part of Ruby, so the adapter already evaluates them and the
|
|
33
|
+
// pack adds nothing for them.
|
|
34
34
|
url: { position: 0 },
|
|
35
35
|
receiverBuilders: ["new"],
|
|
36
36
|
requestObject: {
|
|
@@ -38,13 +38,14 @@ function netHttpClient() {
|
|
|
38
38
|
constructors: REQUEST_CLASSES,
|
|
39
39
|
urlPosition: 0
|
|
40
40
|
},
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
// other member.
|
|
41
|
+
// `code` is a string, so callers write `response.code.to_i == 404`.
|
|
42
|
+
// That comparison is read the same way as one on any other member.
|
|
44
43
|
response: {
|
|
45
44
|
statusCode: ["code"],
|
|
46
45
|
body: ["body"],
|
|
47
|
-
failureDelivery: "response"
|
|
46
|
+
failureDelivery: "response",
|
|
47
|
+
// Net::HTTP never follows a redirect.
|
|
48
|
+
redirectDelivery: "response"
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
]
|
|
@@ -55,6 +56,7 @@ var declares = {
|
|
|
55
56
|
package: "@suss/client-net-http",
|
|
56
57
|
dependencies: [],
|
|
57
58
|
shippedWith: "ruby",
|
|
59
|
+
sourcePattern: /\bNet::HTTP\b/,
|
|
58
60
|
reads: "Net::HTTP call sites (Ruby): the module methods that send on their own, and a request object built with `Net::HTTP::Get` and its siblings, with the URL read through `URI`."
|
|
59
61
|
};
|
|
60
62
|
var index_default = netHttpClient;
|
package/dist/nextjs.js
CHANGED
|
@@ -36,9 +36,9 @@ function actionUnit(func, name, module) {
|
|
|
36
36
|
name,
|
|
37
37
|
terminals: ACTION_TERMINALS,
|
|
38
38
|
inputMapping: { type: "allPositional" },
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
// project
|
|
39
|
+
// Intent files and keyed pairing find the action by module and export
|
|
40
|
+
// name. The path is absolute here, and the CLI makes it relative to
|
|
41
|
+
// the project along with every other path on the summary.
|
|
42
42
|
functionCallInfo: { module, exportName: name }
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -152,8 +152,8 @@ function nextjsFramework() {
|
|
|
152
152
|
exportNames: ["default"]
|
|
153
153
|
},
|
|
154
154
|
bindingExtraction: {
|
|
155
|
-
// One export serves every method,
|
|
156
|
-
//
|
|
155
|
+
// One default export serves every method, so pairing matches it
|
|
156
|
+
// against whichever method a caller uses.
|
|
157
157
|
method: { type: "literal", value: "*" },
|
|
158
158
|
path: PAGES_ROUTES
|
|
159
159
|
}
|
|
@@ -177,7 +177,7 @@ function nextjsFramework() {
|
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
// Response.json(body, { status }), the platform's own, which a
|
|
180
|
-
// handler can
|
|
180
|
+
// handler can call without an import.
|
|
181
181
|
kind: "response",
|
|
182
182
|
match: { type: "functionCall", functionName: "Response.json" },
|
|
183
183
|
extraction: {
|
|
@@ -187,8 +187,8 @@ function nextjsFramework() {
|
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
|
-
// new Response(body, { status }), which a handler returns for
|
|
191
|
-
//
|
|
190
|
+
// new Response(body, { status }), which a handler returns for a
|
|
191
|
+
// body that is not JSON, such as a stream or plain text.
|
|
192
192
|
kind: "response",
|
|
193
193
|
match: { type: "functionCall", functionName: "Response" },
|
|
194
194
|
extraction: {
|
|
@@ -198,9 +198,8 @@ function nextjsFramework() {
|
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
|
-
// NextResponse.redirect(url) sends a 307
|
|
202
|
-
//
|
|
203
|
-
// this pack does not read yet.
|
|
201
|
+
// NextResponse.redirect(url) sends a 307 by default. Another status
|
|
202
|
+
// goes in an init object, which this pack does not read yet.
|
|
204
203
|
kind: "response",
|
|
205
204
|
match: {
|
|
206
205
|
type: "functionCall",
|
|
@@ -210,8 +209,8 @@ function nextjsFramework() {
|
|
|
210
209
|
extraction: { defaultStatusCode: 307 }
|
|
211
210
|
},
|
|
212
211
|
{
|
|
213
|
-
// A pages handler writes to the response
|
|
214
|
-
//
|
|
212
|
+
// A pages handler writes to the response object passed to it, as
|
|
213
|
+
// an Express handler does.
|
|
215
214
|
kind: "response",
|
|
216
215
|
match: {
|
|
217
216
|
type: "parameterMethodCall",
|
|
@@ -241,9 +240,9 @@ function nextjsFramework() {
|
|
|
241
240
|
extraction: {}
|
|
242
241
|
}
|
|
243
242
|
],
|
|
244
|
-
//
|
|
245
|
-
//
|
|
246
|
-
//
|
|
243
|
+
// Both kinds of handler take the request first. An app handler gets a
|
|
244
|
+
// context object with the route parameters second, and a pages handler
|
|
245
|
+
// gets the response object in that position.
|
|
247
246
|
inputMapping: {
|
|
248
247
|
type: "positionalParams",
|
|
249
248
|
params: [
|
|
@@ -257,7 +256,7 @@ var declares = {
|
|
|
257
256
|
kind: "framework",
|
|
258
257
|
package: "@suss/framework-nextjs",
|
|
259
258
|
dependencies: [{ ecosystem: "npm", name: "next" }],
|
|
260
|
-
reads: `Next.js route handlers, pages
|
|
259
|
+
reads: `Next.js route handlers, pages and server actions. The route comes from where the file is on disk, and a \`"use server"\` function becomes an action unit.`
|
|
261
260
|
};
|
|
262
261
|
var index_default = nextjsFramework;
|
|
263
262
|
export {
|