create-sailor 1.3.3 → 1.3.5
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 +33 -36
- package/dist/aws-kms-ZX6CTY62.js +1 -0
- package/dist/chunk-4NVBWJ2Q.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-A75AMTOI.js +1 -0
- package/dist/chunk-B5RLHF2U.js +40 -0
- package/dist/chunk-DIXI4M5O.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-J7NVVT5I.js +20 -0
- package/dist/chunk-LDOHSEAR.js +9 -0
- package/dist/chunk-NK255JZN.js +1 -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-XSSPJU77.js +1 -0
- package/dist/chunk-YR32FZAX.js +1 -0
- package/dist/credits-6AUSU6X6.js +1787 -0
- package/dist/dist-B4YTE2SQ.js +5 -0
- package/dist/dist-es-4EORLV5B.js +1 -0
- package/dist/dist-es-7IMKW7US.js +1 -0
- package/dist/dist-es-FJUQ4DBK.js +2 -0
- package/dist/dist-es-GP7DK3S3.js +5 -0
- package/dist/dist-es-JXNWCJHW.js +1 -0
- package/dist/dist-es-YKXA2GQ2.js +1 -0
- package/dist/dist-es-ZA2NRM7G.js +2 -0
- package/dist/event-streams-T5RU6C4N.js +1 -0
- package/dist/index.js +164 -157
- package/dist/loadSso-YQ73JVR6.js +1 -0
- package/dist/local-WW37QOXE.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-LD4OP44K.js +1 -0
- package/dist/src-MVDQLN5F.js +1 -0
- package/dist/sso-oidc-4BAF7BYK.js +1 -0
- package/dist/sts-3V5Q4UTA.js +6 -0
- package/package.json +25 -26
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# create-sailor
|
|
2
2
|
|
|
3
|
-
> AI-native SaaS
|
|
3
|
+
> Governed scaffolding for AI-native SaaS. Bootstrap the Nebutra Sailor platform baseline with multi-tenant foundations, region-aware defaults, and production-ready AI integrations.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/create-sailor)
|
|
6
6
|
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
7
|
-
[](https://nebutra.com/licensing)
|
|
8
8
|
|
|
9
9
|
## Quick Start
|
|
10
10
|
|
|
@@ -24,19 +24,11 @@ bunx create-sailor@latest
|
|
|
24
24
|
|
|
25
25
|
## What You Get
|
|
26
26
|
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- **Monitoring**: Sentry / Datadog / 阿里云 ARMS / 听云
|
|
33
|
-
- **Analytics**: PostHog / Plausible / Umami / 百度统计 / 神策 / GrowingIO
|
|
34
|
-
- **SMS**: Twilio / 阿里云短信 / 腾讯云短信 / 云片
|
|
35
|
-
- **Payment**: Stripe / Lemon Squeezy / 微信支付 / 支付宝
|
|
36
|
-
- **Social login (CN)**: 微信开放平台 · QQ · 钉钉 · 企业微信 · 飞书 · 微博
|
|
37
|
-
- **中国合规套件**: ICP 备案 · 公安备案 · Cookie 弹窗 · AIGC 算法备案声明 · 隐私政策模板
|
|
38
|
-
- **White-label**: `brand.config.ts` 一键换品牌(colors · domains · logos · SEO)
|
|
39
|
-
- **AGPL-3.0 + Commercial Exception**(Individual / OPC 免费)
|
|
27
|
+
- **Governed platform baseline** — web app, marketing site, API gateway, docs, Storybook, studio, and supporting infra packages scaffolded as one coherent monorepo
|
|
28
|
+
- **Verified scaffolding path** — region-aware defaults, template checks, and reproducible project bootstrap instead of hand-assembling a starter stack
|
|
29
|
+
- **AI runtime foundation** — provider registry, Vercel AI SDK v5, OpenAI-compatible endpoints, and agent-ready packages wired into the platform baseline
|
|
30
|
+
- **Global + China delivery surface** — email, storage, monitoring, analytics, SMS, payments, and CN social login options selected through one scaffolding flow
|
|
31
|
+
- **Brand, tenant, and compliance primitives** — white-label branding, multi-tenant foundations, and China-market compliance scaffolding already wired in
|
|
40
32
|
|
|
41
33
|
## Usage
|
|
42
34
|
|
|
@@ -46,9 +38,16 @@ bunx create-sailor@latest
|
|
|
46
38
|
npx create-sailor@latest
|
|
47
39
|
```
|
|
48
40
|
|
|
49
|
-
Asks just 4 questions: **project name / region / auth / AI
|
|
41
|
+
Asks just 4 questions: **project name / region / auth / AI topology**. Everything else uses region-aware smart defaults.
|
|
50
42
|
|
|
51
|
-
|
|
43
|
+
The AI prompt is topology-first:
|
|
44
|
+
|
|
45
|
+
- `gateway` — Multi-provider AI Gateway / router, the recommended default. The scaffold seeds a small provider registry for local development, but runtime provider enablement stays a governance/routing concern.
|
|
46
|
+
- `direct` — Direct SDK/provider adapters for teams that intentionally want concrete providers wired at create time.
|
|
47
|
+
- `custom` — OpenAI-compatible endpoint for proxy, local, or enterprise gateway deployments.
|
|
48
|
+
- `none` — Skip AI scaffolding.
|
|
49
|
+
|
|
50
|
+
### Non-interactive (expert mode)
|
|
52
51
|
|
|
53
52
|
```bash
|
|
54
53
|
npm create sailor@latest my-app \
|
|
@@ -62,7 +61,7 @@ npm create sailor@latest my-app \
|
|
|
62
61
|
--analytics=baidu \
|
|
63
62
|
--sms=aliyun-sms \
|
|
64
63
|
--payment=wechat \
|
|
65
|
-
--deploy=
|
|
64
|
+
--deploy=selfhost \
|
|
66
65
|
-y
|
|
67
66
|
```
|
|
68
67
|
|
|
@@ -74,9 +73,9 @@ npm create sailor@latest my-app \
|
|
|
74
73
|
| `--auth` | `clerk` · `betterauth` · `none` | `clerk` |
|
|
75
74
|
| `--social-login` | `wechat,qq,dingtalk,workweixin,feishu,weibo` (comma-sep) | none |
|
|
76
75
|
| `--payment` | `stripe` · `lemon` · `wechat` · `alipay` · `none` | region-based |
|
|
77
|
-
| `--ai` | comma-separated
|
|
76
|
+
| `--ai` | expert/non-interactive provider seed, comma-separated ids; omit it to use the governed gateway topology | gateway seed |
|
|
78
77
|
| `--email` | `resend` · `postmark` · `ses` · `aliyun-dm` · `tencent-ses` · `netease` · `none` | region-based |
|
|
79
|
-
| `--storage` | `r2` · `s3` · `supabase` · `aliyun-oss` · `tencent-cos` · `qiniu` · `none` | region-based |
|
|
78
|
+
| `--storage` | `r2` · `s3` · `supabase-storage` · `aliyun-oss` · `tencent-cos` · `qiniu` · `none` | region-based |
|
|
80
79
|
| `--monitoring` | `sentry` · `datadog` · `aliyun-arms` · `tingyun` · `none` | region-based |
|
|
81
80
|
| `--analytics` | `posthog` · `plausible` · `umami` · `baidu` · `sensors` · `none` | region-based |
|
|
82
81
|
| `--sms` | `twilio` · `aliyun-sms` · `tencent-sms` · `yunpian` · `none` | region-based |
|
|
@@ -94,8 +93,8 @@ npm create sailor@latest my-app \
|
|
|
94
93
|
| Region | Email | Storage | Analytics | Monitoring | SMS | Payment |
|
|
95
94
|
|--------|-------|---------|-----------|------------|-----|---------|
|
|
96
95
|
| `global` | Resend | R2 | PostHog | Sentry | Twilio | Stripe |
|
|
97
|
-
| `cn` |
|
|
98
|
-
| `hybrid` | Resend |
|
|
96
|
+
| `cn` | Alibaba Cloud DirectMail | Alibaba Cloud OSS | Baidu Analytics | Sentry | Alibaba Cloud SMS | WeChat Pay |
|
|
97
|
+
| `hybrid` | Resend | Alibaba Cloud OSS | PostHog | Sentry | Alibaba Cloud SMS | Stripe |
|
|
99
98
|
|
|
100
99
|
## Social login (CN)
|
|
101
100
|
|
|
@@ -103,7 +102,7 @@ Adding `--social-login=wechat,dingtalk` extends your primary auth provider
|
|
|
103
102
|
(Clerk or Better Auth) with China-region OAuth:
|
|
104
103
|
|
|
105
104
|
- Generates `apps/web/src/app/api/auth/callback/<id>/route.ts` stubs with the
|
|
106
|
-
correct token-exchange endpoints (
|
|
105
|
+
correct token-exchange endpoints (WeChat / QQ / DingTalk / WeCom / Feishu / Weibo)
|
|
107
106
|
- Generates `apps/web/src/components/auth/SocialLoginButtons.tsx` with one
|
|
108
107
|
button per selected provider
|
|
109
108
|
- Appends all required env vars to `.env.example`
|
|
@@ -133,19 +132,17 @@ pnpm generate:api-types
|
|
|
133
132
|
|
|
134
133
|
## Why Sailor?
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
for
|
|
138
|
-
|
|
139
|
-
scratch.
|
|
135
|
+
Sailor is not a thin starter with a long feature checklist. It is the governed
|
|
136
|
+
platform baseline Nebutra uses for AI-native SaaS: auth, billing, branding,
|
|
137
|
+
docs, tenant-aware app structure, and AI integration are scaffolded into a
|
|
138
|
+
single monorepo you can extend instead of re-assembling from scratch.
|
|
140
139
|
|
|
141
140
|
## Roadmap
|
|
142
141
|
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
- 🔜 **v1.4** — `nebutra add <feature>` with remote registry
|
|
148
|
-
- 🔜 **v1.5** — Interactive AI Welcome page with onboarding assistant
|
|
142
|
+
- **Verified scaffolding** — immutable template delivery, scaffold smoke validation, and safer bootstrap defaults
|
|
143
|
+
- **Remote feature registry** — `nebutra add` with compatibility checks, provider awareness, and controlled file application
|
|
144
|
+
- **Harness runtime** — stronger MCP, agent, and automation primitives for AI-native SaaS workflows
|
|
145
|
+
- **Upgrade path** — version-aware migrations, diagnostics, and guided adoption of new platform capabilities
|
|
149
146
|
|
|
150
147
|
## Documentation
|
|
151
148
|
|
|
@@ -156,10 +153,10 @@ scratch.
|
|
|
156
153
|
|
|
157
154
|
## License
|
|
158
155
|
|
|
159
|
-
AGPL-3.0 with
|
|
156
|
+
AGPL-3.0 with a commercial license exception.
|
|
160
157
|
See [LICENSE-COMMERCIAL.md](https://github.com/nebutra/nebutra-sailor/blob/main/LICENSE-COMMERCIAL.md) for details.
|
|
161
|
-
|
|
158
|
+
Commercial and individual licensing details: [get-license](https://nebutra.com/get-license).
|
|
162
159
|
|
|
163
160
|
---
|
|
164
161
|
|
|
165
|
-
**
|
|
162
|
+
**Built by [Nebutra](https://nebutra.com)** for teams shipping AI-native products.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk-LDOHSEAR.js";import"./chunk-RR5R4AKJ.js";import"./chunk-SDX64WW4.js";import"./chunk-4NVBWJ2Q.js";import"./chunk-7HOF72FC.js";import"./chunk-YR32FZAX.js";import"./chunk-J7NVVT5I.js";import"./chunk-PXU2OOBT.js";import"./chunk-DIXI4M5O.js";import"./chunk-FGJ5K4WM.js";import"./chunk-7DCGNQSQ.js";import"./chunk-XSSPJU77.js";import"./chunk-QEIMNOY2.js";import"./chunk-QMKVUKS6.js";import"./chunk-EXLRPVEX.js";import"./chunk-FSRPMVAS.js";export{a as AWSKMSProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as u,n as b,t as S}from"./chunk-J7NVVT5I.js";import{a as w}from"./chunk-XSSPJU77.js";var z=class extends S{async serializeRequest(n,i,t){let s=this.serializer,o={},a={},d=await t.endpoint(),e=b.of(n?.input),l=e.getSchema(),f,r=new w({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:o,headers:a,body:void 0});d&&(this.updateServiceEndpoint(r,d),this.setHostPrefix(r,n,i));let c={...i};if(i){let h=e.getEventStreamMember();if(h){if(c[h]){let y={};for(let[m,g]of e.structIterator())m!==h&&c[m]&&(s.write(g,c[m]),y[m]=s.flush());f=await this.serializeEventStream({eventStream:c[h],requestSchema:e,initialRequest:y})}}else s.write(l,c),f=s.flush()}return r.headers=Object.assign(r.headers,a),r.query=o,r.body=f,r.method="POST",r}async deserializeResponse(n,i,t){let s=this.deserializer,o=b.of(n.output),a={};if(t.statusCode>=300){let e=await u(t.body,i);throw e.byteLength>0&&Object.assign(a,await s.read(15,e)),await this.handleError(n,i,t,a,this.deserializeMetadata(t)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let e in t.headers){let l=t.headers[e];delete t.headers[e],t.headers[e.toLowerCase()]=l}let d=o.getEventStreamMember();if(d)a[d]=await this.deserializeEventStream({response:t,responseSchema:o,initialResponseContainer:a});else{let e=await u(t.body,i);e.byteLength>0&&Object.assign(a,await s.read(o,e))}return a.$metadata=this.deserializeMetadata(t),a}};export{z as a};
|
|
@@ -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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as h,q as b,r as w,s as j,u as x}from"./chunk-J7NVVT5I.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};
|