@awsless/cli 0.1.28 → 0.1.29
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/dist/app.json +1 -1
- package/dist/app.stage.json +1 -1
- package/dist/bin.js +181 -120
- package/dist/handlers/pubsub-publisher.js +1 -1
- package/dist/handlers/pubsub-server.js +3 -3
- package/package.json +25 -25
package/dist/bin.js
CHANGED
|
@@ -4479,7 +4479,7 @@ var require_node_gyp_build_optional_packages = __commonJS(function(exports, modu
|
|
|
4479
4479
|
|
|
4480
4480
|
// ../../node_modules/.pnpm/msgpackr-extract@3.0.4/node_modules/msgpackr-extract/index.js
|
|
4481
4481
|
var require_msgpackr_extract = __commonJS(function(exports, module) {
|
|
4482
|
-
var __dirname = "/Users/
|
|
4482
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/msgpackr-extract@3.0.4/node_modules/msgpackr-extract";
|
|
4483
4483
|
module.exports = require_node_gyp_build_optional_packages()(__dirname);
|
|
4484
4484
|
});
|
|
4485
4485
|
|
|
@@ -17343,7 +17343,7 @@ var require_src3 = __commonJS(function(exports) {
|
|
|
17343
17343
|
|
|
17344
17344
|
// ../../node_modules/.pnpm/@grpc+grpc-js@1.12.6/node_modules/@grpc/grpc-js/build/src/channelz.js
|
|
17345
17345
|
var require_channelz = __commonJS(function(exports) {
|
|
17346
|
-
var __dirname = "/Users/
|
|
17346
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/@grpc+grpc-js@1.12.6/node_modules/@grpc/grpc-js/build/src";
|
|
17347
17347
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17348
17348
|
exports.registerChannelzSocket = exports.registerChannelzServer = exports.registerChannelzSubchannel = exports.registerChannelzChannel = exports.ChannelzCallTrackerStub = exports.ChannelzCallTracker = exports.ChannelzChildrenTrackerStub = exports.ChannelzChildrenTracker = exports.ChannelzTrace = exports.ChannelzTraceStub = undefined;
|
|
17349
17349
|
exports.unregisterChannelzRef = unregisterChannelzRef;
|
|
@@ -45686,7 +45686,7 @@ var require_replyTransformers = __commonJS(function(exports) {
|
|
|
45686
45686
|
|
|
45687
45687
|
// ../../node_modules/.pnpm/ioredis@6.0.0_supports-color@8.1.1/node_modules/ioredis/built/Command.js
|
|
45688
45688
|
var require_Command = __commonJS(function(exports) {
|
|
45689
|
-
var __dirname = "/Users/
|
|
45689
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/ioredis@6.0.0_supports-color@8.1.1/node_modules/ioredis/built";
|
|
45690
45690
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45691
45691
|
var commands_1 = require_built();
|
|
45692
45692
|
var calculateSlot = require_lib4();
|
|
@@ -66237,7 +66237,7 @@ var require_db_util = __commonJS(function(exports) {
|
|
|
66237
66237
|
|
|
66238
66238
|
// ../../node_modules/.pnpm/redis-memory-server@0.17.1_supports-color@8.1.1/node_modules/redis-memory-server/lib/util/RedisInstance.js
|
|
66239
66239
|
var require_RedisInstance = __commonJS(function(exports) {
|
|
66240
|
-
var __dirname = "/Users/
|
|
66240
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/redis-memory-server@0.17.1_supports-color@8.1.1/node_modules/redis-memory-server/lib/util";
|
|
66241
66241
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
66242
66242
|
function adopt(value) {
|
|
66243
66243
|
return value instanceof P ? value : new P(function(resolve3) {
|
|
@@ -98105,6 +98105,7 @@ __export(exports_dist, {
|
|
|
98105
98105
|
deleteItem: () => deleteItem,
|
|
98106
98106
|
download: () => download,
|
|
98107
98107
|
indexItem: () => indexItem,
|
|
98108
|
+
isServerlessEndpoint: () => isServerlessEndpoint,
|
|
98108
98109
|
launch: () => launch,
|
|
98109
98110
|
mockOpenSearch: () => mockOpenSearch,
|
|
98110
98111
|
number: () => number4,
|
|
@@ -98119,8 +98120,8 @@ __export(exports_dist, {
|
|
|
98119
98120
|
});
|
|
98120
98121
|
import { Agent } from "https";
|
|
98121
98122
|
import { fromEnv as fromEnv2 } from "@aws-sdk/credential-providers";
|
|
98122
|
-
import { Client as
|
|
98123
|
-
import { AwsSigv4Signer
|
|
98123
|
+
import { Client as Client2 } from "@opensearch-project/opensearch";
|
|
98124
|
+
import { AwsSigv4Signer } from "@opensearch-project/opensearch/aws";
|
|
98124
98125
|
import { createHash as createHash17 } from "crypto";
|
|
98125
98126
|
import { mkdir as mkdir6, rename as rename3, rm as rm8, stat as stat3 } from "fs/promises";
|
|
98126
98127
|
import { join as join30, resolve as resolve4 } from "path";
|
|
@@ -98130,15 +98131,16 @@ import { BigFloat, parse as parse10 } from "@awsless/big-float";
|
|
|
98130
98131
|
var import_decompress, import_sleep_await, mock, searchClient = (options = {}, service = "es") => {
|
|
98131
98132
|
if (mock)
|
|
98132
98133
|
return mock;
|
|
98133
|
-
const
|
|
98134
|
-
|
|
98134
|
+
const node = options.node ?? process.env.SEARCH_DOMAIN;
|
|
98135
|
+
if (!node)
|
|
98136
|
+
throw new Error("No search domain - set the SEARCH_DOMAIN env or pass the node option.");
|
|
98135
98137
|
const first = Array.isArray(node) ? node[0] : node;
|
|
98136
98138
|
const nodeUrl = typeof first === "string" ? first : first?.url.href ?? "";
|
|
98137
|
-
return new
|
|
98139
|
+
return new Client2({
|
|
98138
98140
|
node,
|
|
98139
|
-
requestTimeout: 5000,
|
|
98141
|
+
requestTimeout: isServerlessEndpoint(nodeUrl) ? 30000 : 5000,
|
|
98140
98142
|
agent: nodeUrl.startsWith("https") ? () => new Agent({ keepAlive: false }) : undefined,
|
|
98141
|
-
...
|
|
98143
|
+
...AwsSigv4Signer({
|
|
98142
98144
|
region: process.env.AWS_REGION,
|
|
98143
98145
|
service,
|
|
98144
98146
|
getCredentials: fromEnv2()
|
|
@@ -98146,7 +98148,11 @@ var import_decompress, import_sleep_await, mock, searchClient = (options = {}, s
|
|
|
98146
98148
|
...options
|
|
98147
98149
|
});
|
|
98148
98150
|
}, mockClient = (host, port) => {
|
|
98149
|
-
mock = new
|
|
98151
|
+
mock = new Client2({ node: `http://${host}:${port}` });
|
|
98152
|
+
}, isServerlessEndpoint = (endpoint) => {
|
|
98153
|
+
return endpoint?.includes(".aoss.") ?? false;
|
|
98154
|
+
}, isServerless = (client) => {
|
|
98155
|
+
return isServerlessEndpoint(client.connectionPool.connections[0]?.url.href);
|
|
98150
98156
|
}, getArchiveName = (version3) => {
|
|
98151
98157
|
const name = `opensearch-min-${version3}`;
|
|
98152
98158
|
switch (process.platform) {
|
|
@@ -98401,8 +98407,9 @@ ${output.join("")}`);
|
|
|
98401
98407
|
}, bulk = async ({ items, client, refresh: refresh2 = true }) => {
|
|
98402
98408
|
if (items.length === 0)
|
|
98403
98409
|
return;
|
|
98404
|
-
const
|
|
98405
|
-
|
|
98410
|
+
const openSearchClient = client ?? items[0].table.client();
|
|
98411
|
+
const response = await openSearchClient.bulk({
|
|
98412
|
+
refresh: isServerless(openSearchClient) ? undefined : refresh2,
|
|
98406
98413
|
body: items.map((entry) => {
|
|
98407
98414
|
const body = [{ [entry.action]: {
|
|
98408
98415
|
_id: entry.id,
|
|
@@ -98466,27 +98473,30 @@ ${output.join("")}`);
|
|
|
98466
98473
|
items: items.map((item) => table2.schema.decode(item._source))
|
|
98467
98474
|
};
|
|
98468
98475
|
}, indexItem = async (table2, id, item, { refresh: refresh2 = true } = {}) => {
|
|
98469
|
-
|
|
98476
|
+
const client = table2.client();
|
|
98477
|
+
await client.index({
|
|
98470
98478
|
index: table2.index,
|
|
98471
98479
|
id,
|
|
98472
|
-
refresh: refresh2,
|
|
98480
|
+
refresh: isServerless(client) ? undefined : refresh2,
|
|
98473
98481
|
body: table2.schema.encode(item)
|
|
98474
98482
|
});
|
|
98475
98483
|
}, deleteItem = async (table2, id, { refresh: refresh2 = true } = {}) => {
|
|
98476
|
-
|
|
98484
|
+
const client = table2.client();
|
|
98485
|
+
await client.delete({
|
|
98477
98486
|
index: table2.index,
|
|
98478
98487
|
id,
|
|
98479
|
-
refresh: refresh2
|
|
98488
|
+
refresh: isServerless(client) ? undefined : refresh2
|
|
98480
98489
|
});
|
|
98481
98490
|
}, updateItem = async (table2, id, item, { refresh: refresh2 = true } = {}) => {
|
|
98482
|
-
|
|
98491
|
+
const client = table2.client();
|
|
98492
|
+
await client.update({
|
|
98483
98493
|
index: table2.index,
|
|
98484
98494
|
id,
|
|
98485
98495
|
body: {
|
|
98486
98496
|
doc: table2.schema.encode(item),
|
|
98487
98497
|
doc_as_upsert: true
|
|
98488
98498
|
},
|
|
98489
|
-
refresh: refresh2
|
|
98499
|
+
refresh: isServerless(client) ? undefined : refresh2
|
|
98490
98500
|
});
|
|
98491
98501
|
}, createIndex = async (table2) => {
|
|
98492
98502
|
if (!(await table2.client().cat.indices({ format: "json" })).body.find((item) => {
|
|
@@ -143099,6 +143109,7 @@ var bundleFeature = defineFeature({
|
|
|
143099
143109
|
ctx.onEnv(addEnv);
|
|
143100
143110
|
ctx.onBind(addEnv);
|
|
143101
143111
|
ctx.onPermission(addPermission);
|
|
143112
|
+
ctx.shared.add("function", "role", "bundle", role);
|
|
143102
143113
|
ctx.shared.set("bundle", "main", {
|
|
143103
143114
|
lambda,
|
|
143104
143115
|
alias,
|
|
@@ -144605,6 +144616,7 @@ var createLambdaFunction = (ctx, id, local) => {
|
|
|
144605
144616
|
addPermission(...props.permissions ?? []);
|
|
144606
144617
|
ctx.onPermission(addPermission);
|
|
144607
144618
|
}
|
|
144619
|
+
ctx.shared.add("function", "role", name, role);
|
|
144608
144620
|
const policy = new aws.iam.RolePolicy(group, "policy", {
|
|
144609
144621
|
role: role.name,
|
|
144610
144622
|
name: "lambda-policy",
|
|
@@ -166021,11 +166033,14 @@ var rpcFeature = defineFeature({
|
|
|
166021
166033
|
});
|
|
166022
166034
|
|
|
166023
166035
|
// src/formation/open-search.ts
|
|
166024
|
-
|
|
166025
|
-
import {
|
|
166036
|
+
init_dist2();
|
|
166037
|
+
import { fromTemporaryCredentials } from "@aws-sdk/credential-providers";
|
|
166038
|
+
import { Client as Client3 } from "@opensearch-project/opensearch";
|
|
166039
|
+
import { AwsSigv4Signer as AwsSigv4Signer2 } from "@opensearch-project/opensearch/aws";
|
|
166026
166040
|
var SearchIndex = createCustomResourceClass("open-search", "index");
|
|
166027
166041
|
var inputSchema = exports_external.object({
|
|
166028
166042
|
endpoint: exports_external.string(),
|
|
166043
|
+
role: exports_external.string().optional(),
|
|
166029
166044
|
index: exports_external.string(),
|
|
166030
166045
|
mappings: exports_external.string(),
|
|
166031
166046
|
settings: exports_external.string()
|
|
@@ -166033,8 +166048,8 @@ var inputSchema = exports_external.object({
|
|
|
166033
166048
|
var applySearchIndex = async (client, props) => {
|
|
166034
166049
|
const mappings = props.mappings ?? {};
|
|
166035
166050
|
const settings2 = props.settings ?? {};
|
|
166036
|
-
const
|
|
166037
|
-
if (!
|
|
166051
|
+
const exists3 = await client.indices.exists({ index: props.index });
|
|
166052
|
+
if (!exists3.body) {
|
|
166038
166053
|
await client.indices.create({
|
|
166039
166054
|
index: props.index,
|
|
166040
166055
|
body: {
|
|
@@ -166052,19 +166067,22 @@ var applySearchIndex = async (client, props) => {
|
|
|
166052
166067
|
}
|
|
166053
166068
|
};
|
|
166054
166069
|
var createOpenSearchProvider = ({ credentials: credentials2, region }) => {
|
|
166055
|
-
const getClient = (endpoint) => {
|
|
166056
|
-
return new
|
|
166057
|
-
node: `https://${endpoint}`,
|
|
166058
|
-
...
|
|
166070
|
+
const getClient = (endpoint, role) => {
|
|
166071
|
+
return new Client3({
|
|
166072
|
+
node: URL.canParse(endpoint) ? endpoint : `https://${endpoint}`,
|
|
166073
|
+
...AwsSigv4Signer2({
|
|
166059
166074
|
region,
|
|
166060
|
-
service: "es",
|
|
166061
|
-
getCredentials:
|
|
166075
|
+
service: isServerlessEndpoint(endpoint) ? "aoss" : "es",
|
|
166076
|
+
getCredentials: role ? fromTemporaryCredentials({
|
|
166077
|
+
params: { RoleArn: role, RoleSessionName: "awsless-search-index" },
|
|
166078
|
+
masterCredentials: credentials2
|
|
166079
|
+
}) : credentials2
|
|
166062
166080
|
})
|
|
166063
166081
|
});
|
|
166064
166082
|
};
|
|
166065
166083
|
const apply = async (state) => {
|
|
166066
166084
|
const props = inputSchema.parse(state);
|
|
166067
|
-
await applySearchIndex(getClient(props.endpoint), {
|
|
166085
|
+
await applySearchIndex(getClient(props.endpoint, props.role), {
|
|
166068
166086
|
index: props.index,
|
|
166069
166087
|
mappings: JSON.parse(props.mappings),
|
|
166070
166088
|
settings: JSON.parse(props.settings)
|
|
@@ -166089,7 +166107,7 @@ var createOpenSearchProvider = ({ credentials: credentials2, region }) => {
|
|
|
166089
166107
|
},
|
|
166090
166108
|
async deleteResource(props) {
|
|
166091
166109
|
const state = inputSchema.parse(props.state);
|
|
166092
|
-
await getClient(state.endpoint).indices.delete({ index: state.index }, { ignore: [404] });
|
|
166110
|
+
await getClient(state.endpoint, state.role).indices.delete({ index: state.index }, { ignore: [404] });
|
|
166093
166111
|
}
|
|
166094
166112
|
}
|
|
166095
166113
|
});
|
|
@@ -166187,7 +166205,7 @@ var searchOnDev = async (ctx) => {
|
|
|
166187
166205
|
for (const line of sink3.tail) {
|
|
166188
166206
|
ctx.emitEvent("search", { date: Date.now(), line });
|
|
166189
166207
|
}
|
|
166190
|
-
ctx.addEnv("SEARCH_DOMAIN", `localhost:${port}`);
|
|
166208
|
+
ctx.addEnv("SEARCH_DOMAIN", `http://localhost:${port}`);
|
|
166191
166209
|
const client = new Client4({ node: `http://localhost:${port}` });
|
|
166192
166210
|
for (const { stackName, id, props } of indexes) {
|
|
166193
166211
|
await applySearchIndex(client, {
|
|
@@ -166242,58 +166260,130 @@ var searchFeature = defineFeature({
|
|
|
166242
166260
|
const group = new Group(ctx.base, "search", "main");
|
|
166243
166261
|
const name = `${ctx.app.name}-${shortId([ctx.app.name, "search", "main"].join("--"))}`;
|
|
166244
166262
|
const props = ctx.appConfig.search;
|
|
166245
|
-
const
|
|
166246
|
-
|
|
166247
|
-
|
|
166248
|
-
|
|
166249
|
-
clusterConfig: {
|
|
166250
|
-
instanceType: `${props.type}.search`,
|
|
166251
|
-
instanceCount: props.count
|
|
166252
|
-
},
|
|
166253
|
-
ebsOptions: {
|
|
166254
|
-
ebsEnabled: true,
|
|
166255
|
-
volumeSize: toGibibytes(props.storage),
|
|
166256
|
-
volumeType: "gp2"
|
|
166257
|
-
},
|
|
166258
|
-
domainEndpointOptions: {
|
|
166259
|
-
enforceHttps: true
|
|
166260
|
-
},
|
|
166261
|
-
softwareUpdateOptions: {
|
|
166262
|
-
autoSoftwareUpdateEnabled: true
|
|
166263
|
-
},
|
|
166264
|
-
nodeToNodeEncryption: {
|
|
166265
|
-
enabled: false
|
|
166266
|
-
},
|
|
166267
|
-
encryptAtRest: {
|
|
166268
|
-
enabled: false
|
|
166269
|
-
},
|
|
166270
|
-
accessPolicies: JSON.stringify({
|
|
166263
|
+
const accessRole = new aws.iam.Role(group, "access-role", {
|
|
166264
|
+
name: `${name}-search-access`,
|
|
166265
|
+
description: `Search data access ${ctx.app.name}`,
|
|
166266
|
+
assumeRolePolicy: JSON.stringify({
|
|
166271
166267
|
Version: "2012-10-17",
|
|
166272
166268
|
Statement: [
|
|
166273
166269
|
{
|
|
166274
166270
|
Effect: "Allow",
|
|
166275
|
-
Action: "
|
|
166276
|
-
Principal: {
|
|
166277
|
-
|
|
166278
|
-
Condition: {
|
|
166279
|
-
StringLike: {
|
|
166280
|
-
"AWS:PrincipalArn": `this-will-never-work`
|
|
166281
|
-
}
|
|
166271
|
+
Action: "sts:AssumeRole",
|
|
166272
|
+
Principal: {
|
|
166273
|
+
AWS: `arn:aws:iam::${ctx.accountId}:root`
|
|
166282
166274
|
}
|
|
166283
166275
|
}
|
|
166284
166276
|
]
|
|
166277
|
+
}),
|
|
166278
|
+
inlinePolicy: [
|
|
166279
|
+
{
|
|
166280
|
+
name: "search-access",
|
|
166281
|
+
policy: JSON.stringify({
|
|
166282
|
+
Version: "2012-10-17",
|
|
166283
|
+
Statement: [
|
|
166284
|
+
{
|
|
166285
|
+
Effect: "Allow",
|
|
166286
|
+
Action: ["aoss:APIAccessAll"],
|
|
166287
|
+
Resource: [`arn:aws:aoss:${ctx.appConfig.region}:${ctx.accountId}:collection/*`]
|
|
166288
|
+
}
|
|
166289
|
+
]
|
|
166290
|
+
})
|
|
166291
|
+
}
|
|
166292
|
+
]
|
|
166293
|
+
}, {
|
|
166294
|
+
replaceOnChanges: ["name"]
|
|
166295
|
+
});
|
|
166296
|
+
const encryption = new aws.opensearchserverless.SecurityPolicy(group, "encryption", {
|
|
166297
|
+
name,
|
|
166298
|
+
type: "encryption",
|
|
166299
|
+
policy: JSON.stringify({
|
|
166300
|
+
Rules: [
|
|
166301
|
+
{
|
|
166302
|
+
ResourceType: "collection",
|
|
166303
|
+
Resource: [`collection/${name}`]
|
|
166304
|
+
}
|
|
166305
|
+
],
|
|
166306
|
+
AWSOwnedKey: true
|
|
166285
166307
|
})
|
|
166308
|
+
});
|
|
166309
|
+
const network = new aws.opensearchserverless.SecurityPolicy(group, "network", {
|
|
166310
|
+
name,
|
|
166311
|
+
type: "network",
|
|
166312
|
+
policy: JSON.stringify([
|
|
166313
|
+
{
|
|
166314
|
+
Rules: [
|
|
166315
|
+
{
|
|
166316
|
+
ResourceType: "collection",
|
|
166317
|
+
Resource: [`collection/${name}`]
|
|
166318
|
+
}
|
|
166319
|
+
],
|
|
166320
|
+
AllowFromPublic: true
|
|
166321
|
+
}
|
|
166322
|
+
])
|
|
166323
|
+
});
|
|
166324
|
+
const dataAccessPolicy = (principals) => {
|
|
166325
|
+
return JSON.stringify([
|
|
166326
|
+
{
|
|
166327
|
+
Rules: [
|
|
166328
|
+
{
|
|
166329
|
+
ResourceType: "collection",
|
|
166330
|
+
Resource: [`collection/${name}`],
|
|
166331
|
+
Permission: ["aoss:*"]
|
|
166332
|
+
},
|
|
166333
|
+
{
|
|
166334
|
+
ResourceType: "index",
|
|
166335
|
+
Resource: [`index/${name}/*`],
|
|
166336
|
+
Permission: ["aoss:*"]
|
|
166337
|
+
}
|
|
166338
|
+
],
|
|
166339
|
+
Principal: principals
|
|
166340
|
+
}
|
|
166341
|
+
]);
|
|
166342
|
+
};
|
|
166343
|
+
const access2 = new aws.opensearchserverless.AccessPolicy(group, "access", {
|
|
166344
|
+
name,
|
|
166345
|
+
type: "data",
|
|
166346
|
+
policy: accessRole.arn.pipe((arn) => dataAccessPolicy([arn]))
|
|
166347
|
+
});
|
|
166348
|
+
ctx.onReady(() => {
|
|
166349
|
+
const roles = ctx.shared.list("function", "role");
|
|
166350
|
+
new aws.opensearchserverless.AccessPolicy(group, "access-functions", {
|
|
166351
|
+
name: `${name}-functions`,
|
|
166352
|
+
type: "data",
|
|
166353
|
+
policy: $combine(...roles.map((role) => role.arn)).pipe(dataAccessPolicy)
|
|
166354
|
+
});
|
|
166355
|
+
});
|
|
166356
|
+
const collectionGroup = new aws.opensearchserverless.CollectionGroup(group, "group", {
|
|
166357
|
+
name,
|
|
166358
|
+
generation: "NEXTGEN",
|
|
166359
|
+
standbyReplicas: "ENABLED",
|
|
166360
|
+
capacityLimits: [
|
|
166361
|
+
{
|
|
166362
|
+
minSearchCapacityInOcu: props.capacity.search.min,
|
|
166363
|
+
maxSearchCapacityInOcu: props.capacity.search.max,
|
|
166364
|
+
minIndexingCapacityInOcu: props.capacity.indexing.min,
|
|
166365
|
+
maxIndexingCapacityInOcu: props.capacity.indexing.max
|
|
166366
|
+
}
|
|
166367
|
+
]
|
|
166286
166368
|
}, {
|
|
166287
|
-
|
|
166288
|
-
import: ctx.import ? name : undefined,
|
|
166289
|
-
replaceOnChanges: ["engineVersion", "domainName"]
|
|
166369
|
+
replaceOnChanges: ["name", "generation"]
|
|
166290
166370
|
});
|
|
166291
|
-
|
|
166371
|
+
const collection = new aws.opensearchserverless.Collection(group, "collection", {
|
|
166372
|
+
name,
|
|
166373
|
+
type: "SEARCH",
|
|
166374
|
+
collectionGroupName: collectionGroup.name
|
|
166375
|
+
}, {
|
|
166376
|
+
dependsOn: [encryption, network, access2],
|
|
166377
|
+
replaceOnChanges: ["name", "collectionGroupName"]
|
|
166378
|
+
});
|
|
166379
|
+
const endpoint = collection.collectionEndpoint;
|
|
166380
|
+
ctx.addEnv("SEARCH_DOMAIN", endpoint);
|
|
166292
166381
|
ctx.addPermission({
|
|
166293
|
-
actions: ["
|
|
166294
|
-
resources: [
|
|
166382
|
+
actions: ["aoss:APIAccessAll"],
|
|
166383
|
+
resources: [collection.arn]
|
|
166295
166384
|
});
|
|
166296
|
-
ctx.shared.set("search", "endpoint",
|
|
166385
|
+
ctx.shared.set("search", "endpoint", endpoint);
|
|
166386
|
+
ctx.shared.set("search", "accessRole", accessRole);
|
|
166297
166387
|
},
|
|
166298
166388
|
onStack(ctx) {
|
|
166299
166389
|
const indexes = Object.entries(ctx.stackConfig.searchs ?? {});
|
|
@@ -166301,15 +166391,16 @@ var searchFeature = defineFeature({
|
|
|
166301
166391
|
return;
|
|
166302
166392
|
}
|
|
166303
166393
|
const endpoint = ctx.shared.get("search", "endpoint");
|
|
166394
|
+
const accessRole = ctx.shared.get("search", "accessRole");
|
|
166304
166395
|
for (const [id, props] of indexes) {
|
|
166305
166396
|
const group = new Group(ctx.stack, "search", id);
|
|
166306
166397
|
new SearchIndex(group, "index", {
|
|
166307
166398
|
endpoint,
|
|
166399
|
+
role: accessRole.arn,
|
|
166308
166400
|
index: formatSearchIndexName(ctx.stackConfig.name, id),
|
|
166309
166401
|
mappings: JSON.stringify(resolveSearchMappings(props) ?? {}),
|
|
166310
166402
|
settings: JSON.stringify(props.settings ?? {})
|
|
166311
166403
|
}, {
|
|
166312
|
-
retainOnDelete: ctx.appConfig.removal === "retain",
|
|
166313
166404
|
replaceOnChanges: ["endpoint", "index"]
|
|
166314
166405
|
});
|
|
166315
166406
|
}
|
|
@@ -167915,6 +168006,10 @@ class SharedData {
|
|
|
167915
168006
|
}
|
|
167916
168007
|
return value;
|
|
167917
168008
|
}
|
|
168009
|
+
list(feature, name) {
|
|
168010
|
+
const key = `${feature}/${name.toString()}`;
|
|
168011
|
+
return [...this.entries.get(key)?.values() ?? []];
|
|
168012
|
+
}
|
|
167918
168013
|
add(feature, name, entry, value) {
|
|
167919
168014
|
const key = `${feature}/${name.toString()}`;
|
|
167920
168015
|
if (!this.entries.has(key)) {
|
|
@@ -168508,52 +168603,18 @@ var RpcSchema = exports_external.record(ResourceIdSchema, exports_external.recor
|
|
|
168508
168603
|
])).describe("The queries for your global RPC API.")).describe("Define the schema in your stack for your global RPC API.").optional();
|
|
168509
168604
|
|
|
168510
168605
|
// src/feature/search/schema.ts
|
|
168511
|
-
var
|
|
168512
|
-
|
|
168513
|
-
|
|
168514
|
-
|
|
168515
|
-
|
|
168516
|
-
|
|
168517
|
-
"t3.small",
|
|
168518
|
-
"t3.medium",
|
|
168519
|
-
"m3.medium",
|
|
168520
|
-
"m3.large",
|
|
168521
|
-
"m3.xlarge",
|
|
168522
|
-
"m3.2xlarge",
|
|
168523
|
-
"m4.large",
|
|
168524
|
-
"m4.xlarge",
|
|
168525
|
-
"m4.2xlarge",
|
|
168526
|
-
"m4.4xlarge",
|
|
168527
|
-
"m4.10xlarge",
|
|
168528
|
-
"m5.large",
|
|
168529
|
-
"m5.xlarge",
|
|
168530
|
-
"m5.2xlarge",
|
|
168531
|
-
"m5.4xlarge",
|
|
168532
|
-
"m5.12xlarge",
|
|
168533
|
-
"m5.24xlarge",
|
|
168534
|
-
"r5.large",
|
|
168535
|
-
"r5.xlarge",
|
|
168536
|
-
"r5.2xlarge",
|
|
168537
|
-
"r5.4xlarge",
|
|
168538
|
-
"r5.12xlarge",
|
|
168539
|
-
"r5.24xlarge",
|
|
168540
|
-
"c5.large",
|
|
168541
|
-
"c5.xlarge",
|
|
168542
|
-
"c5.2xlarge",
|
|
168543
|
-
"c5.4xlarge",
|
|
168544
|
-
"c5.9xlarge",
|
|
168545
|
-
"c5.18xlarge"
|
|
168546
|
-
]),
|
|
168547
|
-
exports_external.string()
|
|
168548
|
-
]).describe("Instance type of data nodes in the cluster.");
|
|
168549
|
-
var CountSchema = exports_external.number().int().min(1).max(10).describe("Number of instances in the cluster.");
|
|
168550
|
-
var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes(100)), "Maximum storage size is 100 GB").describe("The storage size of every data node in the cluster.");
|
|
168606
|
+
var ocuCounts = [0, 2, 4, 8, 16, 32, 48, 64, 80, 96];
|
|
168607
|
+
var OcuCountSchema = exports_external.number().refine((value) => ocuCounts.includes(value), "Capacity must be 0, 2, 4, 8, or a multiple of 16 up to 96.");
|
|
168608
|
+
var OcuLimitSchema = exports_external.object({
|
|
168609
|
+
min: OcuCountSchema.default(0).describe("The minimum capacity in OCUs. A value above 0 keeps warm capacity & avoids cold starts."),
|
|
168610
|
+
max: OcuCountSchema.refine((value) => value > 0, "The maximum capacity can not be 0.").default(96).describe("The maximum capacity in OCUs, capping the cost.")
|
|
168611
|
+
}).strict().refine((limit) => limit.min <= limit.max, "The minimum capacity can not exceed the maximum.").prefault({});
|
|
168551
168612
|
var SearchDefaultSchema = exports_external.object({
|
|
168552
|
-
|
|
168553
|
-
|
|
168554
|
-
|
|
168555
|
-
|
|
168556
|
-
}).strict().prefault({}).describe("Configure the shared OpenSearch
|
|
168613
|
+
capacity: exports_external.object({
|
|
168614
|
+
search: OcuLimitSchema.describe("The capacity limits for search requests."),
|
|
168615
|
+
indexing: OcuLimitSchema.describe("The capacity limits for indexing requests.")
|
|
168616
|
+
}).strict().prefault({}).describe("The capacity limits of the collection, in OpenSearch Compute Units (OCUs).")
|
|
168617
|
+
}).strict().prefault({}).describe("Configure the shared OpenSearch Serverless collection that backs every search index in your app. By default the collection scales to zero when idle.");
|
|
168557
168618
|
var IndexNameSchema = exports_external.string().regex(/^[a-z0-9][a-z0-9\-_.]*$/, 'Index names must be lowercase & start with a letter or number, like "users" or "game-events".');
|
|
168558
168619
|
var FieldTypeSchema = exports_external.union([
|
|
168559
168620
|
exports_external.enum([
|
|
@@ -173340,7 +173401,7 @@ var withTestEnvironment = async (appConfig, stackConfigs, run) => {
|
|
|
173340
173401
|
debug: false
|
|
173341
173402
|
});
|
|
173342
173403
|
await waitForSearch2(port, 60000);
|
|
173343
|
-
manifest.servers.search = { domain: `localhost:${port}` };
|
|
173404
|
+
manifest.servers.search = { domain: `http://localhost:${port}` };
|
|
173344
173405
|
}
|
|
173345
173406
|
if (manifest.caches.length > 0) {
|
|
173346
173407
|
redis = new RedisServer;
|
|
@@ -7022,7 +7022,7 @@ var require_replyTransformers = __commonJS(function(exports) {
|
|
|
7022
7022
|
|
|
7023
7023
|
// ../../node_modules/.pnpm/ioredis@6.0.0_supports-color@8.1.1/node_modules/ioredis/built/Command.js
|
|
7024
7024
|
var require_Command = __commonJS(function(exports) {
|
|
7025
|
-
var __dirname = "/Users/
|
|
7025
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/ioredis@6.0.0_supports-color@8.1.1/node_modules/ioredis/built";
|
|
7026
7026
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7027
7027
|
var commands_1 = require_built();
|
|
7028
7028
|
var calculateSlot = require_lib();
|
|
@@ -949719,7 +949719,7 @@ var require_spawn = __commonJS(function(exports) {
|
|
|
949719
949719
|
|
|
949720
949720
|
// ../../node_modules/.pnpm/dynamo-db-local@11.0.0/node_modules/dynamo-db-local/build/node/module.js
|
|
949721
949721
|
var require_module = __commonJS(function(exports) {
|
|
949722
|
-
var __dirname = "/Users/
|
|
949722
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/dynamo-db-local@11.0.0/node_modules/dynamo-db-local/build/node";
|
|
949723
949723
|
Object.defineProperty(exports, "__esModule", {
|
|
949724
949724
|
value: true
|
|
949725
949725
|
});
|
|
@@ -977955,7 +977955,7 @@ var require_replyTransformers = __commonJS(function(exports) {
|
|
|
977955
977955
|
|
|
977956
977956
|
// ../../node_modules/.pnpm/ioredis@6.0.0_supports-color@8.1.1/node_modules/ioredis/built/Command.js
|
|
977957
977957
|
var require_Command = __commonJS(function(exports) {
|
|
977958
|
-
var __dirname = "/Users/
|
|
977958
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/ioredis@6.0.0_supports-color@8.1.1/node_modules/ioredis/built";
|
|
977959
977959
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
977960
977960
|
var commands_1 = require_built();
|
|
977961
977961
|
var calculateSlot = require_lib3();
|
|
@@ -998506,7 +998506,7 @@ var require_db_util = __commonJS(function(exports) {
|
|
|
998506
998506
|
|
|
998507
998507
|
// ../../node_modules/.pnpm/redis-memory-server@0.17.1_supports-color@8.1.1/node_modules/redis-memory-server/lib/util/RedisInstance.js
|
|
998508
998508
|
var require_RedisInstance = __commonJS(function(exports) {
|
|
998509
|
-
var __dirname = "/Users/
|
|
998509
|
+
var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/redis-memory-server@0.17.1_supports-color@8.1.1/node_modules/redis-memory-server/lib/util";
|
|
998510
998510
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P3, generator) {
|
|
998511
998511
|
function adopt(value) {
|
|
998512
998512
|
return value instanceof P3 ? value : new P3(function(resolve) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/awsless/awsless/issues"
|
|
6
6
|
},
|
|
@@ -38,6 +38,24 @@
|
|
|
38
38
|
"@aws-sdk/credential-providers": "3.1113.0",
|
|
39
39
|
"@aws-sdk/lib-dynamodb": "3.1113.0",
|
|
40
40
|
"@aws-sdk/types": "3.974.4",
|
|
41
|
+
"@awsless/big-float": "^0.1.8",
|
|
42
|
+
"@awsless/cloudwatch": "^0.0.2",
|
|
43
|
+
"@awsless/clui": "^0.0.10",
|
|
44
|
+
"@awsless/duration": "^0.0.4",
|
|
45
|
+
"@awsless/dynamodb": "^0.3.28",
|
|
46
|
+
"@awsless/dynamodb-server": "^0.1.11",
|
|
47
|
+
"@awsless/iot": "^0.0.6",
|
|
48
|
+
"@awsless/json": "^0.0.12",
|
|
49
|
+
"@awsless/lambda": "^0.0.49",
|
|
50
|
+
"@awsless/open-search": "^0.0.30",
|
|
51
|
+
"@awsless/redis": "^0.1.14",
|
|
52
|
+
"@awsless/s3": "^0.0.23",
|
|
53
|
+
"@awsless/size": "^0.0.3",
|
|
54
|
+
"@awsless/sns": "^0.0.12",
|
|
55
|
+
"@awsless/sqs": "^0.0.25",
|
|
56
|
+
"@awsless/ts-file-cache": "^0.0.22",
|
|
57
|
+
"@awsless/validate": "^0.2.1",
|
|
58
|
+
"@awsless/weak-cache": "^0.0.2",
|
|
41
59
|
"@clack/prompts": "1.7.0",
|
|
42
60
|
"@opensearch-project/opensearch": "3.6.0",
|
|
43
61
|
"@terraforge/aws": "6.53.0",
|
|
@@ -53,6 +71,7 @@
|
|
|
53
71
|
"@vitest/runner": "4.1.11",
|
|
54
72
|
"@vitest/utils": "4.1.11",
|
|
55
73
|
"aws-cron-expression-validator": "1.0.5",
|
|
74
|
+
"awsless": "^0.1.8",
|
|
56
75
|
"change-case": "5.4.4",
|
|
57
76
|
"chunk": "0.0.3",
|
|
58
77
|
"cli-table3": "0.6.5",
|
|
@@ -79,26 +98,7 @@
|
|
|
79
98
|
"vite": "8.2.1",
|
|
80
99
|
"wildstring": "1.0.9",
|
|
81
100
|
"wrap-ansi": "10.0.1",
|
|
82
|
-
"zod": "4.4.3"
|
|
83
|
-
"@awsless/big-float": "^0.1.8",
|
|
84
|
-
"@awsless/cloudwatch": "^0.0.2",
|
|
85
|
-
"@awsless/clui": "^0.0.10",
|
|
86
|
-
"@awsless/duration": "^0.0.4",
|
|
87
|
-
"@awsless/dynamodb": "^0.3.28",
|
|
88
|
-
"@awsless/dynamodb-server": "^0.1.11",
|
|
89
|
-
"@awsless/json": "^0.0.12",
|
|
90
|
-
"@awsless/open-search": "^0.0.29",
|
|
91
|
-
"@awsless/iot": "^0.0.6",
|
|
92
|
-
"@awsless/lambda": "^0.0.49",
|
|
93
|
-
"@awsless/redis": "^0.1.14",
|
|
94
|
-
"@awsless/size": "^0.0.3",
|
|
95
|
-
"@awsless/sns": "^0.0.12",
|
|
96
|
-
"@awsless/s3": "^0.0.23",
|
|
97
|
-
"@awsless/sqs": "^0.0.25",
|
|
98
|
-
"@awsless/weak-cache": "^0.0.2",
|
|
99
|
-
"awsless": "^0.1.7",
|
|
100
|
-
"@awsless/ts-file-cache": "^0.0.22",
|
|
101
|
-
"@awsless/validate": "^0.2.1"
|
|
101
|
+
"zod": "4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
104
|
"@aws-sdk/client-cloudfront-keyvaluestore": "3.1113.0",
|
|
@@ -114,18 +114,18 @@
|
|
|
114
114
|
"@aws-sdk/client-sts": "3.1113.0",
|
|
115
115
|
"@aws-sdk/credential-providers": "3.1113.0",
|
|
116
116
|
"@aws-sdk/lib-dynamodb": "3.1113.0",
|
|
117
|
-
"@
|
|
117
|
+
"@awsless/big-float": "^0.1.8",
|
|
118
118
|
"@awsless/duration": "^0.0.4",
|
|
119
119
|
"@awsless/dynamodb": "^0.3.28",
|
|
120
120
|
"@awsless/dynamodb-server": "^0.1.11",
|
|
121
121
|
"@awsless/json": "^0.0.12",
|
|
122
122
|
"@awsless/lambda": "^0.0.49",
|
|
123
123
|
"@awsless/s3": "^0.0.23",
|
|
124
|
-
"@awsless/validate": "^0.2.1",
|
|
125
124
|
"@awsless/ts-file-cache": "^0.0.22",
|
|
125
|
+
"@awsless/validate": "^0.2.1",
|
|
126
126
|
"@awsless/weak-cache": "^0.0.2",
|
|
127
|
-
"
|
|
128
|
-
"
|
|
127
|
+
"@opensearch-project/opensearch": "3.6.0",
|
|
128
|
+
"awsless": "^0.1.8"
|
|
129
129
|
},
|
|
130
130
|
"scripts": {
|
|
131
131
|
"test": "bun cli/build-handlers.ts && pnpm vitest run",
|