@aglyn/plugins-redirects 1.26.5 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -11
- package/src/lib/server/redirect-test.d.ts +50 -0
- package/src/lib/server.d.ts +5 -3
- package/src/lib/server.js +6 -3
- package/src/lib/server.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-redirects",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.
|
|
29
|
-
"@aglyn/shared-data-mdi": "1.
|
|
30
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
31
|
-
"@aglyn/shared-ui-snackstack": "1.
|
|
32
|
-
"@aglyn/shared-util-email": "1.
|
|
33
|
-
"@aglyn/shared-util-http": "1.
|
|
34
|
-
"@aglyn/shared-util-timestamp": "1.
|
|
35
|
-
"@aglyn/shared-util-tools": "1.
|
|
36
|
-
"@aglyn/tenant-data-admin": "1.
|
|
37
|
-
"@aglyn/tenant-feature-instance": "1.
|
|
28
|
+
"@aglyn/aglyn": "1.27.0",
|
|
29
|
+
"@aglyn/shared-data-mdi": "1.27.0",
|
|
30
|
+
"@aglyn/shared-ui-jsx": "1.27.0",
|
|
31
|
+
"@aglyn/shared-ui-snackstack": "1.27.0",
|
|
32
|
+
"@aglyn/shared-util-email": "1.27.0",
|
|
33
|
+
"@aglyn/shared-util-http": "1.27.0",
|
|
34
|
+
"@aglyn/shared-util-timestamp": "1.27.0",
|
|
35
|
+
"@aglyn/shared-util-tools": "1.27.0",
|
|
36
|
+
"@aglyn/tenant-data-admin": "1.27.0",
|
|
37
|
+
"@aglyn/tenant-feature-instance": "1.27.0",
|
|
38
38
|
"@swc/helpers": "0.5.24"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { type PluginApiHandler } from '@aglyn/aglyn/server';
|
|
18
|
+
/** The answer: the path as tested, the rule's destination and status when one fires, and the page's words for it. */
|
|
19
|
+
export interface RedirectPathTest {
|
|
20
|
+
path: string;
|
|
21
|
+
match: {
|
|
22
|
+
destination: string;
|
|
23
|
+
statusCode: number;
|
|
24
|
+
} | null;
|
|
25
|
+
text: string;
|
|
26
|
+
}
|
|
27
|
+
type Rule = {
|
|
28
|
+
$id?: string;
|
|
29
|
+
source?: string;
|
|
30
|
+
destination?: string;
|
|
31
|
+
deletedAt?: unknown;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The Redirects page's "Test a path" (`redirects-console-page.tsx`), in its
|
|
35
|
+
* order and its words: the typed path normalized as a from-path (or kept as
|
|
36
|
+
* typed when it is not one), matched by the serve path's own matcher
|
|
37
|
+
* (`matchRedirect`) over the rules the page lists — soft-deleted ones
|
|
38
|
+
* dropped, in the page's order by from-path — and answered as
|
|
39
|
+
* `→ <destination> (<status>)` or `No rule matches`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function testRedirectPath(rules: readonly Rule[], input: string): RedirectPathTest;
|
|
42
|
+
/**
|
|
43
|
+
* `POST /api/redirects/test`: runs {@link testRedirectPath} for a member of
|
|
44
|
+
* the site, who may read its rules (the rules leave a redirect's read to any
|
|
45
|
+
* member, and the page offers the tester to everyone it shows). It reads and
|
|
46
|
+
* answers; it writes nothing. The native apps ask it here because the
|
|
47
|
+
* pattern half of the matcher is this server's engine, with no app copy.
|
|
48
|
+
*/
|
|
49
|
+
export declare const redirectTestHandler: PluginApiHandler;
|
|
50
|
+
export {};
|
package/src/lib/server.d.ts
CHANGED
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function registerRedirectsApi(): void;
|
|
24
24
|
/**
|
|
25
|
-
* The redirects plugin's CONSOLE API
|
|
26
|
-
* Redirects page's save checks
|
|
27
|
-
*
|
|
25
|
+
* The redirects plugin's CONSOLE API, for the native apps:
|
|
26
|
+
* `POST /api/redirects/check`, the Redirects page's save checks
|
|
27
|
+
* (`server/redirect-check.ts`), and `POST /api/redirects/test`, its
|
|
28
|
+
* "Test a path" (`server/redirect-test.ts`). Each handler loads with its
|
|
29
|
+
* first call, so neither boot pays for it.
|
|
28
30
|
*/
|
|
29
31
|
export declare function registerRedirectsConsoleApi(): void;
|
package/src/lib/server.js
CHANGED
|
@@ -30,11 +30,14 @@ import { resolveRedirect } from "./server/resolve-redirect.js";
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* The redirects plugin's CONSOLE API
|
|
34
|
-
* Redirects page's save checks
|
|
35
|
-
*
|
|
33
|
+
* The redirects plugin's CONSOLE API, for the native apps:
|
|
34
|
+
* `POST /api/redirects/check`, the Redirects page's save checks
|
|
35
|
+
* (`server/redirect-check.ts`), and `POST /api/redirects/test`, its
|
|
36
|
+
* "Test a path" (`server/redirect-test.ts`). Each handler loads with its
|
|
37
|
+
* first call, so neither boot pays for it.
|
|
36
38
|
*/ export function registerRedirectsConsoleApi() {
|
|
37
39
|
registerPluginApiRoute('redirects/check', async (req, res)=>(await import("./server/redirect-check.js")).redirectCheckHandler(req, res));
|
|
40
|
+
registerPluginApiRoute('redirects/test', async (req, res)=>(await import("./server/redirect-test.js")).redirectTestHandler(req, res));
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
//# sourceMappingURL=server.js.map
|
package/src/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/redirects/src/lib/server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { registerPluginApiRoute, registerSiteRedirectResolver } from '@aglyn/aglyn/server'\nimport { resolveRedirect } from './server/resolve-redirect'\n\n/**\n * Registers the redirects plugin's tenant-side hooks (AGL-418): the rule\n * engine (AGL-155) answers site requests with a redirect before any route\n * resolution — relocated from the tenant app's resolve-redirect util into\n * the plugin behind the core site-page hook.\n */\nexport function registerRedirectsApi(): void {\n registerSiteRedirectResolver(async ({ host, path }) => {\n const rule = await resolveRedirect(host, path)\n return rule\n ? { destination: rule.destination, statusCode: rule.statusCode }\n : undefined\n })\n}\n\n/**\n * The redirects plugin's CONSOLE API
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/redirects/src/lib/server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { registerPluginApiRoute, registerSiteRedirectResolver } from '@aglyn/aglyn/server'\nimport { resolveRedirect } from './server/resolve-redirect'\n\n/**\n * Registers the redirects plugin's tenant-side hooks (AGL-418): the rule\n * engine (AGL-155) answers site requests with a redirect before any route\n * resolution — relocated from the tenant app's resolve-redirect util into\n * the plugin behind the core site-page hook.\n */\nexport function registerRedirectsApi(): void {\n registerSiteRedirectResolver(async ({ host, path }) => {\n const rule = await resolveRedirect(host, path)\n return rule\n ? { destination: rule.destination, statusCode: rule.statusCode }\n : undefined\n })\n}\n\n/**\n * The redirects plugin's CONSOLE API, for the native apps:\n * `POST /api/redirects/check`, the Redirects page's save checks\n * (`server/redirect-check.ts`), and `POST /api/redirects/test`, its\n * \"Test a path\" (`server/redirect-test.ts`). Each handler loads with its\n * first call, so neither boot pays for it.\n */\nexport function registerRedirectsConsoleApi(): void {\n registerPluginApiRoute('redirects/check', async (req, res) =>\n (await import('./server/redirect-check')).redirectCheckHandler(req, res),\n )\n registerPluginApiRoute('redirects/test', async (req, res) =>\n (await import('./server/redirect-test')).redirectTestHandler(req, res),\n )\n}\n"],"names":["registerPluginApiRoute","registerSiteRedirectResolver","resolveRedirect","registerRedirectsApi","host","path","rule","destination","statusCode","undefined","registerRedirectsConsoleApi","req","res","redirectCheckHandler","redirectTestHandler"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,EAAEC,4BAA4B,QAAQ,sBAAqB;AAC1F,SAASC,eAAe,QAAQ,+BAA2B;AAE3D;;;;;CAKC,GACD,OAAO,SAASC;IACdF,6BAA6B,OAAO,EAAEG,IAAI,EAAEC,IAAI,EAAE;QAChD,MAAMC,OAAO,MAAMJ,gBAAgBE,MAAMC;QACzC,OAAOC,OACH;YAAEC,aAAaD,KAAKC,WAAW;YAAEC,YAAYF,KAAKE,UAAU;QAAC,IAC7DC;IACN;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASC;IACdV,uBAAuB,mBAAmB,OAAOW,KAAKC,MACpD,AAAC,CAAA,MAAM,MAAM,CAAC,6BAAyB,EAAGC,oBAAoB,CAACF,KAAKC;IAEtEZ,uBAAuB,kBAAkB,OAAOW,KAAKC,MACnD,AAAC,CAAA,MAAM,MAAM,CAAC,4BAAwB,EAAGE,mBAAmB,CAACH,KAAKC;AAEtE"}
|