@primate/core 0.7.5 → 0.8.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/lib/private/App.d.ts +128 -65
- package/lib/private/Bag.d.ts +11 -0
- package/lib/private/Bag.js +31 -0
- package/lib/private/Flags.d.ts +5 -5
- package/lib/private/Flags.js +2 -1
- package/lib/private/app/Facade.client.d.ts +20 -0
- package/lib/private/app/Facade.client.js +30 -0
- package/lib/private/app/{Facade.d.ts → Facade.server.d.ts} +141 -72
- package/lib/private/app/{Facade.js → Facade.server.js} +12 -4
- package/lib/private/build/App.d.ts +0 -2
- package/lib/private/build/App.js +0 -7
- package/lib/private/build/client/index.js +29 -27
- package/lib/private/build/client/plugin/frontend.js +1 -1
- package/lib/private/build/client/plugin/routes.js +1 -1
- package/lib/private/build/hook.js +0 -3
- package/lib/private/build/server/index.js +5 -18
- package/lib/private/build/server/plugin/native-addons.d.ts +1 -1
- package/lib/private/build/server/plugin/native-addons.js +1 -1
- package/lib/private/build/shared/intercept.d.ts +1 -1
- package/lib/private/build/shared/intercept.js +4 -2
- package/lib/private/client/create-form.d.ts +13 -9
- package/lib/private/client/create-form.js +21 -4
- package/lib/private/config/index.d.ts +6 -2
- package/lib/private/config/schema.d.ts +28 -21
- package/lib/private/config/schema.js +5 -3
- package/lib/private/cookie.d.ts +5 -5
- package/lib/private/db/errors.d.ts +82 -82
- package/lib/private/db/migrate/store.d.ts +2 -2
- package/lib/private/db/primary.d.ts +1 -1
- package/lib/private/db/sql.d.ts +1 -1
- package/lib/private/errors.d.ts +80 -68
- package/lib/private/errors.js +23 -1
- package/lib/private/frontend.d.ts +7 -7
- package/lib/private/frontend.js +7 -10
- package/lib/private/i18n/API.d.ts +14 -18
- package/lib/private/i18n/config.client.d.ts +7 -0
- package/lib/private/i18n/config.client.js +130 -0
- package/lib/private/i18n/config.server.d.ts +7 -0
- package/lib/private/i18n/{index/server.js → config.server.js} +31 -23
- package/lib/private/i18n/constant/COOKIE_NAME.d.ts +1 -1
- package/lib/private/i18n/constant/DEFAULT_LOCALE.d.ts +1 -1
- package/lib/private/i18n/constant/DEFAULT_PERSIST_MODE.d.ts +1 -1
- package/lib/private/i18n/constant/PERSIST_HEADER.d.ts +1 -1
- package/lib/private/i18n/constant/PERSIST_METHOD.d.ts +1 -1
- package/lib/private/i18n/constant/PERSIST_STORAGE_KEY.d.ts +1 -1
- package/lib/private/i18n/index.d.ts +42 -0
- package/lib/private/i18n/index.js +6 -0
- package/lib/private/i18n/missing.d.ts +5 -0
- package/lib/private/i18n/missing.js +38 -0
- package/lib/private/i18n/module.js +36 -52
- package/lib/private/i18n/schema.d.ts +4 -4
- package/lib/private/loader.d.ts +5 -0
- package/lib/private/loader.js +28 -0
- package/lib/private/logger.d.ts +1 -1
- package/lib/private/request/RequestBag.d.ts +12 -13
- package/lib/private/request/RequestBag.js +5 -4
- package/lib/private/request/RequestView.d.ts +5 -5
- package/lib/private/request/RequestView.js +0 -1
- package/lib/private/response/view.d.ts +1 -0
- package/lib/private/response/view.js +0 -7
- package/lib/private/route/Handler.d.ts +1 -1
- package/lib/private/route/NarrowedRequest.d.ts +6 -1
- package/lib/private/route/Options.d.ts +2 -1
- package/lib/private/route/hook.d.ts +1 -2
- package/lib/private/route/router.d.ts +9 -9
- package/lib/private/route/router.js +9 -0
- package/lib/private/route.client.d.ts +20 -4
- package/lib/private/route.client.js +7 -3
- package/lib/private/route.d.ts +3 -0
- package/lib/private/route.js +2 -0
- package/lib/private/serve/App.d.ts +2 -13
- package/lib/private/serve/App.js +63 -46
- package/lib/private/serve/Init.d.ts +0 -3
- package/lib/private/server/TAG.d.ts +1 -1
- package/lib/private/session/{index.client.d.ts → config.client.d.ts} +1 -1
- package/lib/private/session/{index.client.js → config.client.js} +1 -1
- package/lib/private/session/config.server.d.ts +15 -0
- package/lib/private/session/config.server.js +44 -0
- package/lib/private/session/index.d.ts +2 -14
- package/lib/private/session/index.js +2 -43
- package/lib/private/session/module.js +1 -1
- package/lib/private/session/schema.d.ts +5 -5
- package/lib/private/store/PrimaryKey.d.ts +1 -1
- package/lib/private/store.client.d.ts +2 -0
- package/lib/private/store.d.ts +2 -0
- package/lib/private/target/Manager.d.ts +2 -0
- package/lib/private/target/Manager.js +29 -5
- package/lib/private/target/Target.d.ts +2 -0
- package/lib/public/i18n.d.ts +3 -0
- package/lib/public/{i18n/config.js → i18n.js} +1 -1
- package/lib/public/loader.d.ts +2 -0
- package/lib/public/loader.js +2 -0
- package/lib/public/response.d.ts +1 -1
- package/lib/public/{session/config.d.ts → session.d.ts} +1 -1
- package/lib/public/{session/config.js → session.js} +1 -1
- package/package.json +27 -18
- package/lib/private/app/Facade.browser.d.ts +0 -11
- package/lib/private/app/Facade.browser.js +0 -19
- package/lib/private/build/server/plugin/store.d.ts +0 -4
- package/lib/private/build/server/plugin/store.js +0 -25
- package/lib/private/build/server/plugin/stores.d.ts +0 -4
- package/lib/private/build/server/plugin/stores.js +0 -28
- package/lib/private/i18n/index/client.d.ts +0 -9
- package/lib/private/i18n/index/client.js +0 -152
- package/lib/private/i18n/index/server.d.ts +0 -9
- package/lib/private/i18n/symbol/internal.d.ts +0 -3
- package/lib/private/i18n/symbol/internal.js +0 -3
- package/lib/public/i18n/API.d.ts +0 -2
- package/lib/public/i18n/API.js +0 -2
- package/lib/public/i18n/Catalogs.d.ts +0 -2
- package/lib/public/i18n/Catalogs.js +0 -2
- package/lib/public/i18n/ContextData.d.ts +0 -2
- package/lib/public/i18n/ContextData.js +0 -2
- package/lib/public/i18n/config.d.ts +0 -2
- package/lib/public/i18n/locale.d.ts +0 -2
- package/lib/public/i18n/locale.js +0 -2
- package/lib/public/i18n/sInternal.d.ts +0 -2
- package/lib/public/i18n/sInternal.js +0 -2
- package/lib/public/route/hook.d.ts +0 -2
- package/lib/public/route/hook.js +0 -2
- package/lib/public/session/config.client.d.ts +0 -2
- package/lib/public/session/config.client.js +0 -2
- /package/lib/private/i18n/{index/types.d.ts → types.d.ts} +0 -0
- /package/lib/private/i18n/{index/types.js → types.js} +0 -0
|
@@ -55,19 +55,34 @@ declare function unapplied_migrations(): import("@rcompat/error").TemplateError;
|
|
|
55
55
|
declare function sql_placeholder_missing(key: string): import("@rcompat/error").TemplateError;
|
|
56
56
|
declare function sql_input_missing(key: string): import("@rcompat/error").TemplateError;
|
|
57
57
|
declare const errors: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
db_missing: typeof db_missing;
|
|
59
|
+
store_directory_missing: typeof store_directory_missing;
|
|
60
|
+
store_directory_empty: typeof store_directory_empty;
|
|
61
|
+
store_table_required: typeof store_table_required;
|
|
62
|
+
unregistered_schema: typeof unregistered_schema;
|
|
63
|
+
record_not_found: typeof record_not_found;
|
|
64
|
+
record_number_invalid: typeof record_number_invalid;
|
|
65
|
+
return_invalid: typeof return_invalid;
|
|
66
|
+
key_duplicate: typeof key_duplicate;
|
|
67
|
+
table_not_found: typeof table_not_found;
|
|
68
|
+
pk_undefined: typeof pk_undefined;
|
|
69
|
+
pk_immutable: typeof pk_immutable;
|
|
70
|
+
pk_duplicate: typeof pk_duplicate;
|
|
71
|
+
pk_invalid: typeof pk_invalid;
|
|
72
|
+
pk_required: typeof pk_required;
|
|
73
|
+
pk_multiple_pks: typeof pk_multiple_pks;
|
|
74
|
+
pk_invalid_type: typeof pk_invalid_type;
|
|
75
|
+
field_unknown: typeof field_unknown;
|
|
76
|
+
field_duplicate: typeof field_duplicate;
|
|
77
|
+
field_required: typeof field_required;
|
|
78
|
+
field_undefined: typeof field_undefined;
|
|
79
|
+
fields_unknown: typeof fields_unknown;
|
|
80
|
+
null_not_allowed: typeof null_not_allowed;
|
|
81
|
+
operator_unknown: typeof operator_unknown;
|
|
82
|
+
operator_empty: typeof operator_empty;
|
|
83
|
+
wrong_type: typeof wrong_type;
|
|
84
|
+
operator_scalar: typeof operator_scalar;
|
|
85
|
+
operator_empty_in: typeof operator_empty_in;
|
|
71
86
|
sort_empty: typeof sort_empty;
|
|
72
87
|
sort_invalid: typeof sort_invalid;
|
|
73
88
|
sort_invalid_value: typeof sort_invalid_value;
|
|
@@ -81,49 +96,49 @@ declare const errors: {
|
|
|
81
96
|
limit_invalid: typeof limit_invalid;
|
|
82
97
|
offset_invalid: typeof offset_invalid;
|
|
83
98
|
offset_requires_limit: typeof offset_requires_limit;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
pk_duplicate: typeof pk_duplicate;
|
|
98
|
-
pk_invalid: typeof pk_invalid;
|
|
99
|
-
pk_required: typeof pk_required;
|
|
100
|
-
pk_multiple_pks: typeof pk_multiple_pks;
|
|
101
|
-
pk_invalid_type: typeof pk_invalid_type;
|
|
102
|
-
db_missing: typeof db_missing;
|
|
103
|
-
store_directory_missing: typeof store_directory_missing;
|
|
104
|
-
store_directory_empty: typeof store_directory_empty;
|
|
105
|
-
store_table_required: typeof store_table_required;
|
|
106
|
-
unregistered_schema: typeof unregistered_schema;
|
|
107
|
-
record_not_found: typeof record_not_found;
|
|
108
|
-
record_number_invalid: typeof record_number_invalid;
|
|
109
|
-
return_invalid: typeof return_invalid;
|
|
110
|
-
key_duplicate: typeof key_duplicate;
|
|
111
|
-
table_not_found: typeof table_not_found;
|
|
99
|
+
relation_unknown: typeof relation_unknown;
|
|
100
|
+
relation_requires_pk: typeof relation_requires_pk;
|
|
101
|
+
relation_table_mismatch: typeof relation_table_mismatch;
|
|
102
|
+
relation_store_required: typeof relation_store_required;
|
|
103
|
+
option_unknown: typeof option_unknown;
|
|
104
|
+
identifier_invalid: typeof identifier_invalid;
|
|
105
|
+
count_with_invalid: typeof count_with_invalid;
|
|
106
|
+
count_overflow: typeof count_overflow;
|
|
107
|
+
migration_directory_missing: typeof migration_directory_missing;
|
|
108
|
+
migration_store_conflict: typeof migration_store_conflict;
|
|
109
|
+
unapplied_migrations: typeof unapplied_migrations;
|
|
110
|
+
sql_placeholder_missing: typeof sql_placeholder_missing;
|
|
111
|
+
sql_input_missing: typeof sql_input_missing;
|
|
112
112
|
};
|
|
113
113
|
export declare const Code: {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
db_missing: "db_missing";
|
|
115
|
+
store_directory_missing: "store_directory_missing";
|
|
116
|
+
store_directory_empty: "store_directory_empty";
|
|
117
|
+
store_table_required: "store_table_required";
|
|
118
|
+
unregistered_schema: "unregistered_schema";
|
|
119
|
+
record_not_found: "record_not_found";
|
|
120
|
+
record_number_invalid: "record_number_invalid";
|
|
121
|
+
return_invalid: "return_invalid";
|
|
122
|
+
key_duplicate: "key_duplicate";
|
|
123
|
+
table_not_found: "table_not_found";
|
|
124
|
+
pk_undefined: "pk_undefined";
|
|
125
|
+
pk_immutable: "pk_immutable";
|
|
126
|
+
pk_duplicate: "pk_duplicate";
|
|
127
|
+
pk_invalid: "pk_invalid";
|
|
128
|
+
pk_required: "pk_required";
|
|
129
|
+
pk_multiple_pks: "pk_multiple_pks";
|
|
130
|
+
pk_invalid_type: "pk_invalid_type";
|
|
131
|
+
field_unknown: "field_unknown";
|
|
132
|
+
field_duplicate: "field_duplicate";
|
|
133
|
+
field_required: "field_required";
|
|
134
|
+
field_undefined: "field_undefined";
|
|
135
|
+
fields_unknown: "fields_unknown";
|
|
136
|
+
null_not_allowed: "null_not_allowed";
|
|
137
|
+
operator_unknown: "operator_unknown";
|
|
138
|
+
operator_empty: "operator_empty";
|
|
139
|
+
wrong_type: "wrong_type";
|
|
140
|
+
operator_scalar: "operator_scalar";
|
|
141
|
+
operator_empty_in: "operator_empty_in";
|
|
127
142
|
sort_empty: "sort_empty";
|
|
128
143
|
sort_invalid: "sort_invalid";
|
|
129
144
|
sort_invalid_value: "sort_invalid_value";
|
|
@@ -137,34 +152,19 @@ export declare const Code: {
|
|
|
137
152
|
limit_invalid: "limit_invalid";
|
|
138
153
|
offset_invalid: "offset_invalid";
|
|
139
154
|
offset_requires_limit: "offset_requires_limit";
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
pk_duplicate: "pk_duplicate";
|
|
154
|
-
pk_invalid: "pk_invalid";
|
|
155
|
-
pk_required: "pk_required";
|
|
156
|
-
pk_multiple_pks: "pk_multiple_pks";
|
|
157
|
-
pk_invalid_type: "pk_invalid_type";
|
|
158
|
-
db_missing: "db_missing";
|
|
159
|
-
store_directory_missing: "store_directory_missing";
|
|
160
|
-
store_directory_empty: "store_directory_empty";
|
|
161
|
-
store_table_required: "store_table_required";
|
|
162
|
-
unregistered_schema: "unregistered_schema";
|
|
163
|
-
record_not_found: "record_not_found";
|
|
164
|
-
record_number_invalid: "record_number_invalid";
|
|
165
|
-
return_invalid: "return_invalid";
|
|
166
|
-
key_duplicate: "key_duplicate";
|
|
167
|
-
table_not_found: "table_not_found";
|
|
155
|
+
relation_unknown: "relation_unknown";
|
|
156
|
+
relation_requires_pk: "relation_requires_pk";
|
|
157
|
+
relation_table_mismatch: "relation_table_mismatch";
|
|
158
|
+
relation_store_required: "relation_store_required";
|
|
159
|
+
option_unknown: "option_unknown";
|
|
160
|
+
identifier_invalid: "identifier_invalid";
|
|
161
|
+
count_with_invalid: "count_with_invalid";
|
|
162
|
+
count_overflow: "count_overflow";
|
|
163
|
+
migration_directory_missing: "migration_directory_missing";
|
|
164
|
+
migration_store_conflict: "migration_store_conflict";
|
|
165
|
+
unapplied_migrations: "unapplied_migrations";
|
|
166
|
+
sql_placeholder_missing: "sql_placeholder_missing";
|
|
167
|
+
sql_input_missing: "sql_input_missing";
|
|
168
168
|
};
|
|
169
169
|
export type Code = keyof typeof errors;
|
|
170
170
|
export default errors;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default function migration_store(): Promise<import("../../store/Store.js").default<{
|
|
2
|
-
id: import("../../store/PrimaryKey.js").default<import("pema").UintType<"u16">>;
|
|
3
|
-
applied: import("pema").DateType
|
|
2
|
+
id: import("../../store/PrimaryKey.js").default<import("pema").UintType<"u16", undefined>>;
|
|
3
|
+
applied: import("pema").DateType<undefined>;
|
|
4
4
|
}, string>>;
|
|
5
5
|
//# sourceMappingURL=store.d.ts.map
|
package/lib/private/db/sql.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const sql: {
|
|
|
22
22
|
aliases: Dict<string>;
|
|
23
23
|
}, relation_args: ReadRelationsArgs, unbind: (type: DataKey, value: unknown) => T): Dict[];
|
|
24
24
|
Q: typeof Q;
|
|
25
|
-
OPS: Dict<"
|
|
25
|
+
OPS: Dict<"<" | "<=" | ">" | ">=">;
|
|
26
26
|
};
|
|
27
27
|
export default sql;
|
|
28
28
|
//# sourceMappingURL=sql.d.ts.map
|
package/lib/private/errors.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare function build_live_reload_failed(filename: string, cause: Error): impor
|
|
|
12
12
|
declare function build_previous_build_exists(file: FileRef): import("@rcompat/error").TemplateError;
|
|
13
13
|
declare function build_no_path_schema(route: string): import("@rcompat/error").TemplateError;
|
|
14
14
|
declare function build_body_requires_content_type(): import("@rcompat/error").TemplateError;
|
|
15
|
+
declare function build_unrecognized_loader(seen: string): import("@rcompat/error").TemplateError;
|
|
16
|
+
declare function build_path_schema_mismatch(route: string, method: string, expected: string[], declared: string[]): import("@rcompat/error").TemplateError;
|
|
17
|
+
declare function build_reserved_entrypoints(conflicts: string[]): import("@rcompat/error").TemplateError;
|
|
15
18
|
declare function config_file_missing(): import("@rcompat/error").TemplateError;
|
|
16
19
|
declare function config_file_empty(file: FileRef): import("@rcompat/error").TemplateError;
|
|
17
20
|
declare function config_file_error(file: FileRef, cause: Error): import("@rcompat/error").TemplateError;
|
|
@@ -48,97 +51,106 @@ declare function view_error(view: string, cause: Error): import("@rcompat/error"
|
|
|
48
51
|
declare function env_invalid_schema(cause: ParseError): import("@rcompat/error").TemplateError;
|
|
49
52
|
declare function env_missing_key(key: string): import("@rcompat/error").TemplateError;
|
|
50
53
|
declare function openapi_no_operation_for(method: Method, path: string): import("@rcompat/error").TemplateError;
|
|
54
|
+
declare function bag_value_missing(key: string): import("@rcompat/error").TemplateError;
|
|
51
55
|
declare const errors: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
app_reserved_directory: typeof app_reserved_directory;
|
|
57
|
+
app_duplicate_module: typeof app_duplicate_module;
|
|
58
|
+
build_missing_binary_addon: typeof build_missing_binary_addon;
|
|
59
|
+
build_missing_route: typeof build_missing_route;
|
|
60
|
+
build_live_reload_failed: typeof build_live_reload_failed;
|
|
61
|
+
build_previous_build_exists: typeof build_previous_build_exists;
|
|
62
|
+
build_no_path_schema: typeof build_no_path_schema;
|
|
63
|
+
build_body_requires_content_type: typeof build_body_requires_content_type;
|
|
64
|
+
build_unrecognized_loader: typeof build_unrecognized_loader;
|
|
65
|
+
build_path_schema_mismatch: typeof build_path_schema_mismatch;
|
|
66
|
+
build_reserved_entrypoints: typeof build_reserved_entrypoints;
|
|
67
|
+
config_file_missing: typeof config_file_missing;
|
|
68
|
+
config_missing: typeof config_missing;
|
|
69
|
+
config_file_empty: typeof config_file_empty;
|
|
70
|
+
config_file_error: typeof config_file_error;
|
|
71
|
+
config_failed_to_parse_tsconfig: typeof config_failed_to_parse_tsconfig;
|
|
72
|
+
frontend_missing: typeof frontend_missing;
|
|
73
|
+
frontend_missing_app_js: typeof frontend_missing_app_js;
|
|
74
|
+
request_unsupported_mime: typeof request_unsupported_mime;
|
|
75
|
+
request_unparsable_mime: typeof request_unparsable_mime;
|
|
76
|
+
request_body_already_parsed: typeof request_body_already_parsed;
|
|
77
|
+
request_bag_missing_key: typeof request_bag_missing_key;
|
|
78
|
+
request_content_type_mismatch: typeof request_content_type_mismatch;
|
|
79
|
+
response_invalid_body: typeof response_invalid_body;
|
|
65
80
|
hook_route_functions_not_allowed: typeof hook_route_functions_not_allowed;
|
|
66
81
|
hook_not_allowed: typeof hook_not_allowed;
|
|
67
82
|
hook_unused: typeof hook_unused;
|
|
68
83
|
hook_reused_next: typeof hook_reused_next;
|
|
69
84
|
hook_no_return: typeof hook_no_return;
|
|
70
85
|
hook_bad_return: typeof hook_bad_return;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
session_missing_id: typeof session_missing_id;
|
|
87
|
+
session_id_string: typeof session_id_string;
|
|
88
|
+
session_id_data: typeof session_id_data;
|
|
89
|
+
session_handle_unavailable: typeof session_handle_unavailable;
|
|
90
|
+
target_missing: typeof target_missing;
|
|
91
|
+
target_duplicate: typeof target_duplicate;
|
|
77
92
|
route_missing_method: typeof route_missing_method;
|
|
78
93
|
route_invalid_special_file: typeof route_invalid_special_file;
|
|
79
94
|
route_invalid_parameter: typeof route_invalid_parameter;
|
|
80
95
|
route_invalid_characters: typeof route_invalid_characters;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
build_missing_route: typeof build_missing_route;
|
|
90
|
-
build_live_reload_failed: typeof build_live_reload_failed;
|
|
91
|
-
build_previous_build_exists: typeof build_previous_build_exists;
|
|
92
|
-
build_no_path_schema: typeof build_no_path_schema;
|
|
93
|
-
build_body_requires_content_type: typeof build_body_requires_content_type;
|
|
94
|
-
app_reserved_directory: typeof app_reserved_directory;
|
|
95
|
-
app_duplicate_module: typeof app_duplicate_module;
|
|
96
|
+
view_missing: typeof view_missing;
|
|
97
|
+
view_missing_default_export: typeof view_missing_default_export;
|
|
98
|
+
view_duplicate_extension: typeof view_duplicate_extension;
|
|
99
|
+
view_error: typeof view_error;
|
|
100
|
+
env_invalid_schema: typeof env_invalid_schema;
|
|
101
|
+
env_missing_key: typeof env_missing_key;
|
|
102
|
+
openapi_no_operation_for: typeof openapi_no_operation_for;
|
|
103
|
+
bag_value_missing: typeof bag_value_missing;
|
|
96
104
|
};
|
|
97
105
|
export declare const Code: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
app_reserved_directory: "app_reserved_directory";
|
|
107
|
+
app_duplicate_module: "app_duplicate_module";
|
|
108
|
+
build_missing_binary_addon: "build_missing_binary_addon";
|
|
109
|
+
build_missing_route: "build_missing_route";
|
|
110
|
+
build_live_reload_failed: "build_live_reload_failed";
|
|
111
|
+
build_previous_build_exists: "build_previous_build_exists";
|
|
112
|
+
build_no_path_schema: "build_no_path_schema";
|
|
113
|
+
build_body_requires_content_type: "build_body_requires_content_type";
|
|
114
|
+
build_unrecognized_loader: "build_unrecognized_loader";
|
|
115
|
+
build_path_schema_mismatch: "build_path_schema_mismatch";
|
|
116
|
+
build_reserved_entrypoints: "build_reserved_entrypoints";
|
|
117
|
+
config_file_missing: "config_file_missing";
|
|
118
|
+
config_missing: "config_missing";
|
|
119
|
+
config_file_empty: "config_file_empty";
|
|
120
|
+
config_file_error: "config_file_error";
|
|
121
|
+
config_failed_to_parse_tsconfig: "config_failed_to_parse_tsconfig";
|
|
122
|
+
frontend_missing: "frontend_missing";
|
|
123
|
+
frontend_missing_app_js: "frontend_missing_app_js";
|
|
124
|
+
request_unsupported_mime: "request_unsupported_mime";
|
|
125
|
+
request_unparsable_mime: "request_unparsable_mime";
|
|
126
|
+
request_body_already_parsed: "request_body_already_parsed";
|
|
127
|
+
request_bag_missing_key: "request_bag_missing_key";
|
|
128
|
+
request_content_type_mismatch: "request_content_type_mismatch";
|
|
129
|
+
response_invalid_body: "response_invalid_body";
|
|
111
130
|
hook_route_functions_not_allowed: "hook_route_functions_not_allowed";
|
|
112
131
|
hook_not_allowed: "hook_not_allowed";
|
|
113
132
|
hook_unused: "hook_unused";
|
|
114
133
|
hook_reused_next: "hook_reused_next";
|
|
115
134
|
hook_no_return: "hook_no_return";
|
|
116
135
|
hook_bad_return: "hook_bad_return";
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
136
|
+
session_missing_id: "session_missing_id";
|
|
137
|
+
session_id_string: "session_id_string";
|
|
138
|
+
session_id_data: "session_id_data";
|
|
139
|
+
session_handle_unavailable: "session_handle_unavailable";
|
|
140
|
+
target_missing: "target_missing";
|
|
141
|
+
target_duplicate: "target_duplicate";
|
|
123
142
|
route_missing_method: "route_missing_method";
|
|
124
143
|
route_invalid_special_file: "route_invalid_special_file";
|
|
125
144
|
route_invalid_parameter: "route_invalid_parameter";
|
|
126
145
|
route_invalid_characters: "route_invalid_characters";
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
build_missing_route: "build_missing_route";
|
|
136
|
-
build_live_reload_failed: "build_live_reload_failed";
|
|
137
|
-
build_previous_build_exists: "build_previous_build_exists";
|
|
138
|
-
build_no_path_schema: "build_no_path_schema";
|
|
139
|
-
build_body_requires_content_type: "build_body_requires_content_type";
|
|
140
|
-
app_reserved_directory: "app_reserved_directory";
|
|
141
|
-
app_duplicate_module: "app_duplicate_module";
|
|
146
|
+
view_missing: "view_missing";
|
|
147
|
+
view_missing_default_export: "view_missing_default_export";
|
|
148
|
+
view_duplicate_extension: "view_duplicate_extension";
|
|
149
|
+
view_error: "view_error";
|
|
150
|
+
env_invalid_schema: "env_invalid_schema";
|
|
151
|
+
env_missing_key: "env_missing_key";
|
|
152
|
+
openapi_no_operation_for: "openapi_no_operation_for";
|
|
153
|
+
bag_value_missing: "bag_value_missing";
|
|
142
154
|
};
|
|
143
155
|
export type Code = keyof typeof errors;
|
|
144
156
|
export default errors;
|
package/lib/private/errors.js
CHANGED
|
@@ -31,6 +31,18 @@ function build_body_requires_content_type() {
|
|
|
31
31
|
const c = "route.with({ contentType: ..., body: ... })";
|
|
32
32
|
return t `body schema requires ${b} to be set — declare a contentType in ${c}`;
|
|
33
33
|
}
|
|
34
|
+
function build_unrecognized_loader(seen) {
|
|
35
|
+
const loaders = ["file"];
|
|
36
|
+
return t `unrecognised loader ${seen}; supported loaders: ${loaders}`;
|
|
37
|
+
}
|
|
38
|
+
function build_path_schema_mismatch(route, method, expected, declared) {
|
|
39
|
+
return t `route ${route} method ${method}:
|
|
40
|
+
path schema keys [${declared.join(", ")}] do not match
|
|
41
|
+
dynamic segments [${expected.join(", ")}]`;
|
|
42
|
+
}
|
|
43
|
+
function build_reserved_entrypoints(conflicts) {
|
|
44
|
+
return t `entrypoint name(s) reserved: ${conflicts.map(n => `"${n}"`).join(", ")}`;
|
|
45
|
+
}
|
|
34
46
|
const BUILD = error.coded({
|
|
35
47
|
build_missing_binary_addon,
|
|
36
48
|
build_missing_route,
|
|
@@ -38,6 +50,9 @@ const BUILD = error.coded({
|
|
|
38
50
|
build_previous_build_exists,
|
|
39
51
|
build_no_path_schema,
|
|
40
52
|
build_body_requires_content_type,
|
|
53
|
+
build_unrecognized_loader,
|
|
54
|
+
build_path_schema_mismatch,
|
|
55
|
+
build_reserved_entrypoints,
|
|
41
56
|
});
|
|
42
57
|
function config_file_missing() {
|
|
43
58
|
return t `missing ${"config/app.ts"}`;
|
|
@@ -136,7 +151,7 @@ function session_id_string() {
|
|
|
136
151
|
return t `session store session_id must be a string type`;
|
|
137
152
|
}
|
|
138
153
|
function session_id_data() {
|
|
139
|
-
return t `
|
|
154
|
+
return t `both ${"id"} and ${"data"} must be defined or undefined`;
|
|
140
155
|
}
|
|
141
156
|
function session_handle_unavailable() {
|
|
142
157
|
return t `session handle not available in this context`;
|
|
@@ -212,6 +227,12 @@ function openapi_no_operation_for(method, path) {
|
|
|
212
227
|
const OPENAPI = error.coded({
|
|
213
228
|
openapi_no_operation_for,
|
|
214
229
|
});
|
|
230
|
+
function bag_value_missing(key) {
|
|
231
|
+
return t `missing bag value for ${key}`;
|
|
232
|
+
}
|
|
233
|
+
const BAG = error.coded({
|
|
234
|
+
bag_value_missing,
|
|
235
|
+
});
|
|
215
236
|
const errors = {
|
|
216
237
|
...APP,
|
|
217
238
|
...BUILD,
|
|
@@ -226,6 +247,7 @@ const errors = {
|
|
|
226
247
|
...VIEW,
|
|
227
248
|
...ENV,
|
|
228
249
|
...OPENAPI,
|
|
250
|
+
...BAG,
|
|
229
251
|
};
|
|
230
252
|
export const Code = error.names(errors);
|
|
231
253
|
export default errors;
|
|
@@ -11,10 +11,10 @@ import type { Dict, MaybePromise, Unpack } from "@rcompat/type";
|
|
|
11
11
|
import type { ObjectType } from "pema";
|
|
12
12
|
export type { Module };
|
|
13
13
|
declare const base_schema: ObjectType<import("pema").NormalizeSchemaObject<{
|
|
14
|
-
readonly extensions: import("pema").OptionalType<import("pema").ArrayType<import("pema").StringType>>;
|
|
15
|
-
readonly csr: import("pema").DefaultType<import("pema").BooleanType
|
|
16
|
-
readonly ssr: import("pema").DefaultType<import("pema").BooleanType
|
|
17
|
-
}>, {
|
|
14
|
+
readonly extensions: import("pema").OptionalType<import("pema").ArrayType<import("pema").StringType, undefined>>;
|
|
15
|
+
readonly csr: import("pema").DefaultType<import("pema").BooleanType<undefined>, true>;
|
|
16
|
+
readonly ssr: import("pema").DefaultType<import("pema").BooleanType<undefined>, true>;
|
|
17
|
+
}>, undefined, {
|
|
18
18
|
extensions: string[] | undefined;
|
|
19
19
|
csr: boolean;
|
|
20
20
|
ssr: boolean;
|
|
@@ -30,10 +30,10 @@ export interface Init<S = ServerView, E extends C = ObjectType<never>> {
|
|
|
30
30
|
conditions?: string[];
|
|
31
31
|
render?: Render<S>;
|
|
32
32
|
root?: {
|
|
33
|
-
create: (depth: number
|
|
33
|
+
create: (depth: number) => string;
|
|
34
34
|
};
|
|
35
35
|
compile?: {
|
|
36
|
-
client?: (text: string, file: FileRef, root: boolean) => MaybePromise<{
|
|
36
|
+
client?: (text: string, file: FileRef, root: boolean, hydrate: boolean) => MaybePromise<{
|
|
37
37
|
css?: null | string;
|
|
38
38
|
js: string;
|
|
39
39
|
}>;
|
|
@@ -60,7 +60,7 @@ export interface Init<S = ServerView, E extends C = ObjectType<never>> {
|
|
|
60
60
|
onBuild?: On<BuildApp, E>;
|
|
61
61
|
onServe?: On<ServeApp, E>;
|
|
62
62
|
}
|
|
63
|
-
export default function frontend_module<S = ServerView, E extends C = ObjectType<never>>(init: Init<S, E>): (input?: E extends ObjectType<never, never> ? {
|
|
63
|
+
export default function frontend_module<S = ServerView, E extends C = ObjectType<never>>(init: Init<S, E>): (input?: E extends ObjectType<never, undefined, never> ? {
|
|
64
64
|
extensions?: string[] | undefined;
|
|
65
65
|
csr?: boolean | undefined;
|
|
66
66
|
ssr?: boolean | undefined;
|
package/lib/private/frontend.js
CHANGED
|
@@ -33,7 +33,7 @@ export default function frontend_module(init) {
|
|
|
33
33
|
function load(name, props, app) {
|
|
34
34
|
if (!ssr())
|
|
35
35
|
return { view: null, name, props };
|
|
36
|
-
const view = app.
|
|
36
|
+
const view = app.views.get(name);
|
|
37
37
|
return { view, name, props };
|
|
38
38
|
}
|
|
39
39
|
async function render(server, client, app) {
|
|
@@ -108,7 +108,7 @@ export default function frontend_module(init) {
|
|
|
108
108
|
try {
|
|
109
109
|
const server = init.layouts
|
|
110
110
|
? {
|
|
111
|
-
view: app.
|
|
111
|
+
view: app.views.get(rootname),
|
|
112
112
|
props: {
|
|
113
113
|
views: views.map(c => c.view),
|
|
114
114
|
props: views.map(c => c.props),
|
|
@@ -116,7 +116,7 @@ export default function frontend_module(init) {
|
|
|
116
116
|
},
|
|
117
117
|
}
|
|
118
118
|
: {
|
|
119
|
-
view: app.
|
|
119
|
+
view: app.views.get(view),
|
|
120
120
|
props,
|
|
121
121
|
request: $request,
|
|
122
122
|
};
|
|
@@ -158,13 +158,10 @@ export default function frontend_module(init) {
|
|
|
158
158
|
});
|
|
159
159
|
// build
|
|
160
160
|
if (init.root !== undefined && compile_server !== undefined) {
|
|
161
|
-
const source = await compile_server(init.root.create(app.depth()
|
|
161
|
+
const source = await compile_server(init.root.create(app.depth()), fs.ref(`root:${module_name}`));
|
|
162
162
|
app.addRoot(rootname, source);
|
|
163
163
|
}
|
|
164
|
-
//
|
|
165
|
-
if (app.mode === "development") {
|
|
166
|
-
app.frontends.set(module_name, [...extensions]);
|
|
167
|
-
}
|
|
164
|
+
// publish
|
|
168
165
|
if (compile_client !== undefined) {
|
|
169
166
|
if (init.client) {
|
|
170
167
|
app.frontends.set(module_name, [...extensions]);
|
|
@@ -182,7 +179,7 @@ export default function frontend_module(init) {
|
|
|
182
179
|
return { namespace: `${module_name}`, path };
|
|
183
180
|
});
|
|
184
181
|
build.onLoad({ filter }, async () => {
|
|
185
|
-
const contents = (await compile_client(root.create(app.depth()
|
|
182
|
+
const contents = (await compile_client(root.create(app.depth()), fs.ref("/tmp"), true, options.ssr)).js;
|
|
186
183
|
return contents.length > 0 ? {
|
|
187
184
|
contents,
|
|
188
185
|
loader: "js",
|
|
@@ -223,7 +220,7 @@ export default function frontend_module(init) {
|
|
|
223
220
|
return null;
|
|
224
221
|
const file = fs.ref(args.path);
|
|
225
222
|
// compile file to JavaScript and potentially CSS
|
|
226
|
-
const compiled = await compile_client(await file.text(), file, false);
|
|
223
|
+
const compiled = await compile_client(await file.text(), file, false, options.ssr);
|
|
227
224
|
let contents = compiled.js;
|
|
228
225
|
if (init.css !== undefined
|
|
229
226
|
&& compiled.css !== null
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import type Catalogs from "#i18n/Catalogs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type API<C extends Catalogs> = {
|
|
5
|
-
onChange(fn: (locale: LocaleTags<C>) => void): () => void;
|
|
6
|
-
subscribe(run: (value: API<C>) => void): () => void;
|
|
7
|
-
locale: {
|
|
8
|
-
get(): LocaleTags<C>;
|
|
9
|
-
set(locale: LocaleTags<C>): void;
|
|
10
|
-
};
|
|
11
|
-
readonly loading: boolean;
|
|
12
|
-
[sInternal]: {
|
|
13
|
-
init(locale: LocaleTags<C>): void;
|
|
14
|
-
wait(): Promise<void>;
|
|
15
|
-
depend(fn: () => void): () => void;
|
|
16
|
-
readonly version: number;
|
|
17
|
-
restore: () => void;
|
|
18
|
-
};
|
|
2
|
+
type RestoreRequest = {
|
|
3
|
+
cookies?: Record<string, string | undefined>;
|
|
19
4
|
};
|
|
20
|
-
export
|
|
5
|
+
export default interface API<C extends Catalogs> {
|
|
6
|
+
readonly defaultLocale: keyof C & string;
|
|
7
|
+
readonly locales: readonly (keyof C & string)[];
|
|
8
|
+
readonly catalogs: C;
|
|
9
|
+
readonly currency: string;
|
|
10
|
+
readonly locale: {
|
|
11
|
+
get(): keyof C & string;
|
|
12
|
+
set(locale: keyof C & string): void;
|
|
13
|
+
};
|
|
14
|
+
restore(request?: RestoreRequest): void;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
21
17
|
//# sourceMappingURL=API.d.ts.map
|