nebutra 0.0.1 → 0.1.1
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/README.md +91 -17
- package/dist/aws-kms-CYDJXAN2.js +1 -0
- package/dist/chunk-27HYVYB7.js +1 -0
- package/dist/chunk-7DCGNQSQ.js +5 -0
- package/dist/chunk-7HOF72FC.js +1 -0
- package/dist/chunk-7VJYOZUP.js +2 -0
- package/dist/chunk-A2KGYHAM.js +1 -0
- package/dist/chunk-B5RLHF2U.js +40 -0
- package/dist/chunk-DIXI4M5O.js +1 -0
- package/dist/chunk-ELIYZZ3E.js +1 -0
- package/dist/chunk-EXLRPVEX.js +1 -0
- package/dist/chunk-FGJ5K4WM.js +1 -0
- package/dist/chunk-FSRPMVAS.js +1 -0
- package/dist/chunk-HVYUAVRI.js +9 -0
- package/dist/chunk-JDX5NXDX.js +2 -0
- package/dist/chunk-LGUMYJ4Q.js +6 -0
- package/dist/chunk-LOQM6XQV.js +1 -0
- package/dist/chunk-M5MEP5J7.js +20 -0
- package/dist/chunk-OJM5Y4UT.js +1 -0
- package/dist/chunk-PXU2OOBT.js +1 -0
- package/dist/chunk-QEIMNOY2.js +1 -0
- package/dist/chunk-QMKVUKS6.js +1 -0
- package/dist/chunk-RR5R4AKJ.js +1 -0
- package/dist/chunk-SDX64WW4.js +23 -0
- package/dist/chunk-VOA5NGB4.js +1 -0
- package/dist/chunk-XSSPJU77.js +1 -0
- package/dist/credits-7QOXUUSW.js +1787 -0
- package/dist/delegate-AT4FVWBK.js +1 -0
- package/dist/dist-EDNC5USD.js +5 -0
- package/dist/dist-es-6FH6H7HO.js +1 -0
- package/dist/dist-es-7IMKW7US.js +1 -0
- package/dist/dist-es-GP7DK3S3.js +5 -0
- package/dist/dist-es-MB5QKMT4.js +1 -0
- package/dist/dist-es-MQVJCP43.js +1 -0
- package/dist/dist-es-ZA2NRM7G.js +2 -0
- package/dist/dist-es-ZN3KNHF5.js +2 -0
- package/dist/event-streams-T5RU6C4N.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +806 -0
- package/dist/loadSso-BNAQCJV4.js +1 -0
- package/dist/local-WW37QOXE.js +1 -0
- package/dist/logger-LKYUI2MJ.js +1 -0
- package/dist/query_compiler_fast_bg.postgresql-PN2AWLCP.js +2 -0
- package/dist/query_compiler_fast_bg.postgresql.wasm-base64-CASS54LO.js +1 -0
- package/dist/signin-S2JHPGGK.js +1 -0
- package/dist/src-N47JLVAD.js +1 -0
- package/dist/sso-oidc-CGZCRGZD.js +1 -0
- package/dist/sts-S4HBOJFJ.js +6 -0
- package/package.json +27 -25
- package/LICENSE +0 -676
- package/index.js +0 -29
package/README.md
CHANGED
|
@@ -1,29 +1,103 @@
|
|
|
1
1
|
# nebutra
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Governance-first CLI for Nebutra Sailor topology scaffolding, registry-backed feature installs, and platform operations.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
npm install -g nebutra
|
|
9
|
+
# or run directly
|
|
10
|
+
npx nebutra
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Usage
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
```bash
|
|
16
|
+
# Initialize a new project
|
|
17
|
+
nebutra init
|
|
18
|
+
|
|
19
|
+
# Add platform capabilities from the local registry
|
|
20
|
+
nebutra add cache --provider upstash-redis --yes
|
|
21
|
+
|
|
22
|
+
# Scaffold a topology-first app with the create-sailor flag surface
|
|
23
|
+
nebutra create ./my-app --region=hybrid --ai=openai,deepseek
|
|
24
|
+
|
|
25
|
+
# Start dev server
|
|
26
|
+
nebutra dev --preset=ai-saas
|
|
27
|
+
|
|
28
|
+
# Database migrations
|
|
29
|
+
nebutra db migrate
|
|
30
|
+
|
|
31
|
+
# Generate a new app or module
|
|
32
|
+
nebutra generate app blog
|
|
33
|
+
|
|
34
|
+
# Brand customization
|
|
35
|
+
nebutra brand palette --primary=#0047FF
|
|
36
|
+
|
|
37
|
+
# Project health check
|
|
38
|
+
nebutra doctor
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
| Command | Description |
|
|
44
|
+
|---------|-------------|
|
|
45
|
+
| `init` | Initialize project with `nebutra.config.json` |
|
|
46
|
+
| `add [components...]` | Add registry-backed platform features or external UI components (`--21st`, `--v0`) |
|
|
47
|
+
| `create` | Scaffold a topology-first Nebutra Sailor project through create-sailor |
|
|
48
|
+
| `mcp` | Start the MCP server for AI agents and editors |
|
|
49
|
+
| `dev` | Start development server |
|
|
50
|
+
| `generate` | Scaffold apps, modules, and code |
|
|
51
|
+
| `db` | Database migration and management |
|
|
52
|
+
| `brand` | Color palette and brand customization |
|
|
53
|
+
| `i18n` | Internationalization management |
|
|
54
|
+
| `infra` | Infrastructure management (Docker, services) |
|
|
55
|
+
| `env` | Environment variable management |
|
|
56
|
+
| `license` | License activation and management |
|
|
57
|
+
| `ai` | AI provider and gateway routing configuration |
|
|
58
|
+
| `auth` | Authentication setup |
|
|
59
|
+
| `billing` | Billing and subscription management |
|
|
60
|
+
| `preset` | List and apply SaaS presets |
|
|
61
|
+
| `test` | Run unit/E2E tests |
|
|
62
|
+
| `stats` | Monorepo overview and metrics |
|
|
63
|
+
| `schema` | Output full CLI schema (for agents) |
|
|
64
|
+
| `doctor` | Check project health |
|
|
65
|
+
| `admin` | Platform administration (tenants, health) |
|
|
66
|
+
| `community` | Community health and showcase |
|
|
67
|
+
| `ecosystem` | Template marketplace, ideas, showcase, and sync workflows |
|
|
68
|
+
| `services` | Microservice management |
|
|
69
|
+
| `search` | Search index management |
|
|
70
|
+
| `secrets` | Encrypted secrets management |
|
|
71
|
+
| `completions` | Generate shell completions for the current command surface |
|
|
72
|
+
|
|
73
|
+
## Global Options
|
|
19
74
|
|
|
20
|
-
|
|
75
|
+
| Flag | Description |
|
|
76
|
+
|------|-------------|
|
|
77
|
+
| `--verbose` | Enable verbose output |
|
|
78
|
+
| `--quiet` | Suppress non-essential output |
|
|
79
|
+
| `--format <type>` | Output format: `json`, `table`, `plain` |
|
|
80
|
+
| `--yes` | Skip interactive prompts (CI/agent mode) |
|
|
81
|
+
| `--no-color` | Disable colored output |
|
|
21
82
|
|
|
22
|
-
|
|
23
|
-
|---------|---------|
|
|
24
|
-
| [`create-sailor`](https://www.npmjs.com/package/create-sailor) | ⭐ **Scaffolding CLI** — `npm create sailor@latest` |
|
|
25
|
-
| [`@nebutra/sailor`](https://www.npmjs.com/package/@nebutra/sailor) | Scoped alias for the scaffolding CLI |
|
|
83
|
+
## Environment Variables
|
|
26
84
|
|
|
27
|
-
|
|
85
|
+
| Variable | Description |
|
|
86
|
+
|----------|-------------|
|
|
87
|
+
| `NEBUTRA_LOG_LEVEL` | Log level (`debug`, `info`, `warn`, `error`) |
|
|
88
|
+
| `NEBUTRA_OUTPUT_FORMAT` | Default output format |
|
|
89
|
+
| `NO_COLOR` | Disable colored output |
|
|
90
|
+
| `CI` | Auto-enable non-interactive mode |
|
|
91
|
+
|
|
92
|
+
## Agent Schema
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
nebutra schema create
|
|
96
|
+
nebutra schema add
|
|
97
|
+
nebutra schema --all
|
|
98
|
+
```
|
|
28
99
|
|
|
29
|
-
|
|
100
|
+
`schema create` exposes the current `create-sailor` value domains, including
|
|
101
|
+
region, auth, AI, storage, cache, webhooks, CMS, captcha, metering, and MCP
|
|
102
|
+
options. `schema add` exposes local registry features such as `queue`, `search`,
|
|
103
|
+
`cache`, `notifications`, `webhooks`, `cms`, `feature-flags`, and `captcha`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-HVYUAVRI.js";import"./chunk-RR5R4AKJ.js";import"./chunk-SDX64WW4.js";import"./chunk-LOQM6XQV.js";import"./chunk-ELIYZZ3E.js";import"./chunk-M5MEP5J7.js";import"./chunk-7DCGNQSQ.js";import"./chunk-XSSPJU77.js";import"./chunk-QEIMNOY2.js";import"./chunk-7HOF72FC.js";import"./chunk-QMKVUKS6.js";import"./chunk-PXU2OOBT.js";import"./chunk-DIXI4M5O.js";import"./chunk-FGJ5K4WM.js";import"./chunk-EXLRPVEX.js";import"./chunk-FSRPMVAS.js";export{a as AWSKMSProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as h,q as b,r as w,s as j,u as x}from"./chunk-M5MEP5J7.js";import{b as l}from"./chunk-7DCGNQSQ.js";import{e as g}from"./chunk-QEIMNOY2.js";var T=class{async sign(t,i,e){return t}};var q={name:"@aws-sdk/nested-clients",version:"3.996.16",description:"Nested clients for AWS SDK packages.",main:"./dist-cjs/index.js",module:"./dist-es/index.js",types:"./dist-types/index.d.ts",scripts:{build:"yarn lint && concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs","build:cjs":"node ../../scripts/compilation/inline nested-clients","build:es":"tsc -p tsconfig.es.json","build:include:deps":'yarn g:turbo run build -F="$npm_package_name"',"build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",lint:"node ../../scripts/validation/submodules-linter.js --pkg nested-clients",test:"yarn g:vitest run","test:watch":"yarn g:vitest watch"},engines:{node:">=20.0.0"},sideEffects:!1,author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"^3.973.25","@aws-sdk/middleware-host-header":"^3.972.8","@aws-sdk/middleware-logger":"^3.972.8","@aws-sdk/middleware-recursion-detection":"^3.972.9","@aws-sdk/middleware-user-agent":"^3.972.26","@aws-sdk/region-config-resolver":"^3.972.10","@aws-sdk/types":"^3.973.6","@aws-sdk/util-endpoints":"^3.996.5","@aws-sdk/util-user-agent-browser":"^3.972.8","@aws-sdk/util-user-agent-node":"^3.973.12","@smithy/config-resolver":"^4.4.13","@smithy/core":"^3.23.12","@smithy/fetch-http-handler":"^5.3.15","@smithy/hash-node":"^4.2.12","@smithy/invalid-dependency":"^4.2.12","@smithy/middleware-content-length":"^4.2.12","@smithy/middleware-endpoint":"^4.4.27","@smithy/middleware-retry":"^4.4.44","@smithy/middleware-serde":"^4.2.15","@smithy/middleware-stack":"^4.2.12","@smithy/node-config-provider":"^4.3.12","@smithy/node-http-handler":"^4.5.0","@smithy/protocol-http":"^5.3.12","@smithy/smithy-client":"^4.12.7","@smithy/types":"^4.13.1","@smithy/url-parser":"^4.2.12","@smithy/util-base64":"^4.3.2","@smithy/util-body-length-browser":"^4.2.2","@smithy/util-body-length-node":"^4.2.3","@smithy/util-defaults-mode-browser":"^4.3.43","@smithy/util-defaults-mode-node":"^4.2.47","@smithy/util-endpoints":"^3.3.3","@smithy/util-middleware":"^4.2.12","@smithy/util-retry":"^4.2.12","@smithy/util-utf8":"^4.2.2",tslib:"^2.6.2"},devDependencies:{concurrently:"7.0.0","downlevel-dts":"0.10.1",premove:"4.0.0",typescript:"~5.8.3"},typesVersions:{"<4.5":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["./cognito-identity.d.ts","./cognito-identity.js","./signin.d.ts","./signin.js","./sso-oidc.d.ts","./sso-oidc.js","./sso.d.ts","./sso.js","./sts.d.ts","./sts.js","dist-*/**"],browser:{"./dist-es/submodules/cognito-identity/runtimeConfig":"./dist-es/submodules/cognito-identity/runtimeConfig.browser","./dist-es/submodules/signin/runtimeConfig":"./dist-es/submodules/signin/runtimeConfig.browser","./dist-es/submodules/sso-oidc/runtimeConfig":"./dist-es/submodules/sso-oidc/runtimeConfig.browser","./dist-es/submodules/sso/runtimeConfig":"./dist-es/submodules/sso/runtimeConfig.browser","./dist-es/submodules/sts/runtimeConfig":"./dist-es/submodules/sts/runtimeConfig.browser"},"react-native":{},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/packages/nested-clients",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"packages/nested-clients"},exports:{"./package.json":"./package.json","./sso-oidc":{types:"./dist-types/submodules/sso-oidc/index.d.ts",module:"./dist-es/submodules/sso-oidc/index.js",node:"./dist-cjs/submodules/sso-oidc/index.js",import:"./dist-es/submodules/sso-oidc/index.js",require:"./dist-cjs/submodules/sso-oidc/index.js"},"./sts":{types:"./dist-types/submodules/sts/index.d.ts",module:"./dist-es/submodules/sts/index.js",node:"./dist-cjs/submodules/sts/index.js",import:"./dist-es/submodules/sts/index.js",require:"./dist-cjs/submodules/sts/index.js"},"./signin":{types:"./dist-types/submodules/signin/index.d.ts",module:"./dist-es/submodules/signin/index.js",node:"./dist-cjs/submodules/signin/index.js",import:"./dist-es/submodules/signin/index.js",require:"./dist-cjs/submodules/signin/index.js"},"./cognito-identity":{types:"./dist-types/submodules/cognito-identity/index.d.ts",module:"./dist-es/submodules/cognito-identity/index.js",node:"./dist-cjs/submodules/cognito-identity/index.js",import:"./dist-es/submodules/cognito-identity/index.js",require:"./dist-cjs/submodules/cognito-identity/index.js"},"./sso":{types:"./dist-types/submodules/sso/index.d.ts",module:"./dist-es/submodules/sso/index.js",node:"./dist-cjs/submodules/sso/index.js",import:"./dist-es/submodules/sso/index.js",require:"./dist-cjs/submodules/sso/index.js"}}};function z(s){return encodeURIComponent(s).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}var C=s=>{let t=s.length,i=[],e=!1,o,r=0;for(let n=0;n<t;++n){let d=s[n];switch(d){case'"':o!=="\\"&&(e=!e);break;case",":e||(i.push(s.slice(r,n)),r=n+1);break;default:}o=d}return i.push(s.slice(r)),i.map(n=>{n=n.trim();let d=n.length;return d<2?n:(n[0]==='"'&&n[d-1]==='"'&&(n=n.slice(1,d-1)),n.replace(/\\"/g,'"'))})};var p="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:[ne|u?r]?s?day)?",f="(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)",y="(\\d?\\d):(\\d{2}):(\\d{2})(?:\\.(\\d+))?",N="(\\d?\\d)",S="(\\d{4})",U=new RegExp(/^(\d{4})-(\d\d)-(\d\d)[tT](\d\d):(\d\d):(\d\d)(\.(\d+))?(([-+]\d\d:\d\d)|[zZ])$/),A=new RegExp(`^${p}, ${N} ${f} ${S} ${y} GMT$`),J=new RegExp(`^${p}, ${N}-${f}-(\\d\\d) ${y} GMT$`),v=new RegExp(`^${p} ${f} ( [1-9]|\\d\\d) ${y} ${S}$`),W=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$=s=>{if(s==null)return;let t=NaN;if(typeof s=="number")t=s;else if(typeof s=="string"){if(!/^-?\d*\.?\d+$/.test(s))throw new TypeError("parseEpochTimestamp - numeric string invalid.");t=Number.parseFloat(s)}else typeof s=="object"&&s.tag===1&&(t=s.value);if(isNaN(t)||Math.abs(t)===1/0)throw new TypeError("Epoch timestamps must be valid finite numbers.");return new Date(Math.round(t*1e3))},k=s=>{if(s==null)return;if(typeof s!="string")throw new TypeError("RFC3339 timestamps must be strings");let t=U.exec(s);if(!t)throw new TypeError(`Invalid RFC3339 timestamp format ${s}`);let[,i,e,o,r,n,d,,m,a]=t;u(e,1,12),u(o,1,31),u(r,0,23),u(n,0,59),u(d,0,60);let c=new Date(Date.UTC(Number(i),Number(e)-1,Number(o),Number(r),Number(n),Number(d),Number(m)?Math.round(parseFloat(`0.${m}`)*1e3):0));if(c.setUTCFullYear(Number(i)),a.toUpperCase()!="Z"){let[,F,M,R]=/([+-])(\d\d):(\d\d)/.exec(a)||[void 0,"+",0,0],_=F==="-"?1:-1;c.setTime(c.getTime()+_*(Number(M)*60*60*1e3+Number(R)*60*1e3))}return c},E=s=>{if(s==null)return;if(typeof s!="string")throw new TypeError("RFC7231 timestamps must be strings.");let t,i,e,o,r,n,d,m;if((m=A.exec(s))?[,t,i,e,o,r,n,d]=m:(m=J.exec(s))?([,t,i,e,o,r,n,d]=m,e=(Number(e)+1900).toString()):(m=v.exec(s))&&([,i,t,o,r,n,d,e]=m),e&&n){let a=Date.UTC(Number(e),W.indexOf(i),Number(t),Number(o),Number(r),Number(n),d?Math.round(parseFloat(`0.${d}`)*1e3):0);u(t,1,31),u(o,0,23),u(r,0,59),u(n,0,60);let c=new Date(a);return c.setUTCFullYear(Number(e)),c}throw new TypeError(`Invalid RFC7231 date-time value ${s}.`)};function u(s,t,i){let e=Number(s);if(e<t||e>i)throw new Error(`Value ${e} out of range [${t}, ${i}]`)}var D=class extends j{settings;constructor(t){super(),this.settings=t}read(t,i){let e=h.of(t);if(e.isListSchema())return C(i).map(o=>this.read(e.getValueSchema(),o));if(e.isBlobSchema())return(this.serdeContext?.base64Decoder??l)(i);if(e.isTimestampSchema())switch(x(e,this.settings)){case 5:return k(i);case 6:return E(i);case 7:return $(i);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",i),new Date(i)}if(e.isStringSchema()){let o=e.getMergedTraits().mediaType,r=i;if(o)return e.getMergedTraits().httpHeader&&(r=this.base64ToUtf8(r)),(o==="application/json"||o.endsWith("+json"))&&(r=b.from(r)),r}return e.isNumericSchema()?Number(i):e.isBigIntegerSchema()?BigInt(i):e.isBigDecimalSchema()?new w(i,"bigDecimal"):e.isBooleanSchema()?String(i).toLowerCase()==="true":i}base64ToUtf8(t){return(this.serdeContext?.utf8Encoder??g)((this.serdeContext?.base64Decoder??l)(t))}};export{z as a,C as b,D as c,T as d,q as e};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{b as H,c as W,d as J}from"./chunk-QEIMNOY2.js";var $=class{statusCode;reason;headers;body;constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;let r=t;return typeof r.statusCode=="number"&&typeof r.headers=="object"}};var I=e=>encodeURIComponent(e).replace(/[!'()*]/g,ue),ue=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function Y(e){let t=[];for(let r of Object.keys(e).sort()){let o=e[r];if(r=I(r),Array.isArray(o))for(let n=0,i=o.length;n<i;n++)t.push(`${r}=${I(o[n])}`);else{let n=r;(o||typeof o=="string")&&(n+=`=${I(o)}`),t.push(n)}}return t.join("&")}import{Agent as O,request as ge}from"https";function D(e){let t=e&&typeof e=="object"&&"reason"in e?e.reason:void 0;if(t){if(t instanceof Error){let n=new Error("Request aborted");return n.name="AbortError",n.cause=t,n}let o=new Error(String(t));return o.name="AbortError",o}let r=new Error("Request aborted");return r.name="AbortError",r}var K=["ECONNRESET","EPIPE","ETIMEDOUT"];var V=e=>{let t={};for(let r of Object.keys(e)){let o=e[r];t[r]=Array.isArray(o)?o.join(","):o}return t};var u={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)};var X=1e3,z=(e,t,r=0)=>{if(!r)return-1;let o=n=>{let i=u.setTimeout(()=>{e.destroy(),t(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${r} ms.`),{name:"TimeoutError"}))},r-n),s=c=>{c?.connecting?c.on("connect",()=>{u.clearTimeout(i)}):u.clearTimeout(i)};e.socket?s(e.socket):e.on("socket",s)};return r<2e3?(o(0),0):u.setTimeout(o.bind(null,X),X)};var G=(e,t,r=0,o,n)=>r?u.setTimeout(()=>{let i=`@smithy/node-http-handler - [${o?"ERROR":"WARN"}] a request has exceeded the configured ${r} ms requestTimeout.`;if(o){let s=Object.assign(new Error(i),{name:"TimeoutError",code:"ETIMEDOUT"});e.destroy(s),t(s)}else i+=" Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.",n?.warn?.(i)},r):-1;var pe=3e3,Z=(e,{keepAlive:t,keepAliveMsecs:r},o=pe)=>{if(t!==!0)return-1;let n=()=>{e.socket?e.socket.setKeepAlive(t,r||0):e.on("socket",i=>{i.setKeepAlive(t,r||0)})};return o===0?(n(),0):u.setTimeout(n,o)};var Q=3e3,q=(e,t,r=0)=>{let o=n=>{let i=r-n,s=()=>{e.destroy(),t(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${r} ms of inactivity (configured by client requestHandler).`),{name:"TimeoutError"}))};e.socket?(e.socket.setTimeout(i,s),e.on("close",()=>e.socket?.removeListener("timeout",s))):e.setTimeout(i,s)};return 0<r&&r<6e3?(o(0),0):u.setTimeout(o.bind(null,r===0?0:Q),Q)};import{Readable as me}from"stream";var v=6e3;async function ee(e,t,r=v,o=!1){let n=t.headers??{},i=n.Expect||n.expect,s=-1,c=!0;!o&&i==="100-continue"&&(c=await Promise.race([new Promise(f=>{s=Number(u.setTimeout(()=>f(!0),Math.max(v,r)))}),new Promise(f=>{e.on("continue",()=>{u.clearTimeout(s),f(!0)}),e.on("response",()=>{u.clearTimeout(s),f(!1)}),e.on("error",()=>{u.clearTimeout(s),f(!1)})})])),c&&he(e,t.body)}function he(e,t){if(t instanceof me){t.pipe(e);return}if(t){let r=Buffer.isBuffer(t);if(r||typeof t=="string"){r&&t.byteLength===0?e.end():e.end(t);return}let n=t;if(typeof n=="object"&&n.buffer&&typeof n.byteOffset=="number"&&typeof n.byteLength=="number"){e.end(Buffer.from(n.buffer,n.byteOffset,n.byteLength));return}e.end(Buffer.from(t));return}e.end()}var C,te,re=class e{config;configProvider;socketWarningTimestamp=0;externalAgent=!1;metadata={handlerProtocol:"http/1.1"};static create(t){return typeof t?.handle=="function"?t:new e(t)}static checkSocketUsage(t,r,o=console){let{sockets:n,requests:i,maxSockets:s}=t;if(typeof s!="number"||s===1/0||Date.now()-15e3<r)return r;if(n&&i)for(let f in n){let a=n[f]?.length??0,m=i[f]?.length??0;if(a>=s&&m>=2*s)return o?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${a} and ${m} additional requests are enqueued.
|
|
2
|
+
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
3
|
+
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`),Date.now()}return r}constructor(t){this.configProvider=new Promise((r,o)=>{typeof t=="function"?t().then(n=>{r(this.resolveDefaultConfig(n))}).catch(o):r(this.resolveDefaultConfig(t))})}destroy(){this.config?.httpAgent?.destroy(),this.config?.httpsAgent?.destroy()}async handle(t,{abortSignal:r,requestTimeout:o}={}){this.config||(this.config=await this.configProvider);let n=this.config,i=t.protocol==="https:";return!i&&!this.config.httpAgent&&(this.config.httpAgent=await this.config.httpAgentProvider()),new Promise((s,c)=>{let f,a=[],m=async d=>{await f,a.forEach(u.clearTimeout),s(d)},p=async d=>{await f,a.forEach(u.clearTimeout),c(d)};if(r?.aborted){let d=D(r);p(d);return}let g=t.headers??{},x=(g.Expect??g.expect)==="100-continue",T=i?n.httpsAgent:n.httpAgent;x&&!this.externalAgent&&(T=new(i?O:C)({keepAlive:!1,maxSockets:1/0})),a.push(u.setTimeout(()=>{this.socketWarningTimestamp=e.checkSocketUsage(T,this.socketWarningTimestamp,n.logger)},n.socketAcquisitionWarningTimeout??(n.requestTimeout??2e3)+(n.connectionTimeout??1e3)));let P=Y(t.query||{}),L;if(t.username!=null||t.password!=null){let d=t.username??"",y=t.password??"";L=`${d}:${y}`}let M=t.path;P&&(M+=`?${P}`),t.fragment&&(M+=`#${t.fragment}`);let b=t.hostname??"";b[0]==="["&&b.endsWith("]")?b=t.hostname.slice(1,-1):b=t.hostname;let B={headers:t.headers,host:b,method:t.method,path:M,port:t.port,agent:T,auth:L},l=(i?ge:te)(B,d=>{let y=new $({statusCode:d.statusCode||-1,reason:d.statusMessage,headers:V(d.headers),body:d});m({response:y})});if(l.on("error",d=>{K.includes(d.code)?p(Object.assign(d,{name:"TimeoutError"})):p(d)}),r){let d=()=>{l.destroy();let y=D(r);p(y)};if(typeof r.addEventListener=="function"){let y=r;y.addEventListener("abort",d,{once:!0}),l.once("close",()=>y.removeEventListener("abort",d))}else r.onabort=d}let j=o??n.requestTimeout;a.push(z(l,p,n.connectionTimeout)),a.push(G(l,p,j,n.throwOnRequestTimeout,n.logger??console)),a.push(q(l,p,n.socketTimeout));let A=B.agent;typeof A=="object"&&"keepAlive"in A&&a.push(Z(l,{keepAlive:A.keepAlive,keepAliveMsecs:A.keepAliveMsecs})),f=ee(l,t,j,this.externalAgent).catch(d=>(a.forEach(u.clearTimeout),c(d)))})}updateHttpClientConfig(t,r){this.config=void 0,this.configProvider=this.configProvider.then(o=>({...o,[t]:r}))}httpHandlerConfigs(){return this.config??{}}resolveDefaultConfig(t){let{requestTimeout:r,connectionTimeout:o,socketTimeout:n,socketAcquisitionWarningTimeout:i,httpAgent:s,httpsAgent:c,throwOnRequestTimeout:f,logger:a}=t||{},m=!0,p=50;return{connectionTimeout:o,requestTimeout:r,socketTimeout:n,socketAcquisitionWarningTimeout:i,throwOnRequestTimeout:f,httpAgentProvider:async()=>{let{Agent:g,request:x}=await import("http");return te=x,C=g,s instanceof C||typeof s?.destroy=="function"?(this.externalAgent=!0,s):new C({keepAlive:m,maxSockets:p,...s})},httpsAgent:c instanceof O||typeof c?.destroy=="function"?(this.externalAgent=!0,c):new O({keepAlive:m,maxSockets:p,...c}),logger:a}}};import{Writable as le}from"stream";var R=class extends le{bufferedBytes=[];_write(t,r,o){this.bufferedBytes.push(t),o()}};var bt=e=>ye(e)?Te(e):new Promise((t,r)=>{let o=new R;e.pipe(o),e.on("error",n=>{o.end(),r(n)}),o.on("error",r),o.on("finish",function(){let n=new Uint8Array(Buffer.concat(this.bufferedBytes));t(n)})}),ye=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream;async function Te(e){let t=[],r=e.getReader(),o=!1,n=0;for(;!o;){let{done:c,value:f}=await r.read();f&&(t.push(f),n+=f.length),o=c}let i=new Uint8Array(n),s=0;for(let c of t)i.set(c,s),s+=c.length;return i}var k=e=>{if(e!=null){if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&Ae.warn(Se(`Expected number but observed string: ${e}`)),t}if(typeof e=="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},Ee=Math.ceil(34028234663852886e22),ne=e=>{let t=k(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>Ee)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},we=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}};var oe=e=>ie(e,16),se=e=>ie(e,8),ie=(e,t)=>{let r=we(e);if(r!==void 0&&xe(r,t)!==r)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return r},xe=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}};var ce=e=>k(typeof e=="string"?N(e):e);var fe=e=>ne(typeof e=="string"?N(e):e),be=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,N=e=>{let t=e.match(be);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)};var E=e=>oe(typeof e=="string"?N(e):e),ae=e=>se(typeof e=="string"?N(e):e),Se=e=>String(new TypeError(e).stack||e).split(`
|
|
4
|
+
`).slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join(`
|
|
5
|
+
`),Ae={warn:console.warn};var $e=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function It(e){let t=e.getUTCFullYear(),r=e.getUTCMonth(),o=e.getUTCDay(),n=e.getUTCDate(),i=e.getUTCHours(),s=e.getUTCMinutes(),c=e.getUTCSeconds(),f=n<10?`0${n}`:`${n}`,a=i<10?`0${i}`:`${i}`,m=s<10?`0${s}`:`${s}`,p=c<10?`0${c}`:`${c}`;return`${$e[o]}, ${f} ${F[r]} ${t} ${a}:${m}:${p} GMT`}var Ie=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/),Ct=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Ie.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,i,s,c,f,a]=t,m=E(w(o)),p=h(n,"month",1,12),g=h(i,"day",1,31);return S(m,p,g,{hours:s,minutes:c,seconds:f,fractionalMilliseconds:a})},Ce=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Rt=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");let t=Ce.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");let[r,o,n,i,s,c,f,a,m]=t,p=E(w(o)),g=h(n,"month",1,12),x=h(i,"day",1,31),T=S(p,g,x,{hours:s,minutes:c,seconds:f,fractionalMilliseconds:a});return m.toUpperCase()!="Z"&&T.setTime(T.getTime()-Le(m)),T},Re=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Ne=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),Me=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),Nt=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let t=Re.exec(e);if(t){let[r,o,n,i,s,c,f,a]=t;return S(E(w(i)),U(n),h(o,"day",1,31),{hours:s,minutes:c,seconds:f,fractionalMilliseconds:a})}if(t=Ne.exec(e),t){let[r,o,n,i,s,c,f,a]=t;return ke(S(De(i),U(n),h(o,"day",1,31),{hours:s,minutes:c,seconds:f,fractionalMilliseconds:a}))}if(t=Me.exec(e),t){let[r,o,n,i,s,c,f,a]=t;return S(E(w(a)),U(o),h(n.trimLeft(),"day",1,31),{hours:i,minutes:s,seconds:c,fractionalMilliseconds:f})}throw new TypeError("Invalid RFC-7231 date-time value")},Mt=e=>{if(e==null)return;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=ce(e);else if(typeof e=="object"&&e.tag===1)t=e.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1e3))},S=(e,t,r,o)=>{let n=t-1;return Fe(e,n,r),new Date(Date.UTC(e,n,r,h(o.hours,"hour",0,23),h(o.minutes,"minute",0,59),h(o.seconds,"seconds",0,60),Pe(o.fractionalMilliseconds)))},De=e=>{let t=new Date().getUTCFullYear(),r=Math.floor(t/100)*100+E(w(e));return r<t?r+100:r},Oe=50*365*24*60*60*1e3,ke=e=>e.getTime()-new Date().getTime()>Oe?new Date(Date.UTC(e.getUTCFullYear()-100,e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())):e,U=e=>{let t=F.indexOf(e);if(t<0)throw new TypeError(`Invalid month: ${e}`);return t+1},Ue=[31,28,31,30,31,30,31,31,30,31,30,31],Fe=(e,t,r)=>{let o=Ue[t];if(t===1&&_e(e)&&(o=29),r>o)throw new TypeError(`Invalid day for ${F[t]} in ${e}: ${r}`)},_e=e=>e%4===0&&(e%100!==0||e%400===0),h=(e,t,r,o)=>{let n=ae(w(e));if(n<r||n>o)throw new TypeError(`${t} must be between ${r} and ${o}, inclusive`);return n},Pe=e=>e==null?0:fe("0."+e)*1e3,Le=e=>{let t=e[0],r=1;if(t=="+")r=1;else if(t=="-")r=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);let o=Number(e.substring(1,3)),n=Number(e.substring(4,6));return r*(o*60+n)*60*1e3},w=e=>{let t=0;for(;t<e.length-1&&e.charAt(t)==="0";)t++;return t===0?e:e.slice(t)};var Be=/^[A-Za-z0-9+/]*={0,2}$/,kt=e=>{if(e.length*3%4!==0)throw new TypeError("Incorrect padding on base64 string.");if(!Be.exec(e))throw new TypeError("Invalid base64 string.");let t=W(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)};var Pt=e=>{let t;if(typeof e=="string"?t=J(e):t=e,typeof t!="object"||typeof t.byteOffset!="number"||typeof t.byteLength!="number")throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");return H(t.buffer,t.byteOffset,t.byteLength).toString("base64")};var de={},_={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),de[e]=t,_[t]=e}function Bt(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let o=e.slice(r,r+2).toLowerCase();if(o in _)t[r/2]=_[o];else throw new Error(`Cannot decode unrecognized sequence ${o} as hexadecimal`)}return t}function jt(e){let t="";for(let r=0;r<e.byteLength;r++)t+=de[e[r]];return t}export{$ as a,kt as b,Pt as c,I as d,re as e,bt as f,Bt as g,jt as h,It as i,Ct as j,Rt as k,Nt as l,Mt as m};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as _}from"./chunk-QMKVUKS6.js";import{b as S}from"./chunk-EXLRPVEX.js";var p="AWS_ACCESS_KEY_ID",A="AWS_SECRET_ACCESS_KEY",C="AWS_SESSION_TOKEN",N="AWS_CREDENTIAL_EXPIRATION",a="AWS_CREDENTIAL_SCOPE",i="AWS_ACCOUNT_ID",v=e=>async()=>{e?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");let o=process.env[p],r=process.env[A],n=process.env[C],s=process.env[N],t=process.env[a],E=process.env[i];if(o&&r){let c={accessKeyId:o,secretAccessKey:r,...n&&{sessionToken:n},...s&&{expiration:new Date(s)},...t&&{credentialScope:t},...E&&{accountId:E}};return _(c,"CREDENTIALS_ENV_VARS","g"),c}throw new S("Unable to find environment variable credentials.",{logger:e?.logger})};export{p as a,A as b,C as c,N as d,a as e,i as f,v as g};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as d,c as b,f as p,h as y}from"./chunk-7DCGNQSQ.js";import{b as u,e as m}from"./chunk-QEIMNOY2.js";import{Readable as c}from"stream";var w=async e=>typeof Blob=="function"&&e instanceof Blob||e.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await e.arrayBuffer()):E(e):x(e);async function E(e){let o=await T(e),n=d(o);return new Uint8Array(n)}async function x(e){let o=[],n=e.getReader(),t=!1,r=0;for(;!t;){let{done:f,value:i}=await n.read();i&&(o.push(i),r+=i.length),t=f}let a=new Uint8Array(r),s=0;for(let f of o)a.set(f,s),s+=f.length;return a}function T(e){return new Promise((o,n)=>{let t=new FileReader;t.onloadend=()=>{if(t.readyState!==2)return n(new Error("Reader aborted too early"));let r=t.result??"",a=r.indexOf(","),s=a>-1?a+1:r.length;o(r.substring(s))},t.onabort=()=>n(new Error("Read aborted")),t.onerror=()=>n(t.error),t.readAsDataURL(e)})}var l=e=>typeof ReadableStream=="function"&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream);var h="The stream has already been transformed.",S=e=>{if(!B(e)&&!l(e)){let r=e?.__proto__?.constructor?.name||e;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${r}`)}let o=!1,n=async()=>{if(o)throw new Error(h);return o=!0,await w(e)},t=r=>{if(typeof r.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
|
|
2
|
+
If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return r.stream()};return Object.assign(e,{transformToByteArray:n,transformToString:async r=>{let a=await n();if(r==="base64")return b(a);if(r==="hex")return y(a);if(r===void 0||r==="utf8"||r==="utf-8")return m(a);if(typeof TextDecoder=="function")return new TextDecoder(r).decode(a);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(o)throw new Error(h);if(o=!0,B(e))return t(e);if(l(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},B=e=>typeof Blob=="function"&&e instanceof Blob;var R="The stream has already been transformed.",I=e=>{if(!(e instanceof c))try{return S(e)}catch{let r=e?.__proto__?.constructor?.name||e;throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${r}`)}let o=!1,n=async()=>{if(o)throw new Error(R);return o=!0,await p(e)};return Object.assign(e,{transformToByteArray:n,transformToString:async t=>{let r=await n();return t===void 0||Buffer.isEncoding(t)?u(r.buffer,r.byteOffset,r.byteLength).toString(t):new TextDecoder(t).decode(r)},transformToWebStream:()=>{if(o)throw new Error(R);if(e.readableFlowing!==null)throw new Error("The stream has been consumed by other callbacks.");if(typeof c.toWeb!="function")throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");return o=!0,c.toWeb(e)}})};export{I as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as l,b as u,c as f,d as y,f as n,g as i}from"./chunk-RR5R4AKJ.js";import{a}from"./chunk-SDX64WW4.js";import{randomUUID as v}from"crypto";var h=class{name="local";masterKey;salt;keyVersion;constructor(e){let t=e.masterKey??k();if(!t)throw new Error("Master key required. Set VAULT_LOCAL_MASTER_KEY or VAULT_MASTER_KEY env var, or pass masterKey in config.");this.masterKey=Buffer.from(t,"utf-8"),this.salt=e.salt??Buffer.from("nebutra-vault","utf-8"),this.keyVersion=e.keyVersion??1,a.debug("[vault:local] Initialized",{keyVersion:this.keyVersion})}async deriveKek(){let e=Buffer.from(`nebutra-vault-kek-v${this.keyVersion}`,"utf-8");return f(this.masterKey,this.salt,e)}async encrypt(e,t){try{let r=await this.deriveKek(),d=y(32),o=l(d,r),s=l(e,d),m={id:t?.id??v(),ciphertext:n(s.ciphertext),encryptedDek:n(o.ciphertext),iv:n(s.iv),authTag:n(s.authTag),dekIv:n(o.iv),dekAuthTag:n(o.authTag),keyVersion:this.keyVersion,algorithm:"aes-256-gcm",...t?.tenantId!==void 0?{tenantId:t.tenantId}:{},...t?.metadata!==void 0?{metadata:t.metadata}:{},createdAt:new Date().toISOString()};return a.debug("[vault:local] Secret encrypted",{id:m.id,tenantId:t?.tenantId}),m}catch(r){throw a.error("[vault:local] Encryption failed",{error:r}),new Error(`Local vault encryption failed: ${r instanceof Error?r.message:String(r)}`)}}async decrypt(e,t){try{if(t?.tenantId&&e.tenantId&&e.tenantId!==t.tenantId)throw new Error("Tenant ID mismatch");e.keyVersion!==this.keyVersion&&a.warn("[vault:local] Key version mismatch",{secretVersion:e.keyVersion,currentVersion:this.keyVersion});let r=Buffer.from(`nebutra-vault-kek-v${e.keyVersion}`,"utf-8"),d=await f(this.masterKey,this.salt,r),o;if(e.dekIv&&e.dekAuthTag)o=u(i(e.encryptedDek),d,{iv:i(e.dekIv),authTag:i(e.dekAuthTag)});else throw new Error("Encrypted DEK missing IV/authTag \u2014 cannot decrypt. Re-encrypt with current version.");let s=u(i(e.ciphertext),o,{iv:i(e.iv),authTag:i(e.authTag)});return a.debug("[vault:local] Secret decrypted",{id:e.id,tenantId:t?.tenantId}),s.toString("utf-8")}catch(r){throw a.error("[vault:local] Decryption failed",{error:r}),new Error(`Local vault decryption failed: ${r instanceof Error?r.message:String(r)}`)}}async rotateKey(e){try{let t=await this.decrypt(e),r=await this.encrypt(t,{id:e.id,...e.tenantId!==void 0?{tenantId:e.tenantId}:{},...e.metadata!==void 0?{metadata:{name:e.metadata.name,type:e.metadata.type,...e.metadata.expiresAt!==void 0?{expiresAt:e.metadata.expiresAt}:{}}}:{}});return r.rotatedAt=new Date().toISOString(),a.debug("[vault:local] Key rotated",{id:e.id}),r}catch(t){throw a.error("[vault:local] Key rotation failed",{error:t}),new Error(`Key rotation failed: ${t instanceof Error?t.message:String(t)}`)}}async rotateKek(){this.keyVersion+=1,a.info("[vault:local] KEK rotated",{newVersion:this.keyVersion})}async generateDek(){return y(32)}async close(){a.debug("[vault:local] Closed")}};function k(){let c=process.env.VAULT_MASTER_KEY,e=process.env.VAULT_LOCAL_MASTER_KEY;if(c&&e&&c!==e)throw new Error("Vault local key mismatch: VAULT_MASTER_KEY and VAULT_LOCAL_MASTER_KEY are both set but differ.");return e??c}export{h as a};
|