@geekmidas/cloud 10.0.0-alpha.2 → 10.0.0-alpha.21
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/index.cjs +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -3
- package/dist/utils/index.cjs +106 -5
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +62 -2
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +62 -2
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +78 -2
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +14 -14
- package/src/dokploy/Application.ts +52 -5
- package/src/dokploy/__tests__/Application.provider.spec.ts +206 -0
- package/src/sst/__tests__/api.spec.ts +231 -0
- package/src/sst/__tests__/fromManifest.integration.spec.ts +368 -0
- package/src/sst/__tests__/function.spec.ts +192 -0
- package/src/sst/__tests__/links.spec.ts +209 -0
- package/src/sst/aws/Api.ts +16 -1
- package/src/sst/aws/Cache.ts +4 -4
- package/src/sst/aws/Database.ts +15 -1
- package/src/sst/fromManifest.ts +16 -5
- package/dist/index-B5CZ1xVf.d.cts +0 -64
- package/dist/index-B5CZ1xVf.d.cts.map +0 -1
- package/dist/index-DhHRjduZ.d.mts +0 -64
- package/dist/index-DhHRjduZ.d.mts.map +0 -1
- package/dist/utils-B1a2UuEO.cjs +0 -129
- package/dist/utils-B1a2UuEO.cjs.map +0 -1
- package/dist/utils-DMOXJ27j.mjs +0 -83
- package/dist/utils-DMOXJ27j.mjs.map +0 -1
package/dist/utils-DMOXJ27j.mjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import os from "node:os";
|
|
2
|
-
import snakecase from "lodash.snakecase";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/index.ts
|
|
5
|
-
function getLocalIpAddress() {
|
|
6
|
-
const networkInterfaces = os.networkInterfaces();
|
|
7
|
-
for (const interfaceName in networkInterfaces) {
|
|
8
|
-
const addresses = networkInterfaces[interfaceName] || [];
|
|
9
|
-
for (const addressInfo of addresses) if (addressInfo.family === "IPv4" && !addressInfo.internal) return addressInfo.address;
|
|
10
|
-
}
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
function environmentCase(name) {
|
|
14
|
-
return snakecase(name).toUpperCase().replace(/_\d+/g, (r) => {
|
|
15
|
-
return r.replace("_", "");
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
let ResourceType = /* @__PURE__ */ function(ResourceType$1) {
|
|
19
|
-
ResourceType$1["ApiGatewayV2"] = "sst.aws.ApiGatewayV2";
|
|
20
|
-
ResourceType$1["Postgres"] = "sst.aws.Postgres";
|
|
21
|
-
ResourceType$1["Function"] = "sst.aws.Function";
|
|
22
|
-
ResourceType$1["ObjectStorage"] = "sst.aws.Bucket";
|
|
23
|
-
ResourceType$1["Vpc"] = "sst.aws.Vpc";
|
|
24
|
-
ResourceType$1["Secret"] = "sst.sst.Secret";
|
|
25
|
-
ResourceType$1["SSTSecret"] = "sst:sst:Secret";
|
|
26
|
-
ResourceType$1["SSTFunction"] = "sst:sst:Function";
|
|
27
|
-
ResourceType$1["SSTApiGatewayV2"] = "sst:aws:ApiGatewayV2";
|
|
28
|
-
ResourceType$1["SSTPostgres"] = "sst:aws:Postgres";
|
|
29
|
-
ResourceType$1["SSTObjectStorage"] = "sst:aws:Bucket";
|
|
30
|
-
ResourceType$1["SnsTopic"] = "sst:aws:SnsTopic";
|
|
31
|
-
return ResourceType$1;
|
|
32
|
-
}({});
|
|
33
|
-
const secret = (name, value) => ({ [environmentCase(name)]: value.value });
|
|
34
|
-
const postgres = (key, value) => {
|
|
35
|
-
const prefix = `${environmentCase(key)}`;
|
|
36
|
-
return {
|
|
37
|
-
[`${prefix}_NAME`]: value.database,
|
|
38
|
-
[`${prefix}_HOST`]: value.host,
|
|
39
|
-
[`${prefix}_PASSWORD`]: value.password,
|
|
40
|
-
[`${prefix}_PORT`]: value.port,
|
|
41
|
-
[`${prefix}_USERNAME`]: value.username
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const bucket = (name, value) => {
|
|
45
|
-
const prefix = `${environmentCase(name)}`;
|
|
46
|
-
return { [`${prefix}_NAME`]: value.name };
|
|
47
|
-
};
|
|
48
|
-
const topic = (name, value) => {
|
|
49
|
-
const prefix = `${environmentCase(name)}`;
|
|
50
|
-
const key = `${prefix}_ARN`;
|
|
51
|
-
return { [key]: value.arn };
|
|
52
|
-
};
|
|
53
|
-
const noop = (_name, _value) => ({});
|
|
54
|
-
const processors = {
|
|
55
|
-
[ResourceType.ApiGatewayV2]: noop,
|
|
56
|
-
[ResourceType.Function]: noop,
|
|
57
|
-
[ResourceType.Vpc]: noop,
|
|
58
|
-
[ResourceType.Secret]: secret,
|
|
59
|
-
[ResourceType.Postgres]: postgres,
|
|
60
|
-
[ResourceType.ObjectStorage]: bucket,
|
|
61
|
-
[ResourceType.SSTSecret]: secret,
|
|
62
|
-
[ResourceType.SSTObjectStorage]: bucket,
|
|
63
|
-
[ResourceType.SSTFunction]: noop,
|
|
64
|
-
[ResourceType.SSTPostgres]: postgres,
|
|
65
|
-
[ResourceType.SSTApiGatewayV2]: noop,
|
|
66
|
-
[ResourceType.SnsTopic]: topic
|
|
67
|
-
};
|
|
68
|
-
function buildResourceEnv(record) {
|
|
69
|
-
const env = {};
|
|
70
|
-
for (const [k, value] of Object.entries(record)) {
|
|
71
|
-
if (typeof value === "string") {
|
|
72
|
-
env[environmentCase(k)] = value;
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const processor = processors[value.type];
|
|
76
|
-
if (processor) Object.assign(env, processor(k, value));
|
|
77
|
-
}
|
|
78
|
-
return env;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
//#endregion
|
|
82
|
-
export { ResourceType, buildResourceEnv, environmentCase, getLocalIpAddress };
|
|
83
|
-
//# sourceMappingURL=utils-DMOXJ27j.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-DMOXJ27j.mjs","names":["name: string","value: Secret","key: string","value: Postgres","value: Bucket","value: SnsTopic","_name: string","_value: any","processors: Record<ResourceType, ResourceProcessor<any>>","record: Record<string, Resource | string>","env: Record<string, string>"],"sources":["../src/utils/index.ts"],"sourcesContent":["import os from 'node:os';\nimport snakecase from 'lodash.snakecase';\n\nexport function getLocalIpAddress() {\n\tconst networkInterfaces = os.networkInterfaces();\n\tfor (const interfaceName in networkInterfaces) {\n\t\tconst addresses = networkInterfaces[interfaceName] || [];\n\t\tfor (const addressInfo of addresses) {\n\t\t\t// Look for an IPv4 address that is not internal (loopback)\n\t\t\tif (addressInfo.family === 'IPv4' && !addressInfo.internal) {\n\t\t\t\treturn addressInfo.address;\n\t\t\t}\n\t\t}\n\t}\n\treturn null; // No suitable IP address found\n}\n\nexport function environmentCase(name: string) {\n\treturn snakecase(name)\n\t\t.toUpperCase()\n\t\t.replace(/_\\d+/g, (r) => {\n\t\t\treturn r.replace('_', '');\n\t\t});\n}\nexport enum ResourceType {\n\tApiGatewayV2 = 'sst.aws.ApiGatewayV2',\n\tPostgres = 'sst.aws.Postgres',\n\tFunction = 'sst.aws.Function',\n\tObjectStorage = 'sst.aws.Bucket',\n\tVpc = 'sst.aws.Vpc',\n\tSecret = 'sst.sst.Secret',\n\tSSTSecret = 'sst:sst:Secret',\n\tSSTFunction = 'sst:sst:Function',\n\tSSTApiGatewayV2 = 'sst:aws:ApiGatewayV2',\n\tSSTPostgres = 'sst:aws:Postgres',\n\tSSTObjectStorage = 'sst:aws:Bucket',\n\tSnsTopic = 'sst:aws:SnsTopic',\n}\n\nconst secret = (name: string, value: Secret) => ({\n\t[environmentCase(name)]: value.value,\n});\nconst postgres = (key: string, value: Postgres) => {\n\tconst prefix = `${environmentCase(key)}`;\n\treturn {\n\t\t[`${prefix}_NAME`]: value.database,\n\t\t[`${prefix}_HOST`]: value.host,\n\t\t[`${prefix}_PASSWORD`]: value.password,\n\t\t[`${prefix}_PORT`]: value.port,\n\t\t[`${prefix}_USERNAME`]: value.username,\n\t};\n};\n\nconst bucket = (name: string, value: Bucket) => {\n\tconst prefix = `${environmentCase(name)}`;\n\treturn {\n\t\t[`${prefix}_NAME`]: value.name,\n\t};\n};\n\nconst topic = (name: string, value: SnsTopic) => {\n\tconst prefix = `${environmentCase(name)}`;\n\tconst key = `${prefix}_ARN`;\n\n\treturn {\n\t\t[key]: value.arn,\n\t};\n};\n\nconst noop = (_name: string, _value: any) => ({});\n\nconst processors: Record<ResourceType, ResourceProcessor<any>> = {\n\t[ResourceType.ApiGatewayV2]: noop,\n\t[ResourceType.Function]: noop,\n\t[ResourceType.Vpc]: noop,\n\t[ResourceType.Secret]: secret,\n\t[ResourceType.Postgres]: postgres,\n\t[ResourceType.ObjectStorage]: bucket,\n\n\t[ResourceType.SSTSecret]: secret,\n\t[ResourceType.SSTObjectStorage]: bucket,\n\t[ResourceType.SSTFunction]: noop,\n\t[ResourceType.SSTPostgres]: postgres,\n\t[ResourceType.SSTApiGatewayV2]: noop,\n\t[ResourceType.SnsTopic]: topic,\n};\n\nexport function buildResourceEnv(\n\trecord: Record<string, Resource | string>,\n): Record<string, string> {\n\tconst env: Record<string, string> = {};\n\tfor (const [k, value] of Object.entries(record)) {\n\t\tif (typeof value === 'string') {\n\t\t\tenv[environmentCase(k)] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst processor = processors[value.type];\n\t\tif (processor) {\n\t\t\tObject.assign(env, processor(k, value));\n\t\t} else {\n\t\t}\n\t}\n\n\treturn env;\n}\n\n/**\n * SST links a resource under one of two spellings — `sst.aws.Bucket` when it\n * comes from the state file, `sst:aws:Bucket` when it comes from the runtime —\n * and `processors` has always handled both. Only the dotted half was admitted\n * here, so the colon half could not be passed to `buildResourceEnv` without a\n * cast, and `SnsTopic` was missing from `Resource` altogether despite being the\n * only thing that produces `*_ARN`.\n */\nexport type ApiGatewayV2 = {\n\ttype: ResourceType.ApiGatewayV2 | ResourceType.SSTApiGatewayV2;\n\turl: string;\n};\n\nexport type Postgres = {\n\tdatabase: string;\n\thost: string;\n\tpassword: string;\n\tport: number;\n\ttype: ResourceType.Postgres | ResourceType.SSTPostgres;\n\tusername: string;\n};\n\nexport type Function = {\n\tname: string;\n\ttype: ResourceType.Function | ResourceType.SSTFunction;\n};\n\nexport type Bucket = {\n\tname: string;\n\ttype: ResourceType.ObjectStorage | ResourceType.SSTObjectStorage;\n};\n\nexport type SnsTopic = {\n\tarn: string;\n\ttype: ResourceType.SnsTopic;\n};\n\nexport type Vpc = {\n\tbastion: string;\n\ttype: ResourceType.Vpc;\n};\n\nexport type Secret = {\n\ttype: ResourceType.Secret | ResourceType.SSTSecret;\n\tvalue: string;\n};\n\nexport type Resource =\n\t| ApiGatewayV2\n\t| Postgres\n\t| Function\n\t| Bucket\n\t| SnsTopic\n\t| Vpc\n\t| Secret;\n\nexport type ResourceProcessor<K extends Resource> = (\n\tname: string,\n\tvalue: K,\n) => Record<string, string | number>;\n"],"mappings":";;;;AAGA,SAAgB,oBAAoB;CACnC,MAAM,oBAAoB,GAAG,mBAAmB;AAChD,MAAK,MAAM,iBAAiB,mBAAmB;EAC9C,MAAM,YAAY,kBAAkB,kBAAkB,CAAE;AACxD,OAAK,MAAM,eAAe,UAEzB,KAAI,YAAY,WAAW,WAAW,YAAY,SACjD,QAAO,YAAY;CAGrB;AACD,QAAO;AACP;AAED,SAAgB,gBAAgBA,MAAc;AAC7C,QAAO,UAAU,KAAK,CACpB,aAAa,CACb,QAAQ,SAAS,CAAC,MAAM;AACxB,SAAO,EAAE,QAAQ,KAAK,GAAG;CACzB,EAAC;AACH;AACD,IAAY,wDAAL;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAED,MAAM,SAAS,CAACA,MAAcC,WAAmB,GAC/C,gBAAgB,KAAK,GAAG,MAAM,MAC/B;AACD,MAAM,WAAW,CAACC,K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