-
Notifications
You must be signed in to change notification settings - Fork 1
/
.sst.config.1676506156660.mjs
128 lines (123 loc) · 9.89 KB
/
.sst.config.1676506156660.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import { createRequire as topLevelCreateRequire } from 'module';const require = topLevelCreateRequire(import.meta.url);
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
// stacks/Api.ts
import { use, Api as ApiGateway } from "sst/constructs";
// stacks/Database.ts
import { Table } from "sst/constructs";
function Database({ stack }) {
const table = new Table(stack, "table", {
fields: {
pk: "string",
sk: "string",
gsi1pk: "string",
gsi1sk: "string",
gsi2pk: "string",
gsi2sk: "string"
},
primaryIndex: {
partitionKey: "pk",
sortKey: "sk"
},
globalIndexes: {
gsi1: {
partitionKey: "gsi1pk",
sortKey: "gsi1sk"
}
}
});
table.addGlobalIndexes({
gsi2: {
partitionKey: "gsi2pk",
sortKey: "gsi2sk"
}
});
return table;
}
__name(Database, "Database");
// stacks/Api.ts
function Api({ stack }) {
const db = use(Database);
const api = new ApiGateway(stack, "api", {
customDomain: stack.stage === "prod" ? "api.sevensingletables.com" : void 0,
defaults: {
function: {
bind: [db]
}
},
routes: {
"POST /graphql": {
type: "graphql",
function: {
handler: "packages/functions/src/graphql/graphql.handler"
},
pothos: {
schema: "packages/functions/src/graphql/schema.ts",
output: "packages/graphql/schema.graphql",
commands: [
"cd packages/graphql && npx @genql/cli --output ./genql --schema ./schema.graphql --esm"
]
}
}
}
});
stack.addOutputs({
API_URL: api.url
});
return api;
}
__name(Api, "Api");
// stacks/Web.ts
import { use as use2, StaticSite } from "sst/constructs";
function Web({ stack }) {
const api = use2(Api);
const isProduction = stack.stage === "prod";
const domain = {
customDomain: {
domainName: "sevensingletables.com",
domainAlias: "www.sevensingletables.com"
}
};
const site = new StaticSite(stack, "site", {
...isProduction ? domain : {},
path: "web",
buildCommand: "yarn build",
buildOutput: "dist",
environment: {
VITE_GRAPHQL_URL: api.url + "/graphql",
VITE_OMG: "YOLO"
},
vite: {
types: "types/my-env.d.ts"
}
});
stack.addOutputs({
SITE: site.url || "https://localhost:3000",
VITE_GRAPHQL_URL: api.url + "/graphql"
});
return api;
}
__name(Web, "Web");
// sst.config.ts
var sst_config_default = {
config(_input) {
return {
name: "seven-single-tables",
region: "us-east-1"
};
},
stacks(app) {
app.setDefaultFunctionProps({
runtime: "nodejs16.x",
srcPath: "services"
});
if (app.stage !== "prod") {
app.setDefaultRemovalPolicy("destroy");
}
app.stack(Database).stack(Api).stack(Web);
}
};
export {
sst_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsic3RhY2tzL0FwaS50cyIsICJzdGFja3MvRGF0YWJhc2UudHMiLCAic3RhY2tzL1dlYi50cyIsICJzc3QuY29uZmlnLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJpbXBvcnQgeyBTdGFja0NvbnRleHQsIHVzZSwgQXBpIGFzIEFwaUdhdGV3YXkgfSBmcm9tIFwic3N0L2NvbnN0cnVjdHNcIjtcbmltcG9ydCB7IERhdGFiYXNlIH0gZnJvbSBcIi4vRGF0YWJhc2VcIjtcblxuZXhwb3J0IGZ1bmN0aW9uIEFwaSh7IHN0YWNrIH06IFN0YWNrQ29udGV4dCkge1xuICBjb25zdCBkYiA9IHVzZShEYXRhYmFzZSk7XG5cbiAgY29uc3QgYXBpID0gbmV3IEFwaUdhdGV3YXkoc3RhY2ssIFwiYXBpXCIsIHtcbiAgICBjdXN0b21Eb21haW46XG4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