wirejs-deploy-amplify-basic 0.0.110-realtime → 0.0.112-realtime
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineBackend,
|
|
3
3
|
} from '@aws-amplify/backend';
|
|
4
|
-
import { RemovalPolicy } from "aws-cdk-lib";
|
|
4
|
+
import { RemovalPolicy, NestedStack } from "aws-cdk-lib";
|
|
5
5
|
import { FunctionUrlAuthType } from 'aws-cdk-lib/aws-lambda';
|
|
6
6
|
import { Bucket, BlockPublicAccess } from 'aws-cdk-lib/aws-s3';
|
|
7
7
|
import { Table, AttributeType, BillingMode } from 'aws-cdk-lib/aws-dynamodb';
|
|
@@ -72,13 +72,21 @@ const PKFieldTypes = {
|
|
|
72
72
|
'number': AttributeType.NUMBER,
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
const allTablesStack = new NestedStack(backend.stack, 'tables', {
|
|
76
|
+
description: 'DynamoDB tables for distributed resources',
|
|
77
|
+
});
|
|
78
|
+
|
|
75
79
|
// TODO: Need to get AttributeType from customer definition.
|
|
76
80
|
for (const resource of generated) {
|
|
77
81
|
if (isDistributedTable(resource)) {
|
|
82
|
+
const tableStack = new NestedStack(allTablesStack, resource.options.absoluteId, {
|
|
83
|
+
description: `DynamoDB table for ${resource.options.absoluteId}`
|
|
84
|
+
});
|
|
85
|
+
|
|
78
86
|
const sanitizedId = resource.options.absoluteId.replace(/[^a-zA-Z0-9-_]/g, '_');
|
|
79
87
|
const tableName = `${TABLE_NAME_PREFIX}${sanitizedId}`
|
|
80
88
|
|
|
81
|
-
const table = new Table(
|
|
89
|
+
const table = new Table(tableStack, sanitizedId, {
|
|
82
90
|
tableName,
|
|
83
91
|
partitionKey: {
|
|
84
92
|
name: resource.options.partitionKey.field,
|
|
@@ -93,7 +101,7 @@ for (const resource of generated) {
|
|
|
93
101
|
pointInTimeRecovery: true,
|
|
94
102
|
});
|
|
95
103
|
|
|
96
|
-
new TableIndexes(
|
|
104
|
+
new TableIndexes(tableStack, `${tableName}Indexes`,
|
|
97
105
|
{
|
|
98
106
|
tableName,
|
|
99
107
|
indexes: (resource.options.indexes ?? []).map((index) => ({
|
|
@@ -137,7 +145,10 @@ function isRealtimeService(resource: any): resource is {
|
|
|
137
145
|
}
|
|
138
146
|
|
|
139
147
|
if (generated.some(isRealtimeService)) {
|
|
140
|
-
const
|
|
148
|
+
const realtimeStack = new NestedStack(backend.stack, 'realtime', {
|
|
149
|
+
description: 'Realtime service for distributed resources',
|
|
150
|
+
});
|
|
151
|
+
const realtime = new RealtimeService(realtimeStack, 'realtime', {
|
|
141
152
|
appId: APP_ID!,
|
|
142
153
|
branchId: BRANCH_ID,
|
|
143
154
|
publisher: backend.api,
|
package/dist/client/index.js
CHANGED
|
@@ -53,7 +53,7 @@ async function callApi(INTERNAL_API_URL, method, ...args) {
|
|
|
53
53
|
throw new Error(error);
|
|
54
54
|
}
|
|
55
55
|
const value = body[0].data;
|
|
56
|
-
if (typeof value === 'object' && value
|
|
56
|
+
if (typeof value === 'object' && value?.__wjstype === 'realtime') {
|
|
57
57
|
return {
|
|
58
58
|
subscribe(subscriber) {
|
|
59
59
|
rt.subscribe(value.url, value.channel, value.token, value.authHost, subscriber);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.112-realtime",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"recursive-copy": "^2.0.14",
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"wirejs-dom": "^1.0.41",
|
|
44
|
-
"wirejs-resources": "^0.1.
|
|
44
|
+
"wirejs-resources": "^0.1.80-realtime"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@aws-amplify/backend": "^1.14.0",
|