wirejs-deploy-amplify-basic 0.1.177 → 0.1.179
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/amplify-backend-assets/backend.ts +1 -1
- package/amplify-hosting-assets/compute/default/index.js +6 -2
- package/amplify-hosting-assets/compute/default/package.json +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -79
- package/dist/index.d.ts +1 -10
- package/dist/index.js +2 -32
- package/package.json +3 -2
|
@@ -70,6 +70,10 @@ function toJSPath(path) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
function toClientJSPath(pathname) {
|
|
74
|
+
return toJSPath(pathname).replace(/\.js$/, '.client.js');
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
/**
|
|
74
78
|
*
|
|
75
79
|
* @param {http.IncomingMessage} req
|
|
@@ -181,7 +185,7 @@ function setResponseDetailsFromContext(context, res) {
|
|
|
181
185
|
* @returns
|
|
182
186
|
*/
|
|
183
187
|
async function trySSRPath(context, res) {
|
|
184
|
-
const
|
|
188
|
+
const asClientJSPath = toClientJSPath(context.location.pathname);
|
|
185
189
|
const srcPath = routeSSR(context, 'js');
|
|
186
190
|
if (!srcPath) return false;
|
|
187
191
|
|
|
@@ -212,7 +216,7 @@ async function trySSRPath(context, res) {
|
|
|
212
216
|
|
|
213
217
|
if (hydrationsFound) {
|
|
214
218
|
const script = doc.parentNode.createElement('script');
|
|
215
|
-
script.src =
|
|
219
|
+
script.src = asClientJSPath;
|
|
216
220
|
doc.parentNode.body.appendChild(script);
|
|
217
221
|
}
|
|
218
222
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from 'wirejs-deploy-aws/client';
|
package/dist/client/index.js
CHANGED
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
async function callApi(INTERNAL_API_URL, method, ...args) {
|
|
3
|
-
function isNode() {
|
|
4
|
-
return typeof args[0]?.cookies?.getAll === 'function';
|
|
5
|
-
}
|
|
6
|
-
function apiUrl() {
|
|
7
|
-
if (isNode()) {
|
|
8
|
-
return INTERNAL_API_URL + 'api';
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
return "/api";
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
let cookieHeader = {};
|
|
15
|
-
if (isNode()) {
|
|
16
|
-
const context = args[0];
|
|
17
|
-
const cookies = context.cookies.getAll();
|
|
18
|
-
cookieHeader = typeof cookies === 'object'
|
|
19
|
-
? {
|
|
20
|
-
Cookie: Object.entries(cookies).map(kv => kv.join('=')).join('; ')
|
|
21
|
-
}
|
|
22
|
-
: {};
|
|
23
|
-
}
|
|
24
|
-
const response = await fetch(apiUrl(), {
|
|
25
|
-
method: 'POST',
|
|
26
|
-
headers: {
|
|
27
|
-
'Content-Type': 'application/json',
|
|
28
|
-
...cookieHeader
|
|
29
|
-
},
|
|
30
|
-
body: JSON.stringify([{ method, args: [...args] }]),
|
|
31
|
-
});
|
|
32
|
-
const body = await response.json();
|
|
33
|
-
if (isNode()) {
|
|
34
|
-
const context = args[0];
|
|
35
|
-
for (const c of response.headers.getSetCookie()) {
|
|
36
|
-
const parts = c.split(';').map(p => p.trim());
|
|
37
|
-
const flags = parts.slice(1);
|
|
38
|
-
const [name, value] = parts[0].split('=').map(decodeURIComponent);
|
|
39
|
-
const httpOnly = flags.includes('HttpOnly');
|
|
40
|
-
const secure = flags.includes('Secure');
|
|
41
|
-
const maxAgePart = flags.find(f => f.startsWith('Max-Age='))?.split('=')[1];
|
|
42
|
-
context.cookies.set({
|
|
43
|
-
name,
|
|
44
|
-
value,
|
|
45
|
-
httpOnly,
|
|
46
|
-
secure,
|
|
47
|
-
maxAge: maxAgePart ? parseInt(maxAgePart) : undefined
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
const error = body[0].error;
|
|
52
|
-
if (error) {
|
|
53
|
-
throw new Error(error);
|
|
54
|
-
}
|
|
55
|
-
const value = body[0].data;
|
|
56
|
-
if (typeof value === 'object' && value?.__wjstype === 'realtime') {
|
|
57
|
-
return {
|
|
58
|
-
subscribe(subscriber) {
|
|
59
|
-
rt.subscribe(value.url, value.channel, value.token, value.authHost, subscriber);
|
|
60
|
-
return () => {
|
|
61
|
-
rt.unsubscribe(value.url, value.channel, subscriber);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
return value;
|
|
67
|
-
}
|
|
68
|
-
;
|
|
69
|
-
export function apiTree(INTERNAL_API_URL, path = []) {
|
|
70
|
-
return new Proxy(function () { }, {
|
|
71
|
-
apply(_target, _thisArg, args) {
|
|
72
|
-
return callApi(INTERNAL_API_URL, path, ...args);
|
|
73
|
-
},
|
|
74
|
-
get(_target, prop) {
|
|
75
|
-
return apiTree(INTERNAL_API_URL, [...path, prop]);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
;
|
|
1
|
+
export * from 'wirejs-deploy-aws/client';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
export * from 'wirejs-
|
|
2
|
-
export { FileService } from './services/file.js';
|
|
3
|
-
export { AuthenticationService } from './services/authentication.js';
|
|
4
|
-
export { EmailSender } from './services/email-sender.js';
|
|
5
|
-
export { LLM } from './services/llm.js';
|
|
6
|
-
export { DistributedTable } from './resources/distributed-table.js';
|
|
7
|
-
export { RealtimeService } from './services/realtime.js';
|
|
8
|
-
export { BackgroundJob } from './resources/background-job.js';
|
|
9
|
-
export { CronJob } from './resources/cron-job.js';
|
|
10
|
-
export { Endpoint } from './resources/endpoint.js';
|
|
1
|
+
export * from 'wirejs-deploy-aws';
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// want to re-implement.
|
|
4
|
-
export * from 'wirejs-resources';
|
|
5
|
-
import { FileService } from './services/file.js';
|
|
6
|
-
export { FileService } from './services/file.js';
|
|
7
|
-
import { AuthenticationService } from './services/authentication.js';
|
|
8
|
-
export { AuthenticationService } from './services/authentication.js';
|
|
9
|
-
import { EmailSender } from './services/email-sender.js';
|
|
10
|
-
export { EmailSender } from './services/email-sender.js';
|
|
11
|
-
import { LLM } from './services/llm.js';
|
|
12
|
-
export { LLM } from './services/llm.js';
|
|
13
|
-
import { DistributedTable } from './resources/distributed-table.js';
|
|
14
|
-
export { DistributedTable } from './resources/distributed-table.js';
|
|
15
|
-
import { RealtimeService } from './services/realtime.js';
|
|
16
|
-
export { RealtimeService } from './services/realtime.js';
|
|
17
|
-
import { BackgroundJob } from './resources/background-job.js';
|
|
18
|
-
export { BackgroundJob } from './resources/background-job.js';
|
|
19
|
-
import { CronJob } from './resources/cron-job.js';
|
|
20
|
-
export { CronJob } from './resources/cron-job.js';
|
|
21
|
-
import { Endpoint } from './resources/endpoint.js';
|
|
22
|
-
export { Endpoint } from './resources/endpoint.js';
|
|
23
|
-
// expose resources to other resources that might depend on it.
|
|
24
|
-
overrides.AuthenticationService = AuthenticationService;
|
|
25
|
-
overrides.BackgroundJob = BackgroundJob;
|
|
26
|
-
overrides.CronJob = CronJob;
|
|
27
|
-
overrides.DistributedTable = DistributedTable;
|
|
28
|
-
overrides.EmailSender = EmailSender;
|
|
29
|
-
overrides.Endpoint = Endpoint;
|
|
30
|
-
overrides.FileService = FileService;
|
|
31
|
-
overrides.LLM = LLM;
|
|
32
|
-
overrides.RealtimeService = RealtimeService;
|
|
1
|
+
// Delegate all AWS resource overrides to the shared package.
|
|
2
|
+
export * from 'wirejs-deploy-aws';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.179",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"recursive-copy": "^2.0.14",
|
|
46
46
|
"rimraf": "^6.0.1",
|
|
47
47
|
"wirejs-dom": "^1.0.44",
|
|
48
|
-
"wirejs-
|
|
48
|
+
"wirejs-deploy-aws": "^0.1.179",
|
|
49
|
+
"wirejs-resources": "^0.1.179"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@aws-amplify/backend": "^1.14.0",
|