lumen-framework 3.1.0 → 4.0.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/README.md +75 -109
- package/bin/lumen +23 -41
- package/dist/cli.cjs +856 -479
- package/dist/cli.cjs.map +4 -4
- package/dist/index.js +3284 -1720
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +3263 -1699
- package/dist/index.mjs.map +4 -4
- package/dist/testing.js +280 -0
- package/dist/testing.js.map +7 -0
- package/dist/testing.mjs +252 -0
- package/dist/testing.mjs.map +7 -0
- package/dist/types/errors/links-only-error.d.ts +13 -0
- package/dist/types/errors/reserved-field-name-error.d.ts +13 -0
- package/dist/types/errors/unknown-attribute-error.d.ts +13 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/interfaces.d.ts +1 -1
- package/dist/types/packages/application/index.d.ts +38 -45
- package/dist/types/packages/application/initialize.d.ts +3 -5
- package/dist/types/packages/application/interfaces.d.ts +13 -5
- package/dist/types/packages/application/utils/create-controller.d.ts +14 -4
- package/dist/types/packages/application/utils/create-serializer.d.ts +2 -2
- package/dist/types/packages/application/utils/normalize-port.d.ts +1 -3
- package/dist/types/packages/application/utils/resolve-visibility.d.ts +15 -0
- package/dist/types/packages/application/utils/restrict-open-namespaces.d.ts +19 -0
- package/dist/types/packages/application/utils/validate-attributes.d.ts +17 -0
- package/dist/types/packages/application/utils/validate-links-only.d.ts +19 -0
- package/dist/types/packages/application/utils/validate-namespaced-serializers.d.ts +3 -3
- package/dist/types/packages/application/utils/validate-reserved-names.d.ts +12 -0
- package/dist/types/packages/application/utils/warn-query-param-names.d.ts +10 -0
- package/dist/types/packages/cli/commands/dbcreate.d.ts +1 -1
- package/dist/types/packages/cli/commands/dbdrop.d.ts +1 -1
- package/dist/types/packages/cli/commands/destroy.d.ts +3 -2
- package/dist/types/packages/cli/commands/generate.d.ts +5 -5
- package/dist/types/packages/cli/commands/index.d.ts +0 -1
- package/dist/types/packages/cli/generator/index.d.ts +6 -6
- package/dist/types/packages/cli/generator/interfaces.d.ts +3 -3
- package/dist/types/packages/cli/generator/utils/create-generator.d.ts +2 -2
- package/dist/types/packages/cli/generator/utils/generate-type.d.ts +9 -9
- package/dist/types/packages/cli/generator/utils/migration-conflict.d.ts +4 -4
- package/dist/types/packages/cli/templates/pnpm-workspace.d.ts +15 -0
- package/dist/types/packages/cli/utils/create-spinner.d.ts +14 -0
- package/dist/types/packages/cli/utils/print-statements.d.ts +12 -0
- package/dist/types/packages/cli/utils/server-database.d.ts +27 -0
- package/dist/types/packages/compiler/interfaces.d.ts +1 -1
- package/dist/types/packages/config/interfaces.d.ts +10 -4
- package/dist/types/packages/controller/constants.d.ts +7 -2
- package/dist/types/packages/controller/errors/related-record-not-found-error.d.ts +4 -4
- package/dist/types/packages/controller/index.d.ts +364 -473
- package/dist/types/packages/controller/interfaces.d.ts +21 -6
- package/dist/types/packages/controller/utils/find-many.d.ts +2 -5
- package/dist/types/packages/controller/utils/find-one.d.ts +2 -5
- package/dist/types/packages/controller/utils/params-to-query.d.ts +8 -10
- package/dist/types/packages/controller/utils/resolve-relationships.d.ts +1 -3
- package/dist/types/packages/controller/utils/validate-relationships.d.ts +5 -3
- package/dist/types/packages/controller/visibility/errors.d.ts +21 -0
- package/dist/types/packages/controller/visibility/index.d.ts +51 -0
- package/dist/types/packages/database/attribute/index.d.ts +4 -6
- package/dist/types/packages/database/attribute/interfaces.d.ts +1 -1
- package/dist/types/packages/database/attribute/utils/create-attribute.d.ts +3 -5
- package/dist/types/packages/database/attribute/utils/create-getter.d.ts +2 -2
- package/dist/types/packages/database/attribute/utils/create-setter.d.ts +3 -5
- package/dist/types/packages/database/constants.d.ts +1 -0
- package/dist/types/packages/database/errors/index.d.ts +1 -0
- package/dist/types/packages/database/errors/invalid-driver-error.d.ts +1 -3
- package/dist/types/packages/database/errors/migrations-pending-error.d.ts +1 -3
- package/dist/types/packages/database/errors/model-missing-error.d.ts +1 -3
- package/dist/types/packages/database/errors/relationship-config-error.d.ts +10 -0
- package/dist/types/packages/database/errors/unique-constraint-error.d.ts +1 -1
- package/dist/types/packages/database/index.d.ts +9 -6
- package/dist/types/packages/database/initialize.d.ts +3 -5
- package/dist/types/packages/database/interfaces.d.ts +115 -25
- package/dist/types/packages/database/migration/index.d.ts +5 -7
- package/dist/types/packages/database/migration/interfaces.d.ts +2 -4
- package/dist/types/packages/database/migration/utils/generate-timestamp.d.ts +9 -1
- package/dist/types/packages/database/model/index.d.ts +348 -759
- package/dist/types/packages/database/model/initialize-class.d.ts +7 -1
- package/dist/types/packages/database/model/interfaces.d.ts +30 -12
- package/dist/types/packages/database/model/utils/attribute.d.ts +14 -0
- package/dist/types/packages/database/model/utils/get-columns.d.ts +1 -3
- package/dist/types/packages/database/model/utils/persistence.d.ts +5 -14
- package/dist/types/packages/database/model/utils/process-write-error.d.ts +2 -2
- package/dist/types/packages/database/model/utils/run-hooks.d.ts +7 -3
- package/dist/types/packages/database/model/utils/validate.d.ts +4 -1
- package/dist/types/packages/database/query/errors/record-not-found-error.d.ts +1 -1
- package/dist/types/packages/database/query/index.d.ts +179 -3
- package/dist/types/packages/database/query/runner/index.d.ts +1 -3
- package/dist/types/packages/database/query/runner/utils/build-results.d.ts +3 -4
- package/dist/types/packages/database/query/utils/format-select.d.ts +1 -3
- package/dist/types/packages/database/relationship/index.d.ts +7 -6
- package/dist/types/packages/database/relationship/interfaces.d.ts +16 -3
- package/dist/types/packages/database/relationship/utils/getters.d.ts +7 -13
- package/dist/types/packages/database/relationship/utils/inverse-setters.d.ts +5 -9
- package/dist/types/packages/database/relationship/utils/setters.d.ts +7 -13
- package/dist/types/packages/database/relationship/utils/unassociate.d.ts +1 -3
- package/dist/types/packages/database/relationship/utils/update-relationship.d.ts +6 -2
- package/dist/types/packages/database/transaction/index.d.ts +9 -10
- package/dist/types/packages/database/transaction/interfaces.d.ts +7 -1
- package/dist/types/packages/database/utils/connect.d.ts +16 -3
- package/dist/types/packages/database/utils/create-migrations.d.ts +1 -3
- package/dist/types/packages/database/utils/normalize-model-name.d.ts +1 -3
- package/dist/types/packages/database/utils/pending-migrations.d.ts +1 -3
- package/dist/types/packages/database/utils/primary-key-type.d.ts +10 -0
- package/dist/types/packages/database/utils/type-for-column.d.ts +3 -5
- package/dist/types/packages/database/utils/validate-relationships.d.ts +13 -0
- package/dist/types/packages/database/validation/errors/validation-error.d.ts +4 -4
- package/dist/types/packages/database/validation/index.d.ts +3 -5
- package/dist/types/packages/database/validation/interfaces.d.ts +1 -1
- package/dist/types/packages/freezeable/map/index.d.ts +1 -3
- package/dist/types/packages/freezeable/set/index.d.ts +1 -3
- package/dist/types/packages/freezeable/utils/freeze.d.ts +5 -15
- package/dist/types/packages/freezeable/utils/is-frozen.d.ts +1 -3
- package/dist/types/packages/fs/index.d.ts +7 -7
- package/dist/types/packages/fs/interfaces.d.ts +4 -4
- package/dist/types/packages/fs/utils/parse-path.d.ts +2 -2
- package/dist/types/packages/fs/watcher/interfaces.d.ts +1 -1
- package/dist/types/packages/jsonapi/errors/invalid-content-type-error.d.ts +3 -5
- package/dist/types/packages/jsonapi/errors/not-acceptable-error.d.ts +2 -4
- package/dist/types/packages/jsonapi/errors/unsupported-media-type-error.d.ts +2 -4
- package/dist/types/packages/jsonapi/index.d.ts +1 -1
- package/dist/types/packages/jsonapi/interfaces.d.ts +47 -36
- package/dist/types/packages/jsonapi/utils/has-media-type-params.d.ts +1 -1
- package/dist/types/packages/jsonapi/utils/is-jsonapi.d.ts +1 -1
- package/dist/types/packages/jsonapi/utils/media-type.d.ts +2 -2
- package/dist/types/packages/loader/builder/index.d.ts +3 -3
- package/dist/types/packages/loader/builder/interfaces.d.ts +7 -7
- package/dist/types/packages/loader/builder/utils/create-children-builder.d.ts +2 -2
- package/dist/types/packages/loader/builder/utils/create-parent-builder.d.ts +9 -2
- package/dist/types/packages/loader/builder/utils/sort-by-namespace.d.ts +2 -2
- package/dist/types/packages/loader/index.d.ts +1 -1
- package/dist/types/packages/loader/interfaces.d.ts +2 -2
- package/dist/types/packages/loader/resolver/index.d.ts +2 -2
- package/dist/types/packages/loader/resolver/utils/closest-ancestor.d.ts +2 -2
- package/dist/types/packages/loader/resolver/utils/closest-child.d.ts +2 -2
- package/dist/types/packages/logger/constants.d.ts +3 -3
- package/dist/types/packages/logger/errors/invalid-config-error.d.ts +5 -0
- package/dist/types/packages/logger/index.d.ts +65 -142
- package/dist/types/packages/logger/interfaces.d.ts +52 -10
- package/dist/types/packages/logger/request-logger/index.d.ts +3 -5
- package/dist/types/packages/logger/request-logger/interfaces.d.ts +5 -5
- package/dist/types/packages/logger/request-logger/templates.d.ts +5 -9
- package/dist/types/packages/logger/request-logger/utils/filter-params.d.ts +6 -1
- package/dist/types/packages/logger/request-logger/utils/log-json.d.ts +2 -4
- package/dist/types/packages/logger/request-logger/utils/log-text.d.ts +1 -3
- package/dist/types/packages/logger/request-logger/utils/params-for.d.ts +9 -0
- package/dist/types/packages/logger/utils/error-name.d.ts +7 -0
- package/dist/types/packages/logger/utils/line.d.ts +1 -3
- package/dist/types/packages/logger/writer/constants.d.ts +0 -1
- package/dist/types/packages/logger/writer/index.d.ts +6 -6
- package/dist/types/packages/logger/writer/interfaces.d.ts +2 -2
- package/dist/types/packages/logger/writer/utils/format-message.d.ts +2 -2
- package/dist/types/packages/lumenify/index.d.ts +20 -5
- package/dist/types/packages/lumenify/utils/create-response-proxy.d.ts +1 -1
- package/dist/types/packages/pm/cluster/index.d.ts +56 -7
- package/dist/types/packages/pm/cluster/interfaces.d.ts +2 -1
- package/dist/types/packages/pm/index.d.ts +2 -2
- package/dist/types/packages/router/definitions/context/index.d.ts +5 -7
- package/dist/types/packages/router/definitions/context/utils/create-definition-group.d.ts +3 -5
- package/dist/types/packages/router/definitions/context/utils/create-definition.d.ts +11 -6
- package/dist/types/packages/router/definitions/context/utils/normalize-resource-args.d.ts +4 -5
- package/dist/types/packages/router/definitions/index.d.ts +5 -9
- package/dist/types/packages/router/definitions/interfaces.d.ts +4 -4
- package/dist/types/packages/router/index.d.ts +23 -11
- package/dist/types/packages/router/interfaces.d.ts +4 -4
- package/dist/types/packages/router/namespace/index.d.ts +7 -9
- package/dist/types/packages/router/namespace/interfaces.d.ts +3 -3
- package/dist/types/packages/router/namespace/utils/normalize-name.d.ts +1 -3
- package/dist/types/packages/router/namespace/utils/normalize-path.d.ts +1 -3
- package/dist/types/packages/router/resource/index.d.ts +7 -8
- package/dist/types/packages/router/resource/interfaces.d.ts +12 -4
- package/dist/types/packages/router/resource/utils/normalize-only.d.ts +3 -5
- package/dist/types/packages/router/route/action/enhancers/resource.d.ts +1 -3
- package/dist/types/packages/router/route/action/enhancers/track-perf.d.ts +1 -3
- package/dist/types/packages/router/route/action/index.d.ts +7 -2
- package/dist/types/packages/router/route/action/interfaces.d.ts +4 -0
- package/dist/types/packages/router/route/action/utils/create-page-links.d.ts +21 -5
- package/dist/types/packages/router/route/action/utils/get-action-name.d.ts +1 -3
- package/dist/types/packages/router/route/action/utils/get-controller-name.d.ts +1 -3
- package/dist/types/packages/router/route/index.d.ts +13 -9
- package/dist/types/packages/router/route/interfaces.d.ts +7 -5
- package/dist/types/packages/router/route/params/errors/client-generated-id-error.d.ts +4 -4
- package/dist/types/packages/router/route/params/errors/forbidden-parameter-error.d.ts +4 -4
- package/dist/types/packages/router/route/params/errors/index.d.ts +1 -0
- package/dist/types/packages/router/route/params/errors/invalid-parameter-error.d.ts +4 -6
- package/dist/types/packages/router/route/params/errors/parameter-not-nullable-error.d.ts +4 -6
- package/dist/types/packages/router/route/params/errors/parameter-range-error.d.ts +9 -0
- package/dist/types/packages/router/route/params/errors/parameter-required-error.d.ts +4 -6
- package/dist/types/packages/router/route/params/errors/parameter-type-error.d.ts +4 -6
- package/dist/types/packages/router/route/params/errors/parameter-value-error.d.ts +4 -6
- package/dist/types/packages/router/route/params/errors/resource-mismatch-error.d.ts +4 -6
- package/dist/types/packages/router/route/params/index.d.ts +5 -9
- package/dist/types/packages/router/route/params/interfaces.d.ts +12 -8
- package/dist/types/packages/router/route/params/parameter/forbidden-parameter.d.ts +1 -1
- package/dist/types/packages/router/route/params/parameter/ignored-parameter.d.ts +14 -0
- package/dist/types/packages/router/route/params/parameter/index.d.ts +21 -5
- package/dist/types/packages/router/route/params/parameter/interfaces.d.ts +2 -2
- package/dist/types/packages/router/route/params/parameter/utils/validate-range.d.ts +3 -0
- package/dist/types/packages/router/route/params/parameter/utils/validate-value.d.ts +1 -3
- package/dist/types/packages/router/route/params/parameter-group/index.d.ts +3 -5
- package/dist/types/packages/router/route/params/parameter-group/utils/missing-params.d.ts +8 -0
- package/dist/types/packages/router/route/params/utils/get-data-params.d.ts +5 -1
- package/dist/types/packages/router/route/params/utils/get-default-collection-params.d.ts +1 -3
- package/dist/types/packages/router/route/params/utils/get-default-member-params.d.ts +5 -2
- package/dist/types/packages/router/route/params/utils/get-query-params.d.ts +3 -9
- package/dist/types/packages/router/route/params/utils/get-url-params.d.ts +1 -3
- package/dist/types/packages/router/route/params/utils/parse-column-value.d.ts +16 -0
- package/dist/types/packages/router/route/params/utils/validate-client-id.d.ts +1 -1
- package/dist/types/packages/router/route/params/utils/validate-resource-id.d.ts +1 -3
- package/dist/types/packages/router/route/params/utils/validate-type.d.ts +3 -5
- package/dist/types/packages/router/route/utils/get-dynamic-segments.d.ts +1 -3
- package/dist/types/packages/router/route/utils/get-static-path.d.ts +6 -2
- package/dist/types/packages/router/utils/create-replacer.d.ts +10 -2
- package/dist/types/packages/serializer/index.d.ts +243 -434
- package/dist/types/packages/serializer/interfaces.d.ts +19 -1
- package/dist/types/packages/serializer/utils/include-tree.d.ts +12 -3
- package/dist/types/packages/serializer/utils/load-linkage.d.ts +9 -3
- package/dist/types/packages/server/errors/error-list.d.ts +25 -0
- package/dist/types/packages/server/errors/method-not-allowed-error.d.ts +11 -0
- package/dist/types/packages/server/index.d.ts +9 -9
- package/dist/types/packages/server/interfaces.d.ts +59 -7
- package/dist/types/packages/server/request/constants.d.ts +2 -2
- package/dist/types/packages/server/request/index.d.ts +3 -5
- package/dist/types/packages/server/request/interfaces.d.ts +72 -8
- package/dist/types/packages/server/request/parser/errors/malformed-request-error.d.ts +3 -5
- package/dist/types/packages/server/request/parser/index.d.ts +6 -1
- package/dist/types/packages/server/request/parser/utils/format.d.ts +13 -11
- package/dist/types/packages/server/request/parser/utils/normalize-document.d.ts +13 -0
- package/dist/types/packages/server/request/parser/utils/parse-nested-object.d.ts +1 -3
- package/dist/types/packages/server/request/parser/utils/parse-read.d.ts +2 -4
- package/dist/types/packages/server/request/parser/utils/parse-write.d.ts +17 -1
- package/dist/types/packages/server/request/utils/get-domain.d.ts +1 -3
- package/dist/types/packages/server/responder/index.d.ts +1 -3
- package/dist/types/packages/server/responder/utils/content-type-for.d.ts +8 -0
- package/dist/types/packages/server/responder/utils/data-for.d.ts +3 -5
- package/dist/types/packages/server/responder/utils/normalize.d.ts +2 -3
- package/dist/types/packages/server/response/index.d.ts +3 -5
- package/dist/types/packages/server/response/interfaces.d.ts +14 -3
- package/dist/types/packages/server/utils/client-ip-for.d.ts +10 -0
- package/dist/types/packages/server/utils/create-server-error.d.ts +11 -3
- package/dist/types/packages/server/utils/request-id-for.d.ts +9 -0
- package/dist/types/packages/server/utils/set-cors-headers.d.ts +2 -2
- package/dist/types/packages/server/utils/source-for.d.ts +19 -3
- package/dist/types/packages/server/utils/status-for-error.d.ts +6 -0
- package/dist/types/packages/server/utils/validate-accept.d.ts +1 -1
- package/dist/types/packages/server/utils/validate-content-type.d.ts +8 -3
- package/dist/types/packages/testing/audit-visibility.d.ts +189 -0
- package/dist/types/packages/testing/index.d.ts +4 -0
- package/dist/types/packages/testing/start-app.d.ts +52 -0
- package/dist/types/packages/testing/utils/identifiers-in.d.ts +14 -0
- package/dist/types/testing.d.ts +9 -0
- package/dist/types/utils/chalk.d.ts +16 -0
- package/dist/types/utils/pick.d.ts +2 -2
- package/package.json +54 -26
- package/dist/types/packages/cli/commands/test.d.ts +0 -4
- package/dist/types/packages/logger/utils/sql.d.ts +0 -4
- package/dist/types/packages/router/route/params/parameter-group/utils/has-required-params.d.ts +0 -5
- package/dist/types/utils/create-query-string.d.ts +0 -6
- package/dist/types/utils/has-own-property.d.ts +0 -1
|
@@ -1,182 +1,105 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { RequestLoggerFn } from './request-logger/interfaces';
|
|
2
|
+
import type { LoggerConfig, LogFormat, LogLevel, LogFunction, LogFilter } from './interfaces';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
4
|
+
* The application's logger, configured by the `logging` section of
|
|
5
|
+
* `config/environments/<environment>.js` ({@link LoggerConfig}). Actions and
|
|
6
|
+
* hooks reach it as `request.logger`, models as `Model.logger`.
|
|
7
|
+
*
|
|
8
|
+
* It logs every request, server errors, and — with the database's `debug` on —
|
|
9
|
+
* SQL, and has a method per level for the app's own messages. See the
|
|
10
|
+
* [logging guide](https://github.com/nickschot/lux/blob/main/docs/guides/logging.md).
|
|
6
11
|
*/
|
|
7
12
|
declare class Logger {
|
|
13
|
+
/** The least severe level written: `DEBUG`, `INFO`, `WARN` or `ERROR`. */
|
|
14
|
+
level: LogLevel;
|
|
15
|
+
/** `text`, lines for people, or `json`, one object per line. */
|
|
16
|
+
format: LogFormat;
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
level: Logger$level;
|
|
16
|
-
/**
|
|
17
|
-
* The output format of log data (text or json).
|
|
18
|
-
*
|
|
19
|
-
* @property format
|
|
20
|
-
* @type {String}
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
format: Logger$format;
|
|
24
|
-
/**
|
|
25
|
-
* Hackers love logs. It's easy to get sensitive user information from log
|
|
26
|
-
* data if your server has been breached. To prevent leaking sensitive
|
|
27
|
-
* information in a potential attack, blacklist certain keys that should be
|
|
28
|
-
* filtered out of the logs.
|
|
18
|
+
* Parameters to keep out of the logs. A parameter whose name contains
|
|
19
|
+
* `password`, `secret` or `token`, or a name listed in `filter.params`,
|
|
20
|
+
* ignoring case, is logged as `[FILTERED]` — in the body, the query string
|
|
21
|
+
* and inside arrays:
|
|
29
22
|
*
|
|
30
23
|
* ```javascript
|
|
31
|
-
* // config/environments/
|
|
24
|
+
* // config/environments/production.js
|
|
32
25
|
* export default {
|
|
33
26
|
* logging: {
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* enabled: true,
|
|
37
|
-
* filter: {
|
|
38
|
-
* params: ['password']
|
|
39
|
-
* }
|
|
27
|
+
* // …
|
|
28
|
+
* filter: { params: ['email'] } // also filters `recoveryEmail`
|
|
40
29
|
* }
|
|
41
30
|
* };
|
|
42
31
|
* ```
|
|
43
|
-
*
|
|
44
|
-
* Now that we've added password to the array of parameters we want to filter
|
|
45
|
-
* out of the logs, let's try to create a new user.
|
|
46
|
-
*
|
|
47
|
-
* ```http
|
|
48
|
-
* POST /users HTTP/1.1
|
|
49
|
-
* Content-Type: application/vnd.api+json
|
|
50
|
-
* Host: 127.0.0.1:4000
|
|
51
|
-
* Connection: close
|
|
52
|
-
* User-Agent: Paw/3.0.14 (Macintosh; OS X/10.12.1) GCDHTTPRequest
|
|
53
|
-
* Content-Length: 188
|
|
54
|
-
*
|
|
55
|
-
* {
|
|
56
|
-
* "data": {
|
|
57
|
-
* "type": "users",
|
|
58
|
-
* "attributes": {
|
|
59
|
-
* "name": "Zachary Golba",
|
|
60
|
-
* "email": "zachary.golba@postlight.com",
|
|
61
|
-
* "password": "vcZxniFYyfnFDcLn%nhe8Vrt"
|
|
62
|
-
* }
|
|
63
|
-
* }
|
|
64
|
-
* }
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* The request above will yield the following log message.
|
|
68
|
-
*
|
|
69
|
-
* ```text
|
|
70
|
-
* [2016-12-10T18:28:04.610Z] Processed POST "/users" from ::ffff:127.0.0.1
|
|
71
|
-
* with 201 Created by UsersController#create
|
|
72
|
-
*
|
|
73
|
-
* Params
|
|
74
|
-
*
|
|
75
|
-
* {
|
|
76
|
-
* "data": {
|
|
77
|
-
* "type": "users",
|
|
78
|
-
* "attributes": {
|
|
79
|
-
* "name": "Zachary Golba",
|
|
80
|
-
* "email": "zachary.golba@postlight.com",
|
|
81
|
-
* "password": "[FILTERED]"
|
|
82
|
-
* }
|
|
83
|
-
* }
|
|
84
|
-
* }
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* It worked! The password value did not leak into the log message.
|
|
88
|
-
*
|
|
89
|
-
* @property filter
|
|
90
|
-
* @type {Object}
|
|
91
|
-
* @public
|
|
92
32
|
*/
|
|
93
|
-
filter:
|
|
33
|
+
filter: LogFilter;
|
|
34
|
+
/** Whether anything is logged; off in the test environment. */
|
|
35
|
+
enabled: boolean;
|
|
94
36
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @public
|
|
37
|
+
* Whether the request log includes the request body — the JSON:API document
|
|
38
|
+
* of a `POST` or `PATCH`. Off unless enabled, and off by default in
|
|
39
|
+
* production: a body is large and full of user data. Query and route params
|
|
40
|
+
* are always logged (filtered).
|
|
100
41
|
*/
|
|
101
|
-
|
|
42
|
+
requestBody: boolean;
|
|
102
43
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* logger.debug('Hello World!');
|
|
107
|
-
* // => [6/4/16 5:46:53 PM] Hello World!
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* @method debug
|
|
111
|
-
* @param {any} data - The data you wish to log.
|
|
112
|
-
* @return {void}
|
|
113
|
-
* @public
|
|
44
|
+
* Whether the text format stamps each line with the time. Turn it off where
|
|
45
|
+
* the platform already does — Heroku prefixes every line with its own — to
|
|
46
|
+
* avoid two timestamps per line. The JSON format always includes it.
|
|
114
47
|
*/
|
|
115
|
-
|
|
48
|
+
timestamps: boolean;
|
|
116
49
|
/**
|
|
117
|
-
* Log a message at
|
|
50
|
+
* Log a message at `DEBUG`.
|
|
51
|
+
*
|
|
52
|
+
* `context` adds fields to the line: top-level fields in JSON, left out of
|
|
53
|
+
* text. Pass the request's id to tie the message to its request:
|
|
118
54
|
*
|
|
119
55
|
* ```javascript
|
|
120
|
-
* logger.
|
|
121
|
-
* // => [6/4/16 5:46:53 PM] Hello World!
|
|
56
|
+
* request.logger.debug('Cache miss', { requestId: request.id });
|
|
122
57
|
* ```
|
|
123
|
-
*
|
|
124
|
-
* @method info
|
|
125
|
-
* @param {any} data - The data you wish to log.
|
|
126
|
-
* @return {void}
|
|
127
|
-
* @public
|
|
128
58
|
*/
|
|
129
|
-
|
|
59
|
+
debug: LogFunction;
|
|
130
60
|
/**
|
|
131
|
-
* Log a message at
|
|
61
|
+
* Log a message at `INFO`.
|
|
62
|
+
*
|
|
63
|
+
* `context` adds fields to the line: top-level fields in JSON, left out of
|
|
64
|
+
* text. Pass the request's id to tie the message to its request:
|
|
132
65
|
*
|
|
133
66
|
* ```javascript
|
|
134
|
-
* logger.
|
|
135
|
-
* // => [6/4/16 5:46:53 PM] Good Bye World!
|
|
67
|
+
* request.logger.info('Synced posts', { requestId: request.id });
|
|
136
68
|
* ```
|
|
137
|
-
*
|
|
138
|
-
* @method warn
|
|
139
|
-
* @param {any} data - The data you wish to log.
|
|
140
|
-
* @return {void}
|
|
141
|
-
* @public
|
|
142
69
|
*/
|
|
143
|
-
|
|
70
|
+
info: LogFunction;
|
|
144
71
|
/**
|
|
145
|
-
* Log a message at
|
|
72
|
+
* Log a message at `WARN`.
|
|
73
|
+
*
|
|
74
|
+
* `context` adds fields to the line: top-level fields in JSON, left out of
|
|
75
|
+
* text. Pass the request's id to tie the message to its request:
|
|
146
76
|
*
|
|
147
77
|
* ```javascript
|
|
148
|
-
* logger.warn('
|
|
149
|
-
* // => [6/4/16 5:46:53 PM] HELP!
|
|
78
|
+
* request.logger.warn('Slow upstream', { requestId: request.id });
|
|
150
79
|
* ```
|
|
151
|
-
*
|
|
152
|
-
* @method error
|
|
153
|
-
* @param {any} data - The data you wish to log.
|
|
154
|
-
* @return {void}
|
|
155
|
-
* @public
|
|
156
80
|
*/
|
|
157
|
-
|
|
81
|
+
warn: LogFunction;
|
|
158
82
|
/**
|
|
159
|
-
*
|
|
83
|
+
* Log a message, or an error with its stack, at `ERROR`.
|
|
84
|
+
*
|
|
85
|
+
* `context` adds fields to the line: top-level fields in JSON, left out of
|
|
86
|
+
* text. Pass the request's id to tie the message to its request:
|
|
160
87
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* @param {Object} opts - An options object.
|
|
165
|
-
* @param {Number} opts.startTime - The timestamp from when the request was
|
|
166
|
-
* received.
|
|
167
|
-
* @return {void}
|
|
168
|
-
* @private
|
|
88
|
+
* ```javascript
|
|
89
|
+
* request.logger.error('Sync failed', { requestId: request.id });
|
|
90
|
+
* ```
|
|
169
91
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
92
|
+
error: LogFunction;
|
|
93
|
+
/** @internal */
|
|
94
|
+
request: RequestLoggerFn;
|
|
95
|
+
constructor({ level, format, filter, enabled, requestBody, timestamps }: LoggerConfig);
|
|
172
96
|
/**
|
|
173
|
-
* @
|
|
174
|
-
* @
|
|
175
|
-
* @private
|
|
97
|
+
* @returns The current time as an ISO8601 string.
|
|
98
|
+
* @internal
|
|
176
99
|
*/
|
|
177
100
|
getTimestamp(): string;
|
|
178
101
|
}
|
|
179
102
|
export default Logger;
|
|
180
103
|
export { default as line } from './utils/line';
|
|
181
|
-
export { default as
|
|
182
|
-
export type {
|
|
104
|
+
export { default as errorName } from './utils/error-name';
|
|
105
|
+
export type { LoggerConfig, LogFilter, LogFormat, LogFunction, LogLevel } from './interfaces';
|
|
@@ -1,17 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/** A log level, from most to least verbose. */
|
|
2
|
+
export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
3
|
+
/**
|
|
4
|
+
* `context` is written alongside the message as top-level fields in JSON
|
|
5
|
+
* format (e.g. a `requestId` tying an error to its request line); the text
|
|
6
|
+
* format leaves it out.
|
|
7
|
+
*/
|
|
8
|
+
export type LogFunction = (data: string | Error | Record<string, unknown>, context?: Record<string, unknown>) => void;
|
|
9
|
+
/** Lines for people (`text`) or one JSON object per line (`json`). */
|
|
10
|
+
export type LogFormat = 'text' | 'json';
|
|
11
|
+
export type LogData = {
|
|
12
|
+
level: LogLevel;
|
|
6
13
|
message?: unknown;
|
|
14
|
+
context?: Record<string, unknown>;
|
|
7
15
|
timestamp: string;
|
|
8
16
|
};
|
|
9
|
-
|
|
17
|
+
/** Parameters to keep out of the logs. */
|
|
18
|
+
export type LogFilter = {
|
|
19
|
+
/**
|
|
20
|
+
* Names of parameters to log as `[FILTERED]`, matched by containment and
|
|
21
|
+
* ignoring case, in addition to `password`, `secret` and `token`.
|
|
22
|
+
*/
|
|
10
23
|
params: string[];
|
|
11
24
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The `logging` section of `config/environments/<environment>.js`.
|
|
27
|
+
*
|
|
28
|
+
* ```javascript
|
|
29
|
+
* logging: {
|
|
30
|
+
* level: 'INFO',
|
|
31
|
+
* format: 'json',
|
|
32
|
+
* enabled: true,
|
|
33
|
+
* requestBody: false,
|
|
34
|
+
* filter: { params: ['email'] }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* An unknown `level` or `format` fails the boot.
|
|
39
|
+
*/
|
|
40
|
+
export type LoggerConfig = {
|
|
41
|
+
/** The least severe level written: `DEBUG` (development), `INFO` (production). */
|
|
42
|
+
level: LogLevel;
|
|
43
|
+
/** `text` (development) or `json` (production). */
|
|
44
|
+
format: LogFormat;
|
|
45
|
+
/** Parameters to filter, beyond the built-in ones. */
|
|
46
|
+
filter: LogFilter;
|
|
47
|
+
/** Whether anything is logged; off in the test environment. */
|
|
16
48
|
enabled: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a request's logged parameters include its body. Defaults to on,
|
|
51
|
+
* except in production.
|
|
52
|
+
*/
|
|
53
|
+
requestBody?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether text lines start with the time. Defaults to on; turn it off where
|
|
56
|
+
* the platform stamps every line itself.
|
|
57
|
+
*/
|
|
58
|
+
timestamps?: boolean;
|
|
17
59
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type Logger from '../index';
|
|
2
|
-
import type {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export declare function createRequestLogger(logger: Logger): Logger$RequestLogger;
|
|
2
|
+
import type { RequestLoggerFn } from './interfaces';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare function createRequestLogger(logger: Logger): RequestLoggerFn;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { Route } from '../../router';
|
|
2
2
|
import type { Request, Response } from '../../server';
|
|
3
|
-
export type
|
|
3
|
+
export type RequestLoggerFn = (req: Request, res: Response, opts: {
|
|
4
4
|
startTime: number;
|
|
5
5
|
}) => void;
|
|
6
|
-
type
|
|
6
|
+
type RequestLoggerStat = {
|
|
7
7
|
type: string;
|
|
8
8
|
name: string;
|
|
9
9
|
duration: number;
|
|
10
10
|
controller: string;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type RequestLoggerTemplateData = {
|
|
13
13
|
path: string;
|
|
14
|
-
stats: Array<
|
|
14
|
+
stats: Array<RequestLoggerStat>;
|
|
15
15
|
route?: Route;
|
|
16
16
|
method: string;
|
|
17
17
|
params: Record<string, unknown>;
|
|
@@ -19,7 +19,7 @@ export type RequestLogger$templateData = {
|
|
|
19
19
|
endTime: number;
|
|
20
20
|
statusCode: string;
|
|
21
21
|
statusMessage: string;
|
|
22
|
-
remoteAddress
|
|
22
|
+
remoteAddress?: string;
|
|
23
23
|
colorStr(source: string): string;
|
|
24
24
|
};
|
|
25
25
|
export {};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export declare const
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
export declare const infoTemplate: ({ path, route, method, params, colorStr, startTime, endTime, statusCode, statusMessage, remoteAddress }: RequestLogger$templateData) => string;
|
|
1
|
+
import type { RequestLoggerTemplateData } from './interfaces';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare const debugTemplate: ({ path, stats, route, method, params, colorStr, startTime, endTime, statusCode, statusMessage, remoteAddress }: RequestLoggerTemplateData) => string;
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare const infoTemplate: ({ path, route, method, params, colorStr, startTime, endTime, statusCode, statusMessage, remoteAddress }: RequestLoggerTemplateData) => string;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Always filtered, on top of the app's `logging.filter.params`, so a missing
|
|
3
|
+
* config never leaks credentials into the logs.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
3
6
|
*/
|
|
7
|
+
export declare const FILTERED_PARAMS: readonly string[];
|
|
8
|
+
/** @internal */
|
|
4
9
|
export default function filterParams(params: Record<string, unknown>, ...filtered: string[]): Record<string, unknown>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type Logger from '../../index';
|
|
2
2
|
import type { Request, Response } from '../../../server';
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export default function logJSON(logger: Logger, { request: req, response: res }: {
|
|
3
|
+
/** @internal */
|
|
4
|
+
export default function logJSON(logger: Logger, { startTime, request: req, response: res }: {
|
|
7
5
|
startTime: number;
|
|
8
6
|
request: Request;
|
|
9
7
|
response: Response;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type Logger from '../../index';
|
|
2
2
|
import type { Request, Response } from '../../../server';
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
3
|
+
/** @internal */
|
|
6
4
|
export default function logText(logger: Logger, { startTime, request: req, response: res }: {
|
|
7
5
|
request: Request;
|
|
8
6
|
response: Response;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type Logger from '../../index';
|
|
2
|
+
import type { Request } from '../../../server';
|
|
3
|
+
/**
|
|
4
|
+
* The params a request is logged with: filtered, and without the body unless
|
|
5
|
+
* the logger's `requestBody` is on.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export default function paramsFor(logger: Logger, req: Request): Record<string, unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { LogFormat } from '../interfaces';
|
|
2
|
+
import type { LogWriter } from './interfaces';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare function createWriter(format: LogFormat, { timestamps }?: {
|
|
5
|
+
timestamps?: boolean;
|
|
6
|
+
}): LogWriter;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type
|
|
1
|
+
import type { LogData } from '../interfaces';
|
|
2
|
+
export type LogWriter = (data: LogData) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LogFormat } from '../../interfaces';
|
|
2
2
|
/**
|
|
3
3
|
* Returns `string | undefined` because `Error#stack` is optional — the Flow
|
|
4
4
|
* original had the same behaviour, it just did not say so.
|
|
@@ -6,4 +6,4 @@ import type { Logger$format } from '../../interfaces';
|
|
|
6
6
|
* `data` is required here; Flow allowed it to be declared optional ahead of a
|
|
7
7
|
* required parameter, which TypeScript does not (and every caller passes both).
|
|
8
8
|
*/
|
|
9
|
-
export default function formatMessage(data: unknown, format:
|
|
9
|
+
export default function formatMessage(data: unknown, format: LogFormat): string | undefined;
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import type { Action } from '../router';
|
|
2
2
|
import type { Request, Response } from '../server';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Wrap Connect-style middleware — `(req, res, next)`, the Express
|
|
5
|
+
* convention — as a {@link Controller.beforeAction} hook.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* ```javascript
|
|
8
|
+
* import { Controller, lumenify } from 'lumen-framework';
|
|
9
|
+
*
|
|
10
|
+
* function poweredBy(req, res, next) {
|
|
11
|
+
* res.setHeader('X-Powered-By', 'lumen');
|
|
12
|
+
* next();
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* class ApplicationController extends Controller {
|
|
16
|
+
* beforeAction = [lumenify(poweredBy)];
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* `next()` continues the request and `next(error)` ends it with that error;
|
|
21
|
+
* ending the response in the middleware ends the request too.
|
|
22
|
+
*
|
|
23
|
+
* @param middleware - The middleware to wrap.
|
|
24
|
+
* @returns A hook that resolves when the middleware calls `next`.
|
|
10
25
|
*/
|
|
11
26
|
export default function lumenify(middleware: (req: Request, res: Response, next: (err?: Error) => void) => void): Action<unknown>;
|
|
@@ -3,6 +3,6 @@ import type { Response } from '../../server';
|
|
|
3
3
|
* Create a Proxy that will trap typical node middleware callback invocations
|
|
4
4
|
* and route them to the appropriate Promise callback (resolve or reject).
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export default function createResponseProxy(res: Response, resolve: (result: unknown) => void): Response;
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
2
|
import { type Worker } from 'cluster';
|
|
3
3
|
import type Logger from '../../logger';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ClusterOptions } from './interfaces';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Why a worker never started listening.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare class WorkerBootError extends Error {
|
|
11
|
+
constructor(pid: number | undefined, reason: string);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Forks the application's worker processes, replaces one that crashes, and
|
|
15
|
+
* shuts them down gracefully.
|
|
16
|
+
*
|
|
17
|
+
* Emits `ready` once every worker of the initial fork is listening, and
|
|
18
|
+
* `error` (with a `WorkerBootError`) when one of them fails to start instead —
|
|
19
|
+
* an application that cannot boot should stop, not report it is listening.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
7
22
|
*/
|
|
8
23
|
declare class Cluster extends EventEmitter {
|
|
9
24
|
path: string;
|
|
@@ -11,11 +26,45 @@ declare class Cluster extends EventEmitter {
|
|
|
11
26
|
logger: Logger;
|
|
12
27
|
workers: Set<Worker>;
|
|
13
28
|
maxWorkers: number;
|
|
14
|
-
|
|
15
|
-
|
|
29
|
+
shutdownTimeout: number;
|
|
30
|
+
/**
|
|
31
|
+
* Workers being shut down on purpose (a reload or `stop()`), whose exit is
|
|
32
|
+
* not a crash to replace.
|
|
33
|
+
*/
|
|
34
|
+
retiring: WeakSet<Worker>;
|
|
35
|
+
/** Set by `stop()`: no worker is forked or replaced any more. */
|
|
36
|
+
stopping: boolean;
|
|
37
|
+
constructor({ path, port, logger, maxWorkers, shutdownTimeout }: ClusterOptions);
|
|
38
|
+
/**
|
|
39
|
+
* Fork a worker. Resolves with it once it is listening (or with `null`
|
|
40
|
+
* when the cluster is full or stopping); rejects with a `WorkerBootError`
|
|
41
|
+
* when it fails to start — it reports an error, exits, or does not listen
|
|
42
|
+
* within `BOOT_TIMEOUT` twice in a row.
|
|
43
|
+
*/
|
|
44
|
+
fork(retry?: boolean): Promise<Worker | null>;
|
|
45
|
+
/**
|
|
46
|
+
* A replacement for a crashed worker did not start. With none left, the
|
|
47
|
+
* application is down: stop, so the platform can restart it.
|
|
48
|
+
*/
|
|
49
|
+
replacementFailed(err: Error): void;
|
|
50
|
+
/**
|
|
51
|
+
* Shut `worker` down gracefully: it stops accepting connections, finishes
|
|
52
|
+
* the requests in flight, closes its database connections and exits. It is
|
|
53
|
+
* killed if it has not exited after `shutdownTimeout`.
|
|
54
|
+
*/
|
|
16
55
|
shutdown<T extends Worker>(worker: T): Promise<T>;
|
|
17
|
-
|
|
18
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Shut every worker down gracefully, booting ones included, and fork no
|
|
58
|
+
* more. Resolves once all have exited.
|
|
59
|
+
*/
|
|
60
|
+
stop(): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Replace every worker with one running the rebuilt application, two at a
|
|
63
|
+
* time. A replacement that fails to start is logged, and the cluster keeps
|
|
64
|
+
* watching: saving a fix reloads again.
|
|
65
|
+
*/
|
|
66
|
+
reload(): Promise<void>;
|
|
67
|
+
forkAll(): Promise<Array<Worker | null>>;
|
|
19
68
|
}
|
|
20
69
|
export default Cluster;
|
|
21
|
-
export type {
|
|
70
|
+
export type { ClusterOptions } from './interfaces';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Cluster from './cluster';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ClusterOptions } from './cluster';
|
|
3
3
|
/**
|
|
4
4
|
* @private
|
|
5
5
|
*/
|
|
6
|
-
export declare function createCluster({ path, port, logger, maxWorkers }:
|
|
6
|
+
export declare function createCluster({ path, port, logger, maxWorkers, shutdownTimeout }: ClusterOptions): Cluster;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { RouterNamespace } from '../../index';
|
|
2
|
+
import type { RouterDefinitionBuilder } from '../interfaces';
|
|
3
3
|
export type DefinitionContext = {
|
|
4
4
|
[key: string]: (...args: Array<any>) => unknown;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare function contextFor(build: Router$DefinitionBuilder<Router$Namespace>): {
|
|
10
|
-
create(namespace: Router$Namespace): DefinitionContext;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function contextFor(build: RouterDefinitionBuilder<RouterNamespace>): {
|
|
8
|
+
create(namespace: RouterNamespace): DefinitionContext;
|
|
11
9
|
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RouteType, RouterNamespace } from '../../../index';
|
|
2
2
|
type DefinitionFn = (name: string, action?: string) => void;
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export default function createDefinitionGroup<T extends Router$Namespace>(type: Route$type, namespace: T): Record<string, DefinitionFn>;
|
|
3
|
+
/** @internal */
|
|
4
|
+
export default function createDefinitionGroup<T extends RouterNamespace>(type: RouteType, namespace: T): Record<string, DefinitionFn>;
|
|
7
5
|
export {};
|