@kyro-cms/core 0.12.48 → 0.12.50
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 +1 -0
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.d.cts +2 -1
- package/dist/api-handler.d.ts +2 -1
- package/dist/api-handler.js +1 -1
- package/dist/auth-session-DHVGXHOH.cjs +1 -0
- package/dist/auth-session-O7IIH7EP.js +1 -0
- package/dist/bcryptjs-ZEEHSMAG.js +2 -0
- package/dist/{better-sqlite3-42Q3FG3E.js → better-sqlite3-B34RIU4C.js} +1 -1
- package/dist/bootstrap-4FK3LPPH.js +1 -0
- package/dist/bootstrap-F4SDJLPK.cjs +1 -0
- package/dist/{bowser-FI5JQGKZ.js → bowser-SB3ZUPO4.js} +1 -1
- package/dist/chokidar-5RVQZVHP.cjs +5 -0
- package/dist/chokidar-BOYGRT4Q.js +6 -0
- package/dist/{chunk-DS5DE5BU.js → chunk-24L3UEJJ.js} +1 -1
- package/dist/{chunk-HT44I66C.js → chunk-2HA6EKXX.js} +1 -1
- package/dist/{chunk-7AQSH3KR.js → chunk-3NSZZCOJ.js} +1 -1
- package/dist/{chunk-VIUU4D5I.js → chunk-47CXBWMA.js} +1 -1
- package/dist/{chunk-6MSS5X77.js → chunk-5M3FKE2V.js} +1 -1
- package/dist/chunk-6TPICJ2L.js +7 -0
- package/dist/{chunk-K7YNEKVE.js → chunk-7FXEXHK6.js} +1 -1
- package/dist/{chunk-WSP7PSXC.js → chunk-7MNDQU6K.js} +1 -1
- package/dist/{chunk-7V67ONUD.js → chunk-7N7U2ERH.js} +1 -1
- package/dist/{chunk-BPMA2ECA.js → chunk-7NH7H3WA.js} +1 -1
- package/dist/{chunk-ZJE3VAAW.js → chunk-BU6O3TP7.js} +3 -3
- package/dist/{chunk-W46LZ4MY.js → chunk-C7QCZX7X.js} +1 -1
- package/dist/chunk-CFZVJTXW.cjs +264 -0
- package/dist/{chunk-2WFTETFB.js → chunk-CIVA6SKW.js} +1 -1
- package/dist/chunk-EFGOYI57.js +265 -0
- package/dist/{chunk-2BUODBE2.js → chunk-EML5FDUU.js} +1 -1
- package/dist/{chunk-66BJXVFJ.js → chunk-FLMUMPDE.js} +1 -1
- package/dist/chunk-H5UFXXWD.js +2 -0
- package/dist/{chunk-M2QRXAWT.js → chunk-HAM4M6VZ.js} +9 -9
- package/dist/{chunk-QYI3GOHF.cjs → chunk-HKNQVI76.cjs} +1 -1
- package/dist/{chunk-IP6JUEH3.js → chunk-HRAY65XH.js} +1 -1
- package/dist/{chunk-KH7LM52S.js → chunk-IKGVPXMK.js} +1 -1
- package/dist/{chunk-XOACKBG7.js → chunk-JRUQ5ABB.js} +2 -2
- package/dist/{chunk-OMWQVPV7.js → chunk-JV4HJBXW.js} +1 -1
- package/dist/{chunk-X54XZACS.cjs → chunk-KZHXYXSH.cjs} +2 -2
- package/dist/{chunk-UD6ZPO7T.js → chunk-L2QXP26Q.js} +1 -1
- package/dist/{chunk-ORG67NXX.js → chunk-L3Q64RUX.js} +1 -1
- package/dist/chunk-LELK3TYX.js +3 -0
- package/dist/{chunk-7I6URA6F.js → chunk-LVBHOZZF.js} +1 -1
- package/dist/{chunk-R3NEPC4I.js → chunk-LWM4WABU.js} +1 -1
- package/dist/{chunk-TR3ZS3T3.js → chunk-M75VGFCI.js} +1 -1
- package/dist/chunk-MCIZG4A3.cjs +1 -0
- package/dist/{chunk-VBPAAQEF.js → chunk-N5POANYV.js} +1 -1
- package/dist/chunk-O4YE57OS.cjs +6 -0
- package/dist/{chunk-A73AVVFR.js → chunk-OBYAIJVU.js} +1 -1
- package/dist/chunk-OLRCZ6E3.js +2 -0
- package/dist/{chunk-WGESLAWV.js → chunk-OXGJOYEO.js} +1 -1
- package/dist/{chunk-CGPAS4U5.js → chunk-P6JITOFF.js} +1 -1
- package/dist/{chunk-JUJZOG6P.js → chunk-PA4ZZREG.js} +1 -1
- package/dist/{chunk-45TJAB5X.js → chunk-PENOCINR.js} +3 -3
- package/dist/{chunk-MZOWPV4D.js → chunk-PRMILS4Y.js} +1 -1
- package/dist/chunk-QDBGBDCT.js +2 -0
- package/dist/{chunk-XBH4YMC7.js → chunk-R25WLKX4.js} +1 -1
- package/dist/{chunk-J6U5LWZ7.js → chunk-RPRGGGIW.js} +3 -3
- package/dist/{chunk-E27KEZPT.js → chunk-RTHJ6SS5.js} +1 -1
- package/dist/{chunk-MCZ3YZ2L.js → chunk-SLMIYECU.js} +1 -1
- package/dist/{chunk-IPXOY4RI.js → chunk-SQBTIMWF.js} +1 -1
- package/dist/{chunk-VJ2WMKPK.js → chunk-SZT6BLUR.js} +1 -1
- package/dist/{chunk-6KRR7YHA.js → chunk-TBHNE4VV.js} +1 -1
- package/dist/{chunk-FAAAHE5O.cjs → chunk-TUIKVRQN.cjs} +8 -8
- package/dist/{chunk-OSAVAYJZ.js → chunk-TYQYKKWJ.js} +1 -1
- package/dist/{chunk-ICVQWR2A.js → chunk-U6KFONKM.js} +1 -1
- package/dist/chunk-UT7RGIYS.js +2 -0
- package/dist/{chunk-PBOZJOKN.js → chunk-UWHWSWDE.js} +1 -1
- package/dist/chunk-VVVCCB6R.js +2 -0
- package/dist/{chunk-MY42EWZP.js → chunk-W45TLOOT.js} +1 -1
- package/dist/chunk-WJBQ2NBD.cjs +1 -0
- package/dist/{chunk-ATBH763U.js → chunk-WPM6LFCY.js} +1 -1
- package/dist/chunk-XBQ6HV3T.cjs +114 -0
- package/dist/{chunk-C2PXMVR5.js → chunk-Y2YAKDEQ.js} +1 -1
- package/dist/chunk-YENNL5HG.js +2 -0
- package/dist/chunk-YP3SCVT3.cjs +1 -0
- package/dist/{chunk-SYEP5QLG.js → chunk-YUUXFD73.js} +1 -1
- package/dist/{chunk-NWCREF47.js → chunk-YZEMLLD2.js} +1 -1
- package/dist/chunk-ZKHTFR5S.cjs +2 -0
- package/dist/{chunk-7T35572E.js → chunk-ZMG7Z3KF.js} +1 -1
- package/dist/{chunk-HLAEJB5R.js → chunk-ZRIBWDYJ.js} +1 -1
- package/dist/chunk-ZWDBPEXL.js +115 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +2 -2
- package/dist/client.js +1 -1
- package/dist/{d1-VPH75GI2.js → d1-HPB6B253.js} +1 -1
- package/dist/{dist-es-6TQTDPE7.js → dist-es-64F22JL2.js} +2 -2
- package/dist/{dist-es-XZBHIIKY.js → dist-es-F2ZR55UK.js} +2 -2
- package/dist/dist-es-IPSSZNFP.js +1 -0
- package/dist/{dist-es-SJ76GYCI.js → dist-es-M2F7M27Y.js} +1 -1
- package/dist/{dist-es-U4ZB3ZDA.js → dist-es-M66JKZF5.js} +1 -1
- package/dist/{dist-es-MNIQZC4U.js → dist-es-OKLLRYI3.js} +2 -2
- package/dist/{dist-es-TX4DBXEW.js → dist-es-SVHZDVUF.js} +2 -2
- package/dist/{dist-es-EMUQ6ZNZ.js → dist-es-WFI55HKT.js} +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +1 -0
- package/dist/drizzle/index.d.ts +1 -0
- package/dist/drizzle/index.js +1 -1
- package/dist/drizzle-orm-XRTSOQJS.js +1 -0
- package/dist/event-streams-7NAWZW2I.js +1 -0
- package/dist/fields/index.js +1 -1
- package/dist/fs-KWBRQ6T6.js +1 -0
- package/dist/fs-ZQYOJOIO.cjs +1 -0
- package/dist/graphql/index.js +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10 -10
- package/dist/integration.js +1 -1
- package/dist/{jsonwebtoken-S7BG2YWK.js → jsonwebtoken-OD67R5JS.js} +3 -3
- package/dist/{lib-IYW32OER.js → lib-XXYYUPMW.js} +3 -3
- package/dist/{loadSso-YTG2GQGW.js → loadSso-UQR6545M.js} +1 -1
- package/dist/local-3V3XEQUY.js +1 -0
- package/dist/media-E762GEHL.js +1 -0
- package/dist/mongo-auth-adapter-QDXVHREJ.js +1 -0
- package/dist/{mongo-auth-adapter-7K64Y2QM.cjs → mongo-auth-adapter-W3HLB7OR.cjs} +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/{nodemailer-AXROO37D.js → nodemailer-NITB45SS.js} +3 -3
- package/dist/postgres-auth-adapter-SK3N3OSS.js +1 -0
- package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +1 -0
- package/dist/postgres-js-3Y54EXVQ.cjs +1 -1
- package/dist/postgres-js-4CI7FMYS.js +1 -0
- package/dist/redis-adapter-QPCTMF55.js +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/schema-YFMSJK2P.js +2 -0
- package/dist/{signin-KZBIAHGS.js → signin-N3T2KF5Q.js} +1 -1
- package/dist/sqlite-adapter-4TPNROJK.js +1 -0
- package/dist/src-QBADSZV4.js +1 -0
- package/dist/{sso-oidc-SX5OIQGG.js → sso-oidc-UB7G4END.js} +1 -1
- package/dist/{sts-HVGDJYIF.js → sts-WAA6I22C.js} +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.js +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/bcryptjs-AZA6WEN2.js +0 -2
- package/dist/bootstrap-7CI3NVSY.js +0 -1
- package/dist/bootstrap-DOOM2CNQ.cjs +0 -1
- package/dist/chokidar-24HVS6XD.cjs +0 -5
- package/dist/chokidar-43DT7CVN.js +0 -6
- package/dist/chunk-5DWYVUQR.cjs +0 -1
- package/dist/chunk-6QWLXJ7L.js +0 -2
- package/dist/chunk-B3GDQ7UI.cjs +0 -114
- package/dist/chunk-BLH2MRK4.js +0 -2
- package/dist/chunk-EOOZDOL7.js +0 -3
- package/dist/chunk-IIOVJTCD.cjs +0 -1
- package/dist/chunk-L4ZAI2XB.cjs +0 -269
- package/dist/chunk-PL5AIE6F.js +0 -2
- package/dist/chunk-QDHP5E4P.cjs +0 -2
- package/dist/chunk-R2CLQMNJ.js +0 -270
- package/dist/chunk-R4LXRAMX.js +0 -2
- package/dist/chunk-SVYUTQVE.js +0 -115
- package/dist/chunk-UB5TJHQR.js +0 -2
- package/dist/chunk-XPPVX4GQ.cjs +0 -1
- package/dist/chunk-XRINX47D.js +0 -2
- package/dist/dist-es-6SVFVYN3.js +0 -1
- package/dist/drizzle-orm-7YTX5NTT.js +0 -1
- package/dist/event-streams-25YJ2Z6R.js +0 -1
- package/dist/fs-DGKZLRM6.cjs +0 -1
- package/dist/fs-YZJ5FM6J.js +0 -2
- package/dist/local-VDCSEMC2.js +0 -1
- package/dist/media-HK2IZMUZ.js +0 -1
- package/dist/mongo-auth-adapter-BUKINEZL.js +0 -1
- package/dist/postgres-auth-adapter-2M4RNEY3.cjs +0 -1
- package/dist/postgres-auth-adapter-MKSHIJDL.js +0 -1
- package/dist/postgres-js-INQPBHJP.js +0 -1
- package/dist/redis-adapter-SXOXLHNH.js +0 -1
- package/dist/schema-XC5ISGNR.js +0 -2
- package/dist/sqlite-adapter-DV7ZX2EJ.js +0 -1
- package/dist/src-GZRZ4VAO.js +0 -1
- /package/dist/{chunk-P7XYIKL6.cjs → chunk-YUER4JU3.cjs} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {a as a$1,d,j,k,e as e$1,h,i}from'./chunk-47CXBWMA.js';import {n,M,p,s}from'./chunk-HRAY65XH.js';import {J}from'./chunk-3NSZZCOJ.js';import {a}from'./chunk-7NH7H3WA.js';import {g,e}from'./chunk-Y2YAKDEQ.js';import {randomBytes}from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g();var R=e(a(),1);var S=false,_=class{db;prefix;sessionTTL;refreshTokenTTL;constructor(e){this.db=e.db,this.prefix=e.prefix||"kyro:",this.sessionTTL=e.sessionTTL||86400,this.refreshTokenTTL=e.refreshTokenTTL||604800;}async connect(){S||(await this.db.execute(J`
|
|
3
|
+
CREATE TABLE IF NOT EXISTS "users" (
|
|
4
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
5
|
+
"name" VARCHAR(255),
|
|
6
|
+
"email" VARCHAR(255) NOT NULL,
|
|
7
|
+
"password_hash" VARCHAR(255),
|
|
8
|
+
"role" VARCHAR(50) NOT NULL DEFAULT 'customer',
|
|
9
|
+
"tenant_id" UUID,
|
|
10
|
+
"email_verified" BOOLEAN DEFAULT false,
|
|
11
|
+
"locked" BOOLEAN DEFAULT false,
|
|
12
|
+
"last_login" TIMESTAMP,
|
|
13
|
+
"failed_login_attempts" INTEGER DEFAULT 0,
|
|
14
|
+
"metadata" JSONB,
|
|
15
|
+
"avatar" VARCHAR(255),
|
|
16
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
17
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
18
|
+
)
|
|
19
|
+
`),await this.db.execute(J`ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "avatar" VARCHAR(255)`),await this.db.execute(J`CREATE UNIQUE INDEX IF NOT EXISTS "users_email_idx" ON "users" ("email")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "users_tenant_idx" ON "users" ("tenant_id")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "users_role_idx" ON "users" ("role")`),await this.db.execute(J`
|
|
20
|
+
CREATE TABLE IF NOT EXISTS "sessions" (
|
|
21
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
22
|
+
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
23
|
+
"token" VARCHAR(512) NOT NULL UNIQUE,
|
|
24
|
+
"refresh_token" VARCHAR(512),
|
|
25
|
+
"ip_address" VARCHAR(45),
|
|
26
|
+
"user_agent" TEXT,
|
|
27
|
+
"expires_at" TIMESTAMP NOT NULL,
|
|
28
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
29
|
+
)
|
|
30
|
+
`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "sessions_user_idx" ON "sessions" ("user_id")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "sessions_token_idx" ON "sessions" ("token")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "sessions_expires_idx" ON "sessions" ("expires_at")`),await this.db.execute(J`
|
|
31
|
+
CREATE TABLE IF NOT EXISTS "audit_logs" (
|
|
32
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
33
|
+
"action" VARCHAR(100) NOT NULL,
|
|
34
|
+
"user_id" UUID REFERENCES "users"("id") ON DELETE SET NULL,
|
|
35
|
+
"user_email" VARCHAR(255),
|
|
36
|
+
"role" VARCHAR(50),
|
|
37
|
+
"resource" VARCHAR(100) NOT NULL,
|
|
38
|
+
"resource_id" VARCHAR(255),
|
|
39
|
+
"changes" JSONB,
|
|
40
|
+
"ip_address" VARCHAR(45),
|
|
41
|
+
"user_agent" TEXT,
|
|
42
|
+
"success" BOOLEAN NOT NULL DEFAULT true,
|
|
43
|
+
"error" TEXT,
|
|
44
|
+
"metadata" JSONB,
|
|
45
|
+
"timestamp" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
46
|
+
)
|
|
47
|
+
`),await this.db.execute(J`ALTER TABLE "audit_logs" ALTER COLUMN "resource_id" TYPE VARCHAR(255)`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "audit_logs_user_idx" ON "audit_logs" ("user_id")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "audit_logs_action_idx" ON "audit_logs" ("action")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "audit_logs_resource_idx" ON "audit_logs" ("resource")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "audit_logs_timestamp_idx" ON "audit_logs" ("timestamp")`),await this.db.execute(J`
|
|
48
|
+
CREATE TABLE IF NOT EXISTS "password_history" (
|
|
49
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
50
|
+
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
51
|
+
"password_hash" VARCHAR(255) NOT NULL,
|
|
52
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
53
|
+
)
|
|
54
|
+
`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "password_history_user_idx" ON "password_history" ("user_id")`),await this.db.execute(J`
|
|
55
|
+
CREATE TABLE IF NOT EXISTS "lockouts" (
|
|
56
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
57
|
+
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
58
|
+
"ip_address" VARCHAR(45),
|
|
59
|
+
"reason" VARCHAR(255),
|
|
60
|
+
"locked_until" TIMESTAMP NOT NULL,
|
|
61
|
+
"released_at" TIMESTAMP,
|
|
62
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
63
|
+
)
|
|
64
|
+
`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "lockouts_user_idx" ON "lockouts" ("user_id")`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "lockouts_locked_until_idx" ON "lockouts" ("locked_until")`),await this.db.execute(J`
|
|
65
|
+
CREATE TABLE IF NOT EXISTS "roles" (
|
|
66
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
67
|
+
"name" VARCHAR(100) NOT NULL UNIQUE,
|
|
68
|
+
"level" INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
"inherits" TEXT[],
|
|
70
|
+
"description" TEXT,
|
|
71
|
+
"permissions" JSONB DEFAULT '[]',
|
|
72
|
+
"is_system" BOOLEAN DEFAULT false,
|
|
73
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
74
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
75
|
+
)
|
|
76
|
+
`),await this.db.execute(J`CREATE INDEX IF NOT EXISTS "roles_level_idx" ON "roles" ("level")`),await this.db.execute(J`
|
|
77
|
+
CREATE TABLE IF NOT EXISTS "tenants" (
|
|
78
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
79
|
+
"name" VARCHAR(255) NOT NULL,
|
|
80
|
+
"slug" VARCHAR(100) NOT NULL UNIQUE,
|
|
81
|
+
"settings" JSONB DEFAULT '{}',
|
|
82
|
+
"is_active" BOOLEAN DEFAULT true,
|
|
83
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
84
|
+
"updated_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
85
|
+
)
|
|
86
|
+
`),await this.db.execute(J`
|
|
87
|
+
CREATE TABLE IF NOT EXISTS "api_keys" (
|
|
88
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
89
|
+
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
90
|
+
"name" VARCHAR(255) NOT NULL,
|
|
91
|
+
"key" VARCHAR(64) NOT NULL UNIQUE,
|
|
92
|
+
"key_prefix" VARCHAR(8) NOT NULL,
|
|
93
|
+
"permissions" JSONB DEFAULT '[]',
|
|
94
|
+
"last_used_at" TIMESTAMP,
|
|
95
|
+
"expires_at" TIMESTAMP,
|
|
96
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
97
|
+
)
|
|
98
|
+
`),await this.db.execute(J`
|
|
99
|
+
CREATE TABLE IF NOT EXISTS "email_verifications" (
|
|
100
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
101
|
+
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
102
|
+
"token" VARCHAR(64) NOT NULL UNIQUE,
|
|
103
|
+
"expires_at" TIMESTAMP NOT NULL,
|
|
104
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
105
|
+
)
|
|
106
|
+
`),await this.db.execute(J`
|
|
107
|
+
CREATE TABLE IF NOT EXISTS "password_resets" (
|
|
108
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
109
|
+
"user_id" UUID NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
|
|
110
|
+
"token" VARCHAR(64) NOT NULL UNIQUE,
|
|
111
|
+
"expires_at" TIMESTAMP NOT NULL,
|
|
112
|
+
"used_at" TIMESTAMP,
|
|
113
|
+
"created_at" TIMESTAMP NOT NULL DEFAULT NOW()
|
|
114
|
+
)
|
|
115
|
+
`),S=true);}async disconnect(){}async createUser(e){let s=await this.hashPassword(e.password),[t]=await this.db.insert(a$1).values({email:e.email.toLowerCase(),name:e.name,passwordHash:s,role:e.role||"customer",avatar:e.avatar,tenantId:e.tenantId,emailVerified:e.emailVerified??true}).returning();return this.userToAuthUser(t)}async findUserByEmail(e){let[s]=await this.db.select().from(a$1).where(n(a$1.email,e.toLowerCase())).limit(1);return s?this.userToAuthUser(s):null}async findUserById(e){let[s]=await this.db.select().from(a$1).where(n(a$1.id,e)).limit(1);return s?this.userToAuthUser(s):null}async updateUser(e,s){let t={updatedAt:new Date};s.name!==void 0&&(t.name=s.name),s.email!==void 0&&(t.email=s.email),s.passwordHash!==void 0&&(t.passwordHash=s.passwordHash),s.role!==void 0&&(t.role=s.role),s.tenantId!==void 0&&(t.tenantId=s.tenantId),s.avatar!==void 0&&(t.avatar=s.avatar),s.emailVerified!==void 0&&(t.emailVerified=s.emailVerified),s.locked!==void 0&&(t.locked=s.locked),s.lastLogin!==void 0&&(t.lastLogin=s.lastLogin?new Date(s.lastLogin):null),s.failedLoginAttempts!==void 0&&(t.failedLoginAttempts=s.failedLoginAttempts);let[r]=await this.db.update(a$1).set(t).where(n(a$1.id,e)).returning();return r?this.userToAuthUser(r):null}async deleteUser(e){return await this.db.delete(a$1).where(n(a$1.id,e)),true}async findUsers(e={}){let s=e.page??1,t=e.limit??10,r=(s-1)*t,u=e.search;if(u){let m=`%${u}%`,[w,[{count:p}]]=await Promise.all([this.db.select().from(a$1).where(J`${a$1.email} ILIKE ${m}`).orderBy(M(a$1.createdAt)).limit(t).offset(r),this.db.select({count:J`count(*)`}).from(a$1).where(J`${a$1.email} ILIKE ${m}`)]);return {users:w.map(T=>this.userToAuthUser(T)),total:Number(p)}}let[c,[{count:E}]]=await Promise.all([this.db.select().from(a$1).orderBy(M(a$1.createdAt)).limit(t).offset(r),this.db.select({count:J`count(*)`}).from(a$1)]);return {users:c.map(m=>this.userToAuthUser(m)),total:Number(E)}}async verifyPassword(e,s){let t=await this.findUserByEmail(e);if(!t)return null;let[r]=await this.db.select().from(a$1).where(n(a$1.email,e.toLowerCase())).limit(1);return r?.passwordHash&&await R.default.compare(s,r.passwordHash)?t:null}async hashPassword(e){return R.default.hash(e,12)}async createSession(e,s){let t=randomBytes(32).toString("base64url"),r=randomBytes(32).toString("base64url"),u=new Date(Date.now()+this.sessionTTL*1e3);new Date(Date.now()+this.refreshTokenTTL*1e3);let [E]=await this.db.insert(d).values({userId:e,token:t,refreshToken:r,ipAddress:s?.ipAddress,userAgent:s?.userAgent,expiresAt:u}).returning();return this.sessionToSession(E)}async findSessionByToken(e){let[s$1]=await this.db.select().from(d).where(p(n(d.token,e),s(d.expiresAt,new Date))).limit(1);return s$1?this.sessionToSession(s$1):null}async findSessionByRefreshToken(e){let[s$1]=await this.db.select().from(d).where(p(n(d.refreshToken,e),s(d.expiresAt,new Date))).limit(1);return s$1?this.sessionToSession(s$1):null}async deleteSession(e){return await this.db.delete(d).where(n(d.id,e)),true}async deleteUserSessions(e){return await this.db.delete(d).where(n(d.userId,e)),1}async addPasswordToHistory(e,s){await this.db.insert(j).values({userId:e,passwordHash:s});}async getPasswordHistory(e,s=5){return (await this.db.select({passwordHash:j.passwordHash}).from(j).where(n(j.userId,e)).orderBy(M(j.createdAt)).limit(s)).map(r=>r.passwordHash)}async isPasswordInHistory(e,s,t=5){let r=await this.getPasswordHistory(s,t);for(let u of r)if(await this.verifyPassword(e,u))return true;return false}async isLocked(e){let[s$1]=await this.db.select().from(k).where(p(n(k.userId,e),s(k.lockedUntil,new Date))).limit(1);return !!s$1}async getLockout(e){let[s$1]=await this.db.select().from(k).where(p(n(k.userId,e),s(k.lockedUntil,new Date))).limit(1);return s$1?{lockedUntil:s$1.lockedUntil}:null}async recordFailedAttempt(e,s){let r=((await this.findUserById(e))?.failedLoginAttempts||0)+1;await this.updateUser(e,{failedLoginAttempts:r});let c=r>=5;return c&&await this.db.insert(k).values({userId:e,ipAddress:s,reason:"Too many failed login attempts",lockedUntil:new Date(Date.now()+9e5)}),{attempts:r,locked:c}}async resetAttempts(e){await this.updateUser(e,{failedLoginAttempts:0});}async findAuditLogs(e){let{limit:s=50,offset:t=0,userId:r,action:u,resource:c,resourceId:E,success:m,startDate:w,endDate:p$1}=e,T=[];r&&T.push(n(e$1.userId,r)),u&&(Array.isArray(u)?T.push(J`${e$1.action} = ANY(${u})`):T.push(n(e$1.action,u))),c&&T.push(n(e$1.resource,c)),E&&T.push(n(e$1.resourceId,E)),m!==void 0&&T.push(n(e$1.success,m)),w&&T.push(J`${e$1.timestamp} >= ${w}`),p$1&&T.push(J`${e$1.timestamp} <= ${p$1}`);let O=T.length>0?p(...T):void 0,b=await this.db.select({count:J`count(*)`}).from(e$1).where(O);return {logs:(await this.db.select().from(e$1).where(O).orderBy(M(e$1.timestamp)).limit(s).offset(t)).map(o=>({id:o.id,timestamp:o.timestamp,action:o.action,userId:o.userId||void 0,userEmail:o.userEmail||void 0,role:o.role||void 0,resource:o.resource,resourceId:o.resourceId||void 0,changes:o.changes||void 0,ipAddress:o.ipAddress||void 0,userAgent:o.userAgent||void 0,success:o.success,error:o.error||void 0,metadata:o.metadata||void 0})),total:Number(b[0]?.count||0)}}async createAuditLog(e){let s=crypto.randomUUID(),t=new Date;return await this.db.insert(e$1).values({id:s,action:e.action,userId:e.userId??null,userEmail:e.userEmail??null,role:e.role??null,resource:e.resource,resourceId:e.resourceId??null,changes:e.changes??null,ipAddress:e.ipAddress??null,userAgent:e.userAgent??null,success:e.success,error:e.error??null,metadata:e.metadata??null,timestamp:t}),{...e,id:s,timestamp:t}}userToAuthUser(e){return {id:e.id,name:e.name||void 0,email:e.email,passwordHash:e.passwordHash||void 0,role:e.role,avatar:e.avatar&&typeof e.avatar=="object"?e.avatar.id||void 0:e.avatar||void 0,tenantId:e.tenantId||void 0,emailVerified:e.emailVerified||false,locked:e.locked||false,lastLogin:e.lastLogin?new Date(e.lastLogin).toISOString():void 0,failedLoginAttempts:e.failedLoginAttempts||0,createdAt:new Date(e.createdAt).toISOString(),updatedAt:new Date(e.updatedAt).toISOString()}}sessionToSession(e){return {id:e.id,userId:e.userId,token:e.token,refreshToken:e.refreshToken||void 0,expiresAt:new Date(e.expiresAt).toISOString(),createdAt:new Date(e.createdAt).toISOString(),ipAddress:e.ipAddress||void 0,userAgent:e.userAgent||void 0}}async createEmailVerificationToken(e){let s=randomBytes(32).toString("hex"),t=new Date(Date.now()+1440*60*1e3);return await this.db.insert(h).values({userId:e,token:s,expiresAt:t}),{token:s,expiresAt:t}}async verifyEmailToken(e){let[s]=await this.db.select().from(h).where(n(h.token,e)).limit(1);return s?s.expiresAt<new Date?{success:false,error:"Verification token has expired"}:(await this.db.update(a$1).set({emailVerified:true}).where(n(a$1.id,s.userId)),await this.db.delete(h).where(n(h.id,s.id)),{success:true,userId:s.userId}):{success:false,error:"Invalid verification token"}}async createPasswordResetToken(e){let s=await this.findUserByEmail(e);if(!s)return {token:"",expiresAt:new Date,error:"User not found"};let t=randomBytes(32).toString("hex"),r=new Date(Date.now()+3600*1e3);return await this.db.insert(i).values({userId:s.id,token:t,expiresAt:r}),{token:t,expiresAt:r}}async resetPasswordWithToken(e,s){let[t]=await this.db.select().from(i).where(n(i.token,e)).limit(1);if(!t)return {success:false,error:"Invalid reset token"};if(t.expiresAt<new Date)return {success:false,error:"Reset token has expired"};if(t.usedAt)return {success:false,error:"Reset token has already been used"};let r=await this.hashPassword(s);return await this.db.update(a$1).set({passwordHash:r,updatedAt:new Date}).where(n(a$1.id,t.userId)),await this.db.update(i).set({usedAt:new Date}).where(n(i.id,t.id)),await this.db.delete(d).where(n(d.userId,t.userId)),{success:true}}};export{_ as a};
|
package/dist/cli/index.cjs
CHANGED
|
@@ -390,4 +390,4 @@ bucket_name = "${u}"
|
|
|
390
390
|
`);}catch(x){let _=x?.stdout?.toString?.()||"",L=x?.stderr?.toString?.()||"";ee.fail("Deployment failed"),_&&process.stdout.write(_),L&&process.stdout.write(L),console.log(`
|
|
391
391
|
${C.red.bold("\u2716 Deployment Failed!")}`),console.log(` ${C.dim("See the Wrangler error above.")}
|
|
392
392
|
`),f&&process.stdout.write(JSON.stringify({ok:false,error:"Deployment failed"})+`
|
|
393
|
-
`),process.exit(1);}}),i}var ng=url.fileURLToPath(chunkBUNLC3II_cjs.g),og=Gt.dirname(ng),Gl="0.1.0";try{Gl=JSON.parse(et.readFileSync(Gt.join(og,"../../package.json"),"utf-8")).version;}catch{}var jt=new ie;jt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(Gl);jt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});jt.addCommand(Bo());jt.addCommand(Vl());var ts=jt.command("db").description("Database management commands");ts.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});ts.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});ts.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});ts.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});ts.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ug=jt.command("auth").description("Authentication management commands");ug.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-
|
|
393
|
+
`),process.exit(1);}}),i}var ng=url.fileURLToPath(chunkBUNLC3II_cjs.g),og=Gt.dirname(ng),Gl="0.1.0";try{Gl=JSON.parse(et.readFileSync(Gt.join(og,"../../package.json"),"utf-8")).version;}catch{}var jt=new ie;jt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(Gl);jt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});jt.addCommand(Bo());jt.addCommand(Vl());var ts=jt.command("db").description("Database management commands");ts.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});ts.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});ts.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});ts.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});ts.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ug=jt.command("auth").description("Authentication management commands");ug.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-F4SDJLPK.cjs'),e=process.env.DATABASE_URL||"",s=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),r=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),n=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:"),o;if(s){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-ZO6HK5AK.cjs'),{drizzle:h}=await import('../postgres-js-3Y54EXVQ.cjs'),{default:d}=await import('../src-6LAUXXDM.cjs'),c=d(e,{max:1,onnotice:()=>{}}),f=h(c);o=new a({db:f});}else if(r){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-W3HLB7OR.cjs'),h=await import('../lib-5QYYN6ML.cjs'),d=h.MongoClient??h.default?.MongoClient,c=new d(e);await c.connect();let f=c.db();o=new a({db:f});}else {let{SQLiteAuthAdapter:a}=await import('../sqlite-adapter-ZTABLT2X.cjs'),h=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";o=new a({path:h});}o.connect&&await o.connect();let u=await t({authAdapter:o,adminEmail:i.email,adminPassword:i.password,adminRole:i.role});o.disconnect&&await o.disconnect(),u.success||(console.error("\u274C Failed to create admin:",u.error),process.exit(1));}catch(t){console.error("\u274C Bootstrap failed:",t),process.exit(1);}});jt.command("health").description("Check system health").action(async()=>{let i=process.env.DATABASE_URL||"",t=i.toLowerCase().startsWith("postgres://")||i.toLowerCase().startsWith("postgresql://"),e=i.toLowerCase().startsWith("mongodb://")||i.toLowerCase().startsWith("mongodb+srv://"),s=!i||i.includes(".db")||i.includes("sqlite")||i.includes("file:");if(t)try{let{default:r}=await import('../src-6LAUXXDM.cjs'),n=r(i,{max:1,onnotice:()=>{}});await n.unsafe("SELECT 1"),await n.end();}catch{}else if(e)try{let r=await import('../lib-5QYYN6ML.cjs'),n=r.MongoClient??r.default?.MongoClient,o=new n(i);await o.connect(),await o.db().admin().ping(),await o.close();}catch{}else if(s)try{let r=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db",{existsSync:n}=await import('fs');n(r);}catch{}});jt.parse();process.argv.slice(2).length||jt.outputHelp();
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import {c,g,a,e}from'../chunk-Y2YAKDEQ.js';import*as st from'fs';import st__default,{realpathSync,readFileSync,existsSync,mkdirSync,writeFileSync,readlinkSync,readdirSync,readdir as readdir$1,lstatSync}from'fs';import zt,{dirname,join,win32,posix,resolve}from'path';import {fileURLToPath}from'url';import {channel,tracingChannel}from'diagnostics_channel';import {realpath,readlink,readdir,lstat}from'fs/promises';import {EventEmitter}from'events';import ho from'stream';import {StringDecoder}from'string_decoder';import {execSync}from'child_process';import Vl from'crypto';import mt from'process';import mD from'os';import dl from'tty';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
3
3
|
var be=c(si=>{g();var ns=class extends Error{constructor(t,e,s){super(s),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=e,this.exitCode=t,this.nestedError=void 0;}},ei=class extends ns{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};si.CommanderError=ns;si.InvalidArgumentError=ei;});var os=c(ri=>{g();var{InvalidArgumentError:Jl}=be(),ii=class{constructor(t,e){switch(this.description=e||"",this.variadic=false,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case "<":this.required=true,this._name=t.slice(1,-1);break;case "[":this.required=false,this._name=t.slice(1,-1);break;default:this.required=true,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=true,this._name=this._name.slice(0,-3));}name(){return this._name}_concatValue(t,e){return e===this.defaultValue||!Array.isArray(e)?[t]:e.concat(t)}default(t,e){return this.defaultValue=t,this.defaultValueDescription=e,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(e,s)=>{if(!this.argChoices.includes(e))throw new Jl(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,s):e},this}argRequired(){return this.required=true,this}argOptional(){return this.required=false,this}};function Zl(i){let t=i.name()+(i.variadic===true?"...":"");return i.required?"<"+t+">":"["+t+"]"}ri.Argument=ii;ri.humanReadableArgName=Zl;});var ui=c(oi=>{g();var{humanReadableArgName:Ql}=os(),ni=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=false,this.sortOptions=false,this.showGlobalOptions=false;}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80;}visibleCommands(t){let e=t.commands.filter(r=>!r._hidden),s=t._getHelpCommand();return s&&!s._hidden&&e.push(s),this.sortSubcommands&&e.sort((r,n)=>r.name().localeCompare(n.name())),e}compareOptions(t,e){let s=r=>r.short?r.short.replace(/^-/,""):r.long.replace(/^--/,"");return s(t).localeCompare(s(e))}visibleOptions(t){let e=t.options.filter(r=>!r.hidden),s=t._getHelpOption();if(s&&!s.hidden){let r=s.short&&t._findOption(s.short),n=s.long&&t._findOption(s.long);!r&&!n?e.push(s):s.long&&!n?e.push(t.createOption(s.long,s.description)):s.short&&!r&&e.push(t.createOption(s.short,s.description));}return this.sortOptions&&e.sort(this.compareOptions),e}visibleGlobalOptions(t){if(!this.showGlobalOptions)return [];let e=[];for(let s=t.parent;s;s=s.parent){let r=s.options.filter(n=>!n.hidden);e.push(...r);}return this.sortOptions&&e.sort(this.compareOptions),e}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(e=>{e.description=e.description||t._argsDescription[e.name()]||"";}),t.registeredArguments.find(e=>e.description)?t.registeredArguments:[]}subcommandTerm(t){let e=t.registeredArguments.map(s=>Ql(s)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(e?" "+e:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,e){return e.visibleCommands(t).reduce((s,r)=>Math.max(s,this.displayWidth(e.styleSubcommandTerm(e.subcommandTerm(r)))),0)}longestOptionTermLength(t,e){return e.visibleOptions(t).reduce((s,r)=>Math.max(s,this.displayWidth(e.styleOptionTerm(e.optionTerm(r)))),0)}longestGlobalOptionTermLength(t,e){return e.visibleGlobalOptions(t).reduce((s,r)=>Math.max(s,this.displayWidth(e.styleOptionTerm(e.optionTerm(r)))),0)}longestArgumentTermLength(t,e){return e.visibleArguments(t).reduce((s,r)=>Math.max(s,this.displayWidth(e.styleArgumentTerm(e.argumentTerm(r)))),0)}commandUsage(t){let e=t._name;t._aliases[0]&&(e=e+"|"+t._aliases[0]);let s="";for(let r=t.parent;r;r=r.parent)s=r.name()+" "+s;return s+e+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let e=[];return t.argChoices&&e.push(`choices: ${t.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&e.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&e.push(`env: ${t.envVar}`),e.length>0?`${t.description} (${e.join(", ")})`:t.description}argumentDescription(t){let e=[];if(t.argChoices&&e.push(`choices: ${t.argChoices.map(s=>JSON.stringify(s)).join(", ")}`),t.defaultValue!==void 0&&e.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),e.length>0){let s=`(${e.join(", ")})`;return t.description?`${t.description} ${s}`:s}return t.description}formatHelp(t,e){let s=e.padWidth(t,e),r=e.helpWidth??80;function n(c,f){return e.formatItem(c,s,f,e)}let o=[`${e.styleTitle("Usage:")} ${e.styleUsage(e.commandUsage(t))}`,""],u=e.commandDescription(t);u.length>0&&(o=o.concat([e.boxWrap(e.styleCommandDescription(u),r),""]));let a=e.visibleArguments(t).map(c=>n(e.styleArgumentTerm(e.argumentTerm(c)),e.styleArgumentDescription(e.argumentDescription(c))));a.length>0&&(o=o.concat([e.styleTitle("Arguments:"),...a,""]));let h=e.visibleOptions(t).map(c=>n(e.styleOptionTerm(e.optionTerm(c)),e.styleOptionDescription(e.optionDescription(c))));if(h.length>0&&(o=o.concat([e.styleTitle("Options:"),...h,""])),e.showGlobalOptions){let c=e.visibleGlobalOptions(t).map(f=>n(e.styleOptionTerm(e.optionTerm(f)),e.styleOptionDescription(e.optionDescription(f))));c.length>0&&(o=o.concat([e.styleTitle("Global Options:"),...c,""]));}let d=e.visibleCommands(t).map(c=>n(e.styleSubcommandTerm(e.subcommandTerm(c)),e.styleSubcommandDescription(e.subcommandDescription(c))));return d.length>0&&(o=o.concat([e.styleTitle("Commands:"),...d,""])),o.join(`
|
|
4
4
|
`)}displayWidth(t){return En(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e==="[command]"?this.styleSubcommandText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(e=>e==="[options]"?this.styleOptionText(e):e[0]==="["||e[0]==="<"?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,e){return Math.max(e.longestOptionTermLength(t,e),e.longestGlobalOptionTermLength(t,e),e.longestSubcommandTermLength(t,e),e.longestArgumentTermLength(t,e))}preformatted(t){return /\n[^\S\r\n]/.test(t)}formatItem(t,e,s,r){let o=" ".repeat(2);if(!s)return o+t;let u=t.padEnd(e+t.length-r.displayWidth(t)),a=2,d=(this.helpWidth??80)-e-a-2,c;return d<this.minWidthToWrap||r.preformatted(s)?c=s:c=r.boxWrap(s,d).replace(/\n/g,`
|
|
5
5
|
`+" ".repeat(e+a)),o+u+" ".repeat(a)+c.replace(/\n/g,`
|
|
@@ -391,4 +391,4 @@ bucket_name = "${u}"
|
|
|
391
391
|
`);}catch(v){let S=v?.stdout?.toString?.()||"",W=v?.stderr?.toString?.()||"";se.fail("Deployment failed"),S&&process.stdout.write(S),W&&process.stdout.write(W),console.log(`
|
|
392
392
|
${E.red.bold("\u2716 Deployment Failed!")}`),console.log(` ${E.dim("See the Wrangler error above.")}
|
|
393
393
|
`),f&&process.stdout.write(JSON.stringify({ok:false,error:"Deployment failed"})+`
|
|
394
|
-
`),process.exit(1);}}),i}var og=fileURLToPath(import.meta.url),ug=dirname(og),zl="0.1.0";try{zl=JSON.parse(readFileSync(join(ug,"../../package.json"),"utf-8")).version;}catch{}var Nt=new re;Nt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(zl);Nt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});Nt.addCommand(Mo());Nt.addCommand(Gl());var es=Nt.command("db").description("Database management commands");es.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});es.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});es.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});es.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});es.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ag=Nt.command("auth").description("Authentication management commands");ag.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-
|
|
394
|
+
`),process.exit(1);}}),i}var og=fileURLToPath(import.meta.url),ug=dirname(og),zl="0.1.0";try{zl=JSON.parse(readFileSync(join(ug,"../../package.json"),"utf-8")).version;}catch{}var Nt=new re;Nt.name("kyro").description("Kyro CMS - Astro-native headless CMS").version(zl);Nt.command("dev").description("Start Kyro CMS development server").option("-p, --port <port>","Port to run on","4321").option("-h, --host <host>","Host to bind to","localhost").action(async i=>{let{exec:t}=await import('child_process'),e=t(`astro dev --port ${i.port} --host ${i.host}`,{env:{...process.env,NODE_NO_WARNINGS:"1"}});e.stdout?.on("data",s=>process.stdout.write(s)),e.stderr?.on("data",s=>process.stderr.write(s)),process.on("SIGINT",()=>{e.kill("SIGINT"),process.exit(0);}),process.on("SIGTERM",()=>{e.kill("SIGTERM"),process.exit(0);});});Nt.addCommand(Mo());Nt.addCommand(Gl());var es=Nt.command("db").description("Database management commands");es.command("generate").description("Generate migrations from schema").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit generate",(t,e,s)=>{t&&(console.error("\u274C Generation failed:",t.message),process.exit(1));});});es.command("migrate").description("Run database migrations").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit migrate",(t,e,s)=>{t&&(console.error("\u274C Migration failed:",t.message),process.exit(1));});});es.command("push").description("Push schema to database (development)").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit push",(t,e,s)=>{t&&(console.error("\u274C Push failed:",t.message),process.exit(1));});});es.command("seed").description("Seed database with initial data").action(async()=>{let{exec:i}=await import('child_process');i("npx tsx src/database/drizzle/seed.ts",(t,e,s)=>{t&&(console.error("\u274C Seeding failed:",t.message),process.exit(1));});});es.command("studio").description("Open Drizzle Studio").action(async()=>{let{exec:i}=await import('child_process');i("npx drizzle-kit studio",(t,e,s)=>{t&&(console.error("\u274C Studio failed:",t.message),process.exit(1));});});var ag=Nt.command("auth").description("Authentication management commands");ag.command("bootstrap").description("Create initial admin user").option("-e, --email <email>","Admin email",process.env.KYRO_ADMIN_EMAIL).option("-p, --password <password>","Admin password",process.env.KYRO_ADMIN_PASSWORD).option("-r, --role <role>","Admin role",process.env.KYRO_ADMIN_ROLE||"admin").action(async i=>{(!i.email||!i.password)&&(console.error("\u274C Email and password are required. Set KYRO_ADMIN_EMAIL and KYRO_ADMIN_PASSWORD env vars or use -e and -p options."),process.exit(1));try{let{bootstrapAdmin:t}=await import('../bootstrap-4FK3LPPH.js'),e=process.env.DATABASE_URL||"",s=e.toLowerCase().startsWith("postgres://")||e.toLowerCase().startsWith("postgresql://"),r=e.toLowerCase().startsWith("mongodb://")||e.toLowerCase().startsWith("mongodb+srv://"),n=!e||e.includes(".db")||e.includes("sqlite")||e.includes("file:"),o;if(s){let{PostgresAuthAdapter:a}=await import('../postgres-auth-adapter-SK3N3OSS.js'),{drizzle:h}=await import('../postgres-js-4CI7FMYS.js'),{default:d}=await import('../src-QBADSZV4.js'),c=d(e,{max:1,onnotice:()=>{}}),f=h(c);o=new a({db:f});}else if(r){let{MongoDBAuthAdapter:a}=await import('../mongo-auth-adapter-QDXVHREJ.js'),h=await import('../lib-XXYYUPMW.js'),d=h.MongoClient??h.default?.MongoClient,c=new d(e);await c.connect();let f=c.db();o=new a({db:f});}else {let{SQLiteAuthAdapter:a}=await import('../sqlite-adapter-4TPNROJK.js'),h=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";o=new a({path:h});}o.connect&&await o.connect();let u=await t({authAdapter:o,adminEmail:i.email,adminPassword:i.password,adminRole:i.role});o.disconnect&&await o.disconnect(),u.success||(console.error("\u274C Failed to create admin:",u.error),process.exit(1));}catch(t){console.error("\u274C Bootstrap failed:",t),process.exit(1);}});Nt.command("health").description("Check system health").action(async()=>{let i=process.env.DATABASE_URL||"",t=i.toLowerCase().startsWith("postgres://")||i.toLowerCase().startsWith("postgresql://"),e=i.toLowerCase().startsWith("mongodb://")||i.toLowerCase().startsWith("mongodb+srv://"),s=!i||i.includes(".db")||i.includes("sqlite")||i.includes("file:");if(t)try{let{default:r}=await import('../src-QBADSZV4.js'),n=r(i,{max:1,onnotice:()=>{}});await n.unsafe("SELECT 1"),await n.end();}catch{}else if(e)try{let r=await import('../lib-XXYYUPMW.js'),n=r.MongoClient??r.default?.MongoClient,o=new n(i);await o.connect(),await o.db().admin().ping(),await o.close();}catch{}else if(s)try{let r=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db",{existsSync:n}=await import('fs');n(r);}catch{}});Nt.parse();process.argv.slice(2).length||Nt.outputHelp();
|
package/dist/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export{a as CSSGenerator,g as createAdminStyling,d as defaultDarkTheme,h as defaultFieldStyling,c as defaultLightTheme,e as ecommerce2026Theme,f as generateCSSVariables,b as generateTailwindConfig}from'./chunk-7FXEXHK6.js';export{q as ALL_FIELD_TYPES,u as renderRichText,s as richTextStyles}from'./chunk-ZRIBWDYJ.js';import'./chunk-SQBTIMWF.js';export{a as createAuditContext}from'./chunk-L2QXP26Q.js';import'./chunk-7MNDQU6K.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {c,d as d$1,b as b$1,a as a$1}from'./chunk-UWHWSWDE.js';import {i}from'./chunk-JV4HJBXW.js';import {d}from'./chunk-N5POANYV.js';import {aa,$,T,Y}from'./chunk-HRAY65XH.js';import {a,J,M,Q}from'./chunk-3NSZZCOJ.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g$1();g$1();g$1();var f=class extends c{constructor(t,s,r,e={}){super(s),this.client=t,this.schema=r,this.options=e,this.logger=e.logger??new aa,this.cache=e.cache??new d;}static[a]="SQLiteD1Session";logger;cache;prepareQuery(t,s,r,e,o,a,i){let n=this.client.prepare(t.sql);return new b(n,t,this.logger,this.cache,a,i,s,r,e,o)}async batch(t){let s=[],r=[];for(let o of t){let a=o._prepare(),i=a.getQuery();if(s.push(a),i.params.length>0)r.push(a.stmt.bind(...i.params));else {let n=a.getQuery();r.push(this.client.prepare(n.sql).bind(...n.params));}}return (await this.client.batch(r)).map((o,a)=>s[a].mapResult(o,true))}extractRawAllValueFromBatchResult(t){return t.results}extractRawGetValueFromBatchResult(t){return t.results[0]}extractRawValuesValueFromBatchResult(t){return g(t.results)}async transaction(t,s){let r=new w("async",this.dialect,this,this.schema);await this.run(J.raw(`begin${s?.behavior?" "+s.behavior:""}`));try{let e=await t(r);return await this.run(J`commit`),e}catch(e){throw await this.run(J`rollback`),e}}},w=class c extends d$1{static[a]="D1Transaction";async transaction(t){let s=`sp${this.nestedIndex}`,r=new c("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(J.raw(`savepoint ${s}`));try{let e=await t(r);return await this.session.run(J.raw(`release savepoint ${s}`)),e}catch(e){throw await this.session.run(J.raw(`rollback to savepoint ${s}`)),e}}};function g(c){let t=[];for(let s of c){let r=Object.keys(s).map(e=>s[e]);t.push(r);}return t}var b=class extends b$1{constructor(t,s,r,e,o,a,i,n,l,d){super("async",n,s,e,o,a),this.logger=r,this._isResponseInArrayMode=l,this.customResultMapper=d,this.fields=i,this.stmt=t;}static[a]="D1PreparedQuery";customResultMapper;fields;stmt;async run(t){let s=M(this.query.params,t??{});return this.logger.logQuery(this.query.sql,s),await this.queryWithCache(this.query.sql,s,async()=>this.stmt.bind(...s).run())}async all(t){let{fields:s,query:r,logger:e,stmt:o,customResultMapper:a}=this;if(!s&&!a){let n=M(r.params,t??{});return e.logQuery(r.sql,n),await this.queryWithCache(r.sql,n,async()=>o.bind(...n).all().then(({results:l})=>this.mapAllResult(l)))}let i=await this.values(t);return this.mapAllResult(i)}mapAllResult(t,s){return s&&(t=g(t.results)),!this.fields&&!this.customResultMapper?t:this.customResultMapper?this.customResultMapper(t):t.map(r=>Q(this.fields,r,this.joinsNotNullableMap))}async get(t){let{fields:s,joinsNotNullableMap:r,query:e,logger:o,stmt:a,customResultMapper:i}=this;if(!s&&!i){let l=M(e.params,t??{});return o.logQuery(e.sql,l),await this.queryWithCache(e.sql,l,async()=>a.bind(...l).all().then(({results:d})=>d[0]))}let n=await this.values(t);if(n[0])return i?i(n):Q(s,n[0],r)}mapGetResult(t,s){return s&&(t=g(t.results)[0]),!this.fields&&!this.customResultMapper?t:this.customResultMapper?this.customResultMapper([t]):Q(this.fields,t,this.joinsNotNullableMap)}async values(t){let s=M(this.query.params,t??{});return this.logger.logQuery(this.query.sql,s),await this.queryWithCache(this.query.sql,s,async()=>this.stmt.bind(...s).raw())}isResponseInArrayMode(){return this._isResponseInArrayMode}};var R=class extends a$1{static[a]="D1Database";async batch(t){return this.session.batch(t)}};function E(c,t={}){let s=new i({casing:t.casing}),r;t.logger===true?r=new $:t.logger!==false&&(r=t.logger);let e;if(t.schema){let i=T(t.schema,Y);e={fullSchema:t.schema,schema:i.tables,tableNamesMap:i.tableNamesMap};}let o=new f(c,s,e,{logger:r,cache:t.cache}),a=new R("async",s,o,e);return a.$client=c,a.$cache=t.cache,a.$cache&&(a.$cache.invalidate=t.cache?.onMutate),a}export{b as D1PreparedQuery,w as D1Transaction,R as DrizzleD1Database,f as SQLiteD1Session,E as drizzle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
g$1();g$1();g$1();g$1();g$1();var v=(e,t,r$1)=>{let o={EcsContainer:async i=>{let{fromHttp:c}=await import('./dist-es-
|
|
1
|
+
import {b as b$1}from'./chunk-OBYAIJVU.js';import {A as A$1,v as v$1,p,r}from'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import {g as g$1}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g$1();g$1();g$1();g$1();g$1();var v=(e,t,r$1)=>{let o={EcsContainer:async i=>{let{fromHttp:c}=await import('./dist-es-M66JKZF5.js'),{fromContainerMetadata:n}=await import('./dist-es-WFI55HKT.js');return r$1?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer"),async()=>r(c(i??{}),n(i))().then(C)},Ec2InstanceMetadata:async i=>{r$1?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");let{fromInstanceMetadata:c}=await import('./dist-es-WFI55HKT.js');return async()=>c(i)().then(C)},Environment:async i=>{r$1?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");let{fromEnv:c}=await import('./dist-es-IPSSZNFP.js');return async()=>c(i)().then(C)}};if(e in o)return o[e];throw new p(`Unsupported credential source in profile ${t}. Got ${e}, expected EcsContainer or Ec2InstanceMetadata or Environment.`,{logger:r$1})},C=e=>b$1(e,"CREDENTIALS_PROFILE_NAMED_PROVIDER","p");var R=(e,{profile:t="default",logger:r}={})=>!!e&&typeof e=="object"&&typeof e.role_arn=="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1&&["undefined","string"].indexOf(typeof e.external_id)>-1&&["undefined","string"].indexOf(typeof e.mfa_serial)>-1&&(N(e,{profile:t,logger:r})||j(e,{profile:t,logger:r})),N=(e,{profile:t,logger:r})=>{let o=typeof e.source_profile=="string"&&typeof e.credential_source>"u";return o&&r?.debug?.(` ${t} isAssumeRoleWithSourceProfile source_profile=${e.source_profile}`),o},j=(e,{profile:t,logger:r})=>{let o=typeof e.credential_source=="string"&&typeof e.source_profile>"u";return o&&r?.debug?.(` ${t} isCredentialSourceProfile credential_source=${e.credential_source}`),o},A=async(e,t,r,o,i={},c)=>{r.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");let n=t[e],{source_profile:f,region:T}=n;if(!r.roleAssumer){let{getDefaultRoleAssumer:u}=await import('./sts-WAA6I22C.js');r.roleAssumer=u({...r.clientConfig,credentialProviderLogger:r.logger,parentClientConfig:{...o,...r?.parentClientConfig,region:T??r?.parentClientConfig?.region??o?.region}},r.clientPlugins);}if(f&&f in i)throw new p(`Detected a cycle attempting to resolve credentials for profile ${v$1(r)}. Profiles visited: `+Object.keys(i).join(", "),{logger:r.logger});r.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${f?`source_profile=[${f}]`:`profile=[${e}]`}`);let E=f?c(f,t,r,o,{...i,[f]:true},I(t[f]??{})):(await v(n.credential_source,e,r.logger)(r))();if(I(n))return E.then(u=>b$1(u,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"));{let u={RoleArn:n.role_arn,RoleSessionName:n.role_session_name||`aws-sdk-js-${Date.now()}`,ExternalId:n.external_id,DurationSeconds:parseInt(n.duration_seconds||"3600",10)},{mfa_serial:p$1}=n;if(p$1){if(!r.mfaCodeProvider)throw new p(`Profile ${e} requires multi-factor authentication, but no MFA code callback was provided.`,{logger:r.logger,tryNextLink:false});u.SerialNumber=p$1,u.TokenCode=await r.mfaCodeProvider(p$1);}let $=await E;return r.roleAssumer($,u).then(W=>b$1(W,"CREDENTIALS_PROFILE_SOURCE_PROFILE","o"))}},I=e=>!e.role_arn&&!!e.credential_source;g$1();var L=e=>!!(e&&e.login_session),O=async(e,t,r)=>{let{fromLoginCredentials:o}=await import('./dist-es-SVHZDVUF.js'),i=await o({...t,profile:e})({callerClientConfig:r});return b$1(i,"CREDENTIALS_PROFILE_LOGIN","AC")};g$1();var b=e=>!!e&&typeof e=="object"&&typeof e.credential_process=="string",x=async(e,t)=>{let{fromProcess:r}=await import('./dist-es-M2F7M27Y.js'),o=await r({...e,profile:t})();return b$1(o,"CREDENTIALS_PROFILE_PROCESS","v")};g$1();var k=async(e,t,r={},o)=>{let{fromSSO:i}=await import('./dist-es-F2ZR55UK.js');return i({profile:e,logger:r.logger,parentClientConfig:r.parentClientConfig,clientConfig:r.clientConfig})({callerClientConfig:o}).then(c=>t.sso_session?b$1(c,"CREDENTIALS_PROFILE_SSO","r"):b$1(c,"CREDENTIALS_PROFILE_SSO_LEGACY","t"))},F=e=>e&&(typeof e.sso_start_url=="string"||typeof e.sso_account_id=="string"||typeof e.sso_session=="string"||typeof e.sso_region=="string"||typeof e.sso_role_name=="string");g$1();var y=e=>!!e&&typeof e=="object"&&typeof e.aws_access_key_id=="string"&&typeof e.aws_secret_access_key=="string"&&["undefined","string"].indexOf(typeof e.aws_session_token)>-1&&["undefined","string"].indexOf(typeof e.aws_account_id)>-1,g=async(e,t)=>{t?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");let r={accessKeyId:e.aws_access_key_id,secretAccessKey:e.aws_secret_access_key,sessionToken:e.aws_session_token,...e.aws_credential_scope&&{credentialScope:e.aws_credential_scope},...e.aws_account_id&&{accountId:e.aws_account_id}};return b$1(r,"CREDENTIALS_PROFILE","n")};g$1();var h=e=>!!e&&typeof e=="object"&&typeof e.web_identity_token_file=="string"&&typeof e.role_arn=="string"&&["undefined","string"].indexOf(typeof e.role_session_name)>-1,D=async(e,t,r)=>{let{fromTokenFile:o}=await import('./dist-es-OKLLRYI3.js'),i=await o({webIdentityTokenFile:e.web_identity_token_file,roleArn:e.role_arn,roleSessionName:e.role_session_name,roleAssumerWithWebIdentity:t.roleAssumerWithWebIdentity,logger:t.logger,parentClientConfig:t.parentClientConfig})({callerClientConfig:r});return b$1(i,"CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN","q")};var w=async(e,t,r,o,i={},c=false)=>{let n=t[e];if(Object.keys(i).length>0&&y(n))return g(n,r);if(c||R(n,{profile:e,logger:r.logger}))return A(e,t,r,o,i,w);if(y(n))return g(n,r);if(h(n))return D(n,r,o);if(b(n))return x(r,e);if(F(n))return await k(e,n,r,o);if(L(n))return O(e,r,o);throw new p(`Could not resolve credentials using profile: [${e}] in configuration/credentials file(s).`,{logger:r.logger})};var M=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");let r=await A$1(e);return w(v$1({profile:e.profile??t?.profile}),r,e,t)};export{M as fromIni};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
g();g();g();var F=e=>e&&(typeof e.sso_start_url=="string"||typeof e.sso_account_id=="string"||typeof e.sso_session=="string"||typeof e.sso_region=="string"||typeof e.sso_role_name=="string");g();g();g();g();var T="To refresh this SSO session run 'aws sso login' with the corresponding profile.";g();g();var z=async(e,s={},t)=>{let{SSOOIDCClient:n}=await import('./sso-oidc-
|
|
1
|
+
import {b as b$1}from'./chunk-OBYAIJVU.js';import {p,v,A,z as z$1,x,q,w}from'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import {promises}from'fs';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g();g();g();var F=e=>e&&(typeof e.sso_start_url=="string"||typeof e.sso_account_id=="string"||typeof e.sso_session=="string"||typeof e.sso_region=="string"||typeof e.sso_role_name=="string");g();g();g();g();var T="To refresh this SSO session run 'aws sso login' with the corresponding profile.";g();g();var z=async(e,s={},t)=>{let{SSOOIDCClient:n}=await import('./sso-oidc-UB7G4END.js'),i=p=>s.clientConfig?.[p]??s.parentClientConfig?.[p]??t?.[p];return new n(Object.assign({},s.clientConfig??{},{region:e??s.clientConfig?.region,logger:i("logger"),userAgentAppId:i("userAgentAppId")}))};var J=async(e,s,t={},n)=>{let{CreateTokenCommand:i}=await import('./sso-oidc-UB7G4END.js');return (await z(s,t,n)).send(new i({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))};g();var $=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new q(`Token is expired. ${T}`,false)};g();var h=(e,s,t=false)=>{if(typeof s>"u")throw new q(`Value not present for '${e}' in SSO Token${t?". Cannot refresh":""}. ${T}`,false)};g();var{writeFile:Z}=promises,V=(e,s)=>{let t=w(e),n=JSON.stringify(s,null,2);return Z(t,n)};var Y=new Date(0),L=(e={})=>async({callerClientConfig:s}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");let t=await A(e),n=v({profile:e.profile??s?.profile}),i=t[n];if(i){if(!i.sso_session)throw new q(`Profile '${n}' is missing required property 'sso_session'.`)}else throw new q(`Profile '${n}' could not be found in shared credentials file.`,false);let l=i.sso_session,d=(await z$1(e))[l];if(!d)throw new q(`Sso session '${l}' could not be found in shared credentials file.`,false);for(let a of ["sso_start_url","sso_region"])if(!d[a])throw new q(`Sso session '${l}' is missing required property '${a}'.`,false);d.sso_start_url;let y=d.sso_region,r;try{r=await x(l);}catch{throw new q(`The SSO session token associated with profile=${n} was not found or is invalid. ${T}`,false)}h("accessToken",r.accessToken),h("expiresAt",r.expiresAt);let{accessToken:x$1,expiresAt:C}=r,c={token:x$1,expiration:new Date(C)};if(c.expiration.getTime()-Date.now()>3e5)return c;if(Date.now()-Y.getTime()<30*1e3)return $(c),c;h("clientId",r.clientId,true),h("clientSecret",r.clientSecret,true),h("refreshToken",r.refreshToken,true);try{Y.setTime(Date.now());let a=await J(r,y,e,s);h("accessToken",a.accessToken),h("expiresIn",a.expiresIn);let u=new Date(Date.now()+a.expiresIn*1e3);try{await V(l,{...r,accessToken:a.accessToken,expiresAt:u.toISOString(),refreshToken:a.refreshToken});}catch{}return {token:a.accessToken,expiration:u}}catch{return $(c),c}};var O=false,M=async({ssoStartUrl:e,ssoSession:s,ssoAccountId:t,ssoRegion:n,ssoRoleName:i,ssoClient:l,clientConfig:p$1,parentClientConfig:d,callerClientConfig:m,profile:y,filepath:r,configFilepath:x$1,ignoreCache:C,logger:c})=>{let a,u="To refresh this SSO session run aws sso login with the corresponding profile.";if(s)try{let _=await L({profile:y,filepath:r,configFilepath:x$1,ignoreCache:C,clientConfig:p$1,parentClientConfig:d,logger:c})({callerClientConfig:m});a={accessToken:_.token,expiresAt:new Date(_.expiration).toISOString()};}catch(_){throw new p(_.message,{tryNextLink:O,logger:c})}else try{a=await x(e);}catch{throw new p(`The SSO session associated with this profile is invalid. ${u}`,{tryNextLink:O,logger:c})}if(new Date(a.expiresAt).getTime()-Date.now()<=0)throw new p(`The SSO session associated with this profile has expired. ${u}`,{tryNextLink:O,logger:c});let{accessToken:v}=a,{SSOClient:k,GetRoleCredentialsCommand:E}=await import('./loadSso-UQR6545M.js'),B=l||new k(Object.assign({},p$1??{},{logger:p$1?.logger??m?.logger??d?.logger,region:p$1?.region??n,userAgentAppId:p$1?.userAgentAppId??m?.userAgentAppId??d?.userAgentAppId})),G;try{G=await B.send(new E({accountId:t,roleName:i,accessToken:v}));}catch(_){throw new p(_,{tryNextLink:O,logger:c})}let{roleCredentials:{accessKeyId:K,secretAccessKey:H,sessionToken:U,expiration:j,credentialScope:q,accountId:W}={}}=G;if(!K||!H||!U||!j)throw new p("SSO returns an invalid temporary credential.",{tryNextLink:O,logger:c});let P={accessKeyId:K,secretAccessKey:H,sessionToken:U,expiration:new Date(j),...q&&{credentialScope:q},...W&&{accountId:W}};return s?b$1(P,"CREDENTIALS_SSO","s"):b$1(P,"CREDENTIALS_SSO_LEGACY","u"),P};g();var b=(e,s)=>{let{sso_start_url:t,sso_account_id:n,sso_region:i,sso_role_name:l}=e;if(!t||!n||!i||!l)throw new p(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}
|
|
3
3
|
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:false,logger:s});return e};var oe=(e={})=>async({callerClientConfig:s}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");let{ssoStartUrl:t,ssoAccountId:n,ssoRegion:i,ssoRoleName:l,ssoSession:p$1}=e,{ssoClient:d}=e,m=v({profile:e.profile??s?.profile});if(!t&&!n&&!i&&!l&&!p$1){let r=(await A(e))[m];if(!r)throw new p(`Profile ${m} was not found.`,{logger:e.logger});if(!F(r))throw new p(`Profile ${m} is not configured with SSO credentials.`,{logger:e.logger});if(r?.sso_session){let k=(await z$1(e))[r.sso_session],E=` configurations in profile ${m} and sso-session ${r.sso_session}`;if(i&&i!==k.sso_region)throw new p("Conflicting SSO region"+E,{tryNextLink:false,logger:e.logger});if(t&&t!==k.sso_start_url)throw new p("Conflicting SSO start_url"+E,{tryNextLink:false,logger:e.logger});r.sso_region=k.sso_region,r.sso_start_url=k.sso_start_url;}let{sso_start_url:x,sso_account_id:C,sso_region:c,sso_role_name:a,sso_session:u}=b(r,e.logger);return M({ssoStartUrl:x,ssoSession:u,ssoAccountId:C,ssoRegion:c,ssoRoleName:a,ssoClient:d,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:m,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}else {if(!t||!n||!i||!l)throw new p('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:false,logger:e.logger});return M({ssoStartUrl:t,ssoSession:p$1,ssoAccountId:n,ssoRegion:i,ssoRoleName:l,ssoClient:d,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:m,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}};
|
|
4
4
|
export{oe as fromSSO,F as isSsoProfile,b as validateSsoProfile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as ENV_ACCOUNT_ID,e as ENV_CREDENTIAL_SCOPE,d as ENV_EXPIRATION,a as ENV_KEY,b as ENV_SECRET,c as ENV_SESSION,g as fromEnv}from'./chunk-W45TLOOT.js';import'./chunk-OBYAIJVU.js';import'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {b}from'./chunk-OBYAIJVU.js';import {A,v,B,p}from'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import {exec}from'child_process';import {promisify}from'util';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();g();g();g();var m=(r,e,o)=>{if(e.Version!==1)throw Error(`Profile ${r} credential_process did not return Version 1.`);if(e.AccessKeyId===void 0||e.SecretAccessKey===void 0)throw Error(`Profile ${r} credential_process returned invalid credentials.`);if(e.Expiration){let d=new Date;if(new Date(e.Expiration)<d)throw Error(`Profile ${r} credential_process returned expired credentials.`)}let t=e.AccountId;!t&&o?.[r]?.aws_account_id&&(t=o[r].aws_account_id);let n={accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,...e.SessionToken&&{sessionToken:e.SessionToken},...e.Expiration&&{expiration:new Date(e.Expiration)},...e.CredentialScope&&{credentialScope:e.CredentialScope},...t&&{accountId:t}};return b(n,"CREDENTIALS_PROCESS","w"),n};var x=async(r,e,o)=>{let t=e[r];if(e[r]){let n=t.credential_process;if(n!==void 0){let d=promisify(B?.getTokenRecord?.().exec??exec);try{let{stdout:c}=await d(n),p;try{p=JSON.parse(c.trim());}catch{throw Error(`Profile ${r} credential_process returned invalid JSON.`)}return m(r,p,e)}catch(c){throw new p(c.message,{logger:o})}}else throw new p(`Profile ${r} did not contain credential_process.`,{logger:o})}else throw new p(`Profile ${r} could not be found in shared credentials file.`,{logger:o})};var y=(r={})=>async({callerClientConfig:e}={})=>{r.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let o=await A(r);return x(v({profile:r.profile??e?.profile}),o,r.logger)};export{y as fromProcess};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {a}from'./chunk-LVBHOZZF.js';import {b}from'./chunk-OBYAIJVU.js';import {p,e}from'./chunk-JRUQ5ABB.js';import {A,g as g$1}from'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import U from'fs/promises';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();g();g();var y="169.254.170.2",v="169.254.170.23",L="[fd00:ec2::23]",u=(e,o)=>{if(e.protocol!=="https:"&&!(e.hostname===y||e.hostname===v||e.hostname===L)){if(e.hostname.includes("[")){if(e.hostname==="[::1]"||e.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else {if(e.hostname==="localhost")return;let n=e.hostname.split("."),r=t=>{let i=parseInt(t,10);return 0<=i&&i<=255};if(n[0]==="127"&&r(n[1])&&r(n[2])&&r(n[3])&&n.length===4)return}throw new p(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
3
3
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
4
4
|
- ECS container host 169.254.170.2
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
g();g();g();var c=e=>async s=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:n,webIdentityToken:i,providerId:t,policyArns:p,policy:_,durationSeconds:S}=e,{roleAssumerWithWebIdentity:l}=e;if(!l){let{getDefaultRoleAssumerWithWebIdentity:T}=await import('./sts-
|
|
1
|
+
import {b}from'./chunk-OBYAIJVU.js';import {p,B}from'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import {readFileSync}from'fs';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g();g();g();var c=e=>async s=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");let{roleArn:o,roleSessionName:n,webIdentityToken:i,providerId:t,policyArns:p,policy:_,durationSeconds:S}=e,{roleAssumerWithWebIdentity:l}=e;if(!l){let{getDefaultRoleAssumerWithWebIdentity:T}=await import('./sts-WAA6I22C.js');l=T({...e.clientConfig,credentialProviderLogger:e.logger,parentClientConfig:{...s?.callerClientConfig,...e.parentClientConfig}},e.clientPlugins);}return l({RoleArn:o,RoleSessionName:n??`aws-sdk-js-session-${Date.now()}`,WebIdentityToken:i,ProviderId:t,PolicyArns:p,Policy:_,DurationSeconds:S})};var E="AWS_WEB_IDENTITY_TOKEN_FILE",I="AWS_ROLE_ARN",y="AWS_ROLE_SESSION_NAME",A=(e={})=>async s=>{e.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");let o=e?.webIdentityTokenFile??process.env[E],n=e?.roleArn??process.env[I],i=e?.roleSessionName??process.env[y];if(!o||!n)throw new p("Web identity configuration not specified",{logger:e.logger});let t=await c({...e,webIdentityToken:B?.getTokenRecord?.()[o]??readFileSync(o,{encoding:"ascii"}),roleArn:n,roleSessionName:i})(s);return o===process.env[E]&&b(t,"CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN","h"),t};export{A as fromTokenFile,c as fromWebToken};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
g();g();g();var k=class g{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300*1e3;constructor(r,e,o){this.profileData=r,this.init=e,this.callerClientConfig=o;}async loadCredentials(){let r=await this.loadToken();if(!r)throw new p(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:false,logger:this.logger});let e=r.accessToken,o=Date.now();return new Date(e.expiresAt).getTime()-o<=g.REFRESH_THRESHOLD?this.refresh(r):{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken,accountId:e.accountId,expiration:new Date(e.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(r){let{SigninClient:e,CreateOAuth2TokenCommand:o}=await import('./signin-
|
|
1
|
+
import {b}from'./chunk-OBYAIJVU.js';import {A,v,p,y,e}from'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import {createHash,createPrivateKey,createPublicKey,sign}from'crypto';import {promises}from'fs';import {homedir}from'os';import {dirname,join}from'path';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
g();g();g();var k=class g{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300*1e3;constructor(r,e,o){this.profileData=r,this.init=e,this.callerClientConfig=o;}async loadCredentials(){let r=await this.loadToken();if(!r)throw new p(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:false,logger:this.logger});let e=r.accessToken,o=Date.now();return new Date(e.expiresAt).getTime()-o<=g.REFRESH_THRESHOLD?this.refresh(r):{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken,accountId:e.accountId,expiration:new Date(e.expiresAt)}}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}async refresh(r){let{SigninClient:e,CreateOAuth2TokenCommand:o}=await import('./signin-N3T2KF5Q.js'),{logger:t,userAgentAppId:i}=this.callerClientConfig??{},l=(n=>n?.metadata?.handlerProtocol==="h2")(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,p$1=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,y=new e({credentials:{accessKeyId:"",secretAccessKey:""},region:p$1,requestHandler:l,logger:t,userAgentAppId:i,...this.init?.clientConfig});this.createDPoPInterceptor(y.middlewareStack);let T={tokenInput:{clientId:r.clientId,refreshToken:r.refreshToken,grantType:"refresh_token"}};try{let n=await y.send(new o(T)),{accessKeyId:d,secretAccessKey:a,sessionToken:u}=n.tokenOutput?.accessToken??{},{refreshToken:m,expiresIn:C}=n.tokenOutput??{};if(!d||!a||!u||!m)throw new p("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let I=(C??900)*1e3,f=new Date(Date.now()+I),E={...r,accessToken:{...r.accessToken,accessKeyId:d,secretAccessKey:a,sessionToken:u,expiresAt:f.toISOString()},refreshToken:m};await this.saveToken(E);let w=E.accessToken;return {accessKeyId:w.accessKeyId,secretAccessKey:w.secretAccessKey,sessionToken:w.sessionToken,accountId:w.accountId,expiration:f}}catch(n){if(n.name==="AccessDeniedException"){let d=n.error,a;switch(d){case "TOKEN_EXPIRED":a="Your session has expired. Please reauthenticate.";break;case "USER_CREDENTIALS_CHANGED":a="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case "INSUFFICIENT_PERMISSIONS":a="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:a=`Failed to refresh token: ${String(n)}. Please re-authenticate using \`aws login\``;}throw new p(a,{logger:this.logger,tryNextLink:false})}throw new p(`Failed to refresh token: ${String(n)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let r=this.getTokenFilePath();try{let e;try{e=await y(r,{ignoreCache:this.init?.ignoreCache});}catch{e=await promises.readFile(r,"utf8");}let o=JSON.parse(e),t=["accessToken","clientId","refreshToken","dpopKey"].filter(i=>!o[i]);if(o.accessToken?.accountId||t.push("accountId"),t.length>0)throw new p(`Token validation failed, missing fields: ${t.join(", ")}`,{logger:this.logger,tryNextLink:!1});return o}catch(e){throw new p(`Failed to load token from ${r}: ${String(e)}`,{logger:this.logger,tryNextLink:false})}}async saveToken(r){let e=this.getTokenFilePath(),o=dirname(e);try{await promises.mkdir(o,{recursive:!0});}catch{}await promises.writeFile(e,JSON.stringify(r,null,2),"utf8");}getTokenFilePath(){let r=process.env.AWS_LOGIN_CACHE_DIRECTORY??join(homedir(),".aws","login","cache"),e=Buffer.from(this.loginSession,"utf8"),o=createHash("sha256").update(e).digest("hex");return join(r,`${o}.json`)}derToRawSignature(r){let e=2;if(r[e]!==2)throw new Error("Invalid DER signature");e++;let o=r[e++],t=r.subarray(e,e+o);if(e+=o,r[e]!==2)throw new Error("Invalid DER signature");e++;let i=r[e++],s=r.subarray(e,e+i);t=t[0]===0?t.subarray(1):t,s=s[0]===0?s.subarray(1):s;let l=Buffer.concat([Buffer.alloc(32-t.length),t]),p=Buffer.concat([Buffer.alloc(32-s.length),s]);return Buffer.concat([l,p])}createDPoPInterceptor(r){r.add(e$1=>async o=>{if(e.isInstance(o.request)){let t=o.request,i=`${t.protocol}//${t.hostname}${t.port?`:${t.port}`:""}${t.path}`,s=await this.generateDpop(t.method,i);t.headers={...t.headers,DPoP:s};}return e$1(o)},{step:"finalizeRequest",name:"dpopInterceptor",override:true});}async generateDpop(r="POST",e){let o=await this.loadToken();try{let t=createPrivateKey({key:o.dpopKey,format:"pem",type:"sec1"}),s=createPublicKey(t).export({format:"der",type:"spki"}),l=-1;for(let f=0;f<s.length;f++)if(s[f]===4){l=f;break}let p=s.slice(l+1,l+33),y=s.slice(l+33,l+65),T={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:p.toString("base64url"),y:y.toString("base64url")}},n={jti:crypto.randomUUID(),htm:r,htu:e,iat:Math.floor(Date.now()/1e3)},d=Buffer.from(JSON.stringify(T)).toString("base64url"),a=Buffer.from(JSON.stringify(n)).toString("base64url"),u=`${d}.${a}`,m=sign("sha256",Buffer.from(u),t),I=this.derToRawSignature(m).toString("base64url");return `${u}.${I}`}catch(t){throw new p(`Failed to generate Dpop proof: ${t instanceof Error?t.message:String(t)}`,{logger:this.logger,tryNextLink:false})}}};var _=g=>async({callerClientConfig:r}={})=>{g?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let e=await A(g||{}),o=v({profile:g?.profile??r?.profile}),t=e[o];if(!t?.login_session)throw new p(`Profile ${o} does not contain login_session.`,{tryNextLink:true,logger:g?.logger});let s=await new k(t,g,r).loadCredentials();return b(s,"CREDENTIALS_LOGIN","AD")};
|
|
3
3
|
export{_ as fromLoginCredentials};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {o,i,C as C$1,p}from'./chunk-JRUQ5ABB.js';import'./chunk-TYQYKKWJ.js';import {g}from'./chunk-Y2YAKDEQ.js';import F from'http';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();g();g();var O=e=>!!e&&typeof e=="object"&&typeof e.AccessKeyId=="string"&&typeof e.SecretAccessKey=="string"&&typeof e.Token=="string"&&typeof e.Expiration=="string",D=e=>({accessKeyId:e.AccessKeyId,secretAccessKey:e.SecretAccessKey,sessionToken:e.Token,expiration:new Date(e.Expiration),...e.AccountId&&{accountId:e.AccountId}});g();var G=1e3,H=0,N=({maxRetries:e=0,timeout:t=1e3})=>({maxRetries:e,timeout:t});g();g();function _(e){return new Promise((t,a)=>{let r=F.request({method:"GET",...e,hostname:e.hostname?.replace(/^\[(.+)\]$/,"$1")});r.on("error",n=>{a(Object.assign(new o("Unable to connect to instance metadata service"),n)),r.destroy();}),r.on("timeout",()=>{a(new o("TimeoutError from instance metadata service")),r.destroy();}),r.on("response",n=>{let{statusCode:d=400}=n;(d<200||300<=d)&&(a(Object.assign(new o("Error response received from instance metadata service"),{statusCode:d})),r.destroy());let I=[];n.on("data",l=>{I.push(l);}),n.on("end",()=>{t(Buffer.concat(I)),r.destroy();});}),r.end();})}g();var v=(e,t)=>{let a=e();for(let r=0;r<t;r++)a=a.catch(e);return a};var C="AWS_CONTAINER_CREDENTIALS_FULL_URI",w="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",x="AWS_CONTAINER_AUTHORIZATION_TOKEN",q=(e={})=>{let{timeout:t,maxRetries:a}=N(e);return ()=>v(async()=>{let r=await z({logger:e.logger}),n=JSON.parse(await j(t,r));if(!O(n))throw new p("Invalid response received from instance metadata service.",{logger:e.logger});return D(n)},a)},j=async(e,t)=>(process.env[x]&&(t.headers={...t.headers,Authorization:process.env[x]}),(await _({...t,timeout:e})).toString()),Y="169.254.170.2",J=new Set(["localhost","127.0.0.1"]),X=new Set(["http:","https:"]),z=async({logger:e})=>{if(process.env[w])return {hostname:Y,path:process.env[w]};if(process.env[C]){let t;try{t=new URL(process.env[C]);}catch{throw new p(`${process.env[C]} is not a valid container metadata service URL`,{tryNextLink:false,logger:e})}if(!t.hostname||!J.has(t.hostname))throw new p(`${t.hostname} is not a valid container metadata service hostname`,{tryNextLink:false,logger:e});if(!t.protocol||!X.has(t.protocol))throw new p(`${t.protocol} is not a valid container metadata service protocol`,{tryNextLink:false,logger:e});return {protocol:t.protocol,hostname:t.hostname,path:t.pathname+t.search,port:t.port?parseInt(t.port,10):void 0}}throw new p(`The container metadata credential provider cannot be used unless the ${w} or ${C} environment variable is set`,{tryNextLink:false,logger:e})};g();g();var M=class e extends p{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(t,a=true){super(t,a),this.tryNextLink=a,Object.setPrototypeOf(this,e.prototype);}};g();g();var A;(function(e){e.IPv4="http://169.254.169.254",e.IPv6="http://[fd00:ec2::254]";})(A||(A={}));g();var Z="AWS_EC2_METADATA_SERVICE_ENDPOINT",Q="ec2_metadata_service_endpoint",b={environmentVariableSelector:e=>e[Z],configFileSelector:e=>e[Q],default:void 0};g();var E;(function(e){e.IPv4="IPv4",e.IPv6="IPv6";})(E||(E={}));g();var ee="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",te="ec2_metadata_service_endpoint_mode",V={environmentVariableSelector:e=>e[ee],configFileSelector:e=>e[te],default:E.IPv4};var R=async()=>i(await oe()||await re()),oe=async()=>C$1(b)(),re=async()=>{let e=await C$1(V)();switch(e){case E.IPv4:return A.IPv4;case E.IPv6:return A.IPv6;default:throw new Error(`Unsupported endpoint mode: ${e}. Select from ${Object.values(E)}`)}};g();g();var ne="https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html",y=(e,t)=>{let a=300+Math.floor(Math.random()*300),r=new Date(Date.now()+a*1e3);t.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(r)}.
|
|
3
3
|
For more information, please visit: `+ne);let n=e.originalExpiration??e.expiration;return {...e,...n?{originalExpiration:n}:{},expiration:r}};var k=(e,t={})=>{let a=t?.logger||console,r;return async()=>{let n;try{n=await e(),n.expiration&&n.expiration.getTime()<Date.now()&&(n=y(n,a));}catch(d){if(r)a.warn("Credential renew failed: ",d),n=y(r,a);else throw d}return r=n,n}};var K="/latest/meta-data/iam/security-credentials/",ae="/latest/api/token",P="AWS_EC2_METADATA_V1_DISABLED",U="ec2_metadata_v1_disabled",W="x-aws-ec2-metadata-token",se=(e={})=>k(ie(e),{logger:e.logger}),ie=(e={})=>{let t=false,{logger:a,profile:r}=e,{timeout:n,maxRetries:d}=N(e),I=async(l,T)=>{if(t||T.headers?.[W]==null){let p$1=false,m=false,B=await C$1({environmentVariableSelector:f=>{let u=f[P];if(m=!!u&&u!=="false",u===void 0)throw new p(`${P} not set in env, checking config file next.`,{logger:e.logger});return m},configFileSelector:f=>{let u=f[U];return p$1=!!u&&u!=="false",p$1},default:false},{profile:r})();if(e.ec2MetadataV1Disabled||B){let f=[];throw e.ec2MetadataV1Disabled&&f.push("credential provider initialization (runtime option ec2MetadataV1Disabled)"),p$1&&f.push(`config file profile (${U})`),m&&f.push(`process environment variable (${P})`),new M(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${f.join(", ")}].`)}}let $=(await v(async()=>{let p;try{p=await de(T);}catch(m){throw m.statusCode===401&&(t=false),m}return p},l)).trim();return v(async()=>{let p;try{p=await le($,T,e);}catch(m){throw m.statusCode===401&&(t=false),m}return p},l)};return async()=>{let l=await R();if(t)return a?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),I(d,{...l,timeout:n});{let T;try{T=(await ce({...l,timeout:n})).toString();}catch(S){if(S?.statusCode===400)throw Object.assign(S,{message:"EC2 Metadata token request returned error"});return (S.message==="TimeoutError"||[403,404,405].includes(S.statusCode))&&(t=true),a?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),I(d,{...l,timeout:n})}return I(d,{...l,headers:{[W]:T},timeout:n})}}},ce=async e=>_({...e,path:ae,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),de=async e=>(await _({...e,path:K})).toString(),le=async(e,t,a)=>{let r=JSON.parse((await _({...t,path:K+e})).toString());if(!O(r))throw new p("Invalid response received from instance metadata service.",{logger:a.logger});return D(r)};export{H as DEFAULT_MAX_RETRIES,G as DEFAULT_TIMEOUT,x as ENV_CMDS_AUTH_TOKEN,C as ENV_CMDS_FULL_URI,w as ENV_CMDS_RELATIVE_URI,A as Endpoint,q as fromContainerMetadata,se as fromInstanceMetadata,R as getInstanceMetadataEndpoint,_ as httpRequest,N as providerConfigFromInit};
|
package/dist/drizzle/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('../chunk-AMGJ5AFH.cjs');var chunk6KUL2BSA_cjs=require('../chunk-6KUL2BSA.cjs')
|
|
1
|
+
'use strict';require('../chunk-AMGJ5AFH.cjs');var chunk6KUL2BSA_cjs=require('../chunk-6KUL2BSA.cjs'),chunkXBQ6HV3T_cjs=require('../chunk-XBQ6HV3T.cjs');require('../chunk-7JWQ2PZP.cjs'),require('../chunk-NGNJSUGL.cjs'),require('../chunk-KCHPADCH.cjs'),require('../chunk-BAVN7VDR.cjs'),require('../chunk-LY7N3UHH.cjs'),require('../chunk-7ACHOBWY.cjs'),require('../chunk-GNOSG3PK.cjs'),require('../chunk-BCEE4NBZ.cjs'),require('../chunk-VRZC4TTF.cjs'),require('../chunk-VQ53TFYA.cjs'),require('../chunk-F4ITQ6XQ.cjs'),require('../chunk-HTYVI2HK.cjs'),require('../chunk-ZOVH6QT5.cjs'),require('../chunk-7WMMKGEO.cjs'),require('../chunk-BUNLC3II.cjs');Object.defineProperty(exports,"DrizzleAdapter",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.c}});Object.defineProperty(exports,"collectionToDrizzleSchema",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.b}});Object.defineProperty(exports,"createDatabase",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.f}});Object.defineProperty(exports,"createDrizzleAdapter",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.d}});Object.defineProperty(exports,"fieldToDrizzleType",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.a}});Object.defineProperty(exports,"runMigrations",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.g}});Object.defineProperty(exports,"seedDefaultRoles",{enumerable:true,get:function(){return chunk6KUL2BSA_cjs.h}});Object.defineProperty(exports,"PostgresAuthAdapter",{enumerable:true,get:function(){return chunkXBQ6HV3T_cjs.a}});
|
package/dist/drizzle/index.d.cts
CHANGED
|
@@ -91,6 +91,7 @@ declare class PostgresAuthAdapter implements AuthAdapter {
|
|
|
91
91
|
role?: UserRole;
|
|
92
92
|
avatar?: string;
|
|
93
93
|
tenantId?: string;
|
|
94
|
+
emailVerified?: boolean;
|
|
94
95
|
}): Promise<AuthUser>;
|
|
95
96
|
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
96
97
|
findUserById(id: string): Promise<AuthUser | null>;
|
package/dist/drizzle/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ declare class PostgresAuthAdapter implements AuthAdapter {
|
|
|
91
91
|
role?: UserRole;
|
|
92
92
|
avatar?: string;
|
|
93
93
|
tenantId?: string;
|
|
94
|
+
emailVerified?: boolean;
|
|
94
95
|
}): Promise<AuthUser>;
|
|
95
96
|
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
96
97
|
findUserById(id: string): Promise<AuthUser | null>;
|
package/dist/drizzle/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import'../chunk-QDBGBDCT.js';export{c as DrizzleAdapter,b as collectionToDrizzleSchema,f as createDatabase,d as createDrizzleAdapter,a as fieldToDrizzleType,g as runMigrations,h as seedDefaultRoles}from'../chunk-BU6O3TP7.js';export{a as PostgresAuthAdapter}from'../chunk-ZWDBPEXL.js';import'../chunk-47CXBWMA.js';import'../chunk-EML5FDUU.js';import'../chunk-OXGJOYEO.js';import'../chunk-FLMUMPDE.js';import'../chunk-2HA6EKXX.js';import'../chunk-JV4HJBXW.js';import'../chunk-N5POANYV.js';import'../chunk-HRAY65XH.js';import'../chunk-3NSZZCOJ.js';import'../chunk-SLMIYECU.js';import'../chunk-P6JITOFF.js';import'../chunk-7NH7H3WA.js';import'../chunk-VVVCCB6R.js';import'../chunk-TBHNE4VV.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as avg,d as avgDistinct,l as cosineDistance,a as count,b as countDistinct,m as hammingDistance,k as innerProduct,n as jaccardDistance,j as l1Distance,i as l2Distance,g as max,h as min,e as sum,f as sumDistinct}from'./chunk-EML5FDUU.js';export{a as ColumnAliasProxyHandler,_ as ConsoleLogWriter,$ as DefaultLogger,j as DrizzleError,k as DrizzleQueryError,Q as Many,aa as NoopLogger,P as One,i as QueryPromise,N as Relation,c as RelationTableAliasProxyHandler,O as Relations,b as TableAliasProxyHandler,l as TransactionRollbackError,e as aliasedRelation,d as aliasedTable,f as aliasedTableColumn,p as and,J as arrayContained,I as arrayContains,K as arrayOverlaps,L as asc,C as between,m as bindIfParam,W as createMany,V as createOne,Y as createTableRelationsHelpers,M as desc,n as eq,A as exists,T as extractTablesRelationalConfig,R as getOperators,S as getOrderByOperators,s as gt,t as gte,G as ilike,w as inArray,z as isNotNull,y as isNull,E as like,u as lt,v as lte,g as mapColumnsInAliasedSQLToAlias,h as mapColumnsInSQLToAlias,Z as mapRelationalRow,o as ne,X as normalizeRelation,r as not,D as notBetween,B as notExists,H as notIlike,x as notInArray,F as notLike,q as or,U as relations}from'./chunk-HRAY65XH.js';export{q as BaseName,d as Column,e as ColumnBuilder,n as Columns,s as ExtraConfigBuilder,o as ExtraConfigColumns,x as FakePrimitiveParam,r as IsAlias,B as Name,p as OriginalName,H as Param,K as Placeholder,A as SQL,m as Schema,z as StringChunk,i as Subquery,t as Table,N as View,l as ViewBaseConfig,j as WithSubquery,U as applyMixins,a as entityKind,M as fillPlaceholders,Y as getColumnNameAndConfig,V as getTableColumns,X as getTableLikeName,v as getTableName,w as getTableUniqueName,P as getViewName,W as getViewSelectedFields,b as hasOwnEntityKind,S as haveSameKeys,c as is,Z as isConfig,D as isDriverValueEncoder,y as isSQLWrapper,u as isTable,O as isView,Q as mapResultRow,T as mapUpdateSet,C as name,E as noopDecoder,F as noopEncoder,G as noopMapper,R as orderSelectedFields,I as param,L as placeholder,J as sql,_ as textDecoder}from'./chunk-3NSZZCOJ.js';import'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as EventStreamCodec,m as EventStreamMarshaller,r as EventStreamSerde,b as HeaderMarshaller,a as Int64,d as MessageDecoderStream,e as MessageEncoderStream,f as SmithyMessageDecoderStream,g as SmithyMessageEncoderStream,k as UniversalEventStreamMarshaller,n as eventStreamSerdeProvider,h as getChunkedStream,j as getMessageUnmarshaller,i as getUnmarshalledStream,p as iterableToReadableStream,o as readableStreamToIterable,q as resolveEventStreamSerdeConfig,l as universalEventStreamSerdeProvider}from'./chunk-WPM6LFCY.js';import'./chunk-U6KFONKM.js';import'./chunk-TYQYKKWJ.js';import'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
package/dist/fields/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{q as ALL_FIELD_TYPES,n as COMPLEX_FIELD_TYPES,p as LAYOUT_FIELD_TYPES,m as PRIMITIVE_FIELD_TYPES,o as RELATIONAL_FIELD_TYPES,r as createRelationshipFieldConfig,d as isArrayField,f as isBlocksField,e as isGroupField,l as isIconField,h as isImageField,k as isLayoutField,b as isNumberField,c as isRelationshipField,i as isRichTextField,j as isSelectField,a as isTextField,g as isUploadField,t as normalizeRichTextValue,u as renderRichText,s as richTextStyles}from'../chunk-ZRIBWDYJ.js';export{a as generateSEOFields}from'../chunk-SQBTIMWF.js';import'../chunk-7MNDQU6K.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as default}from'./chunk-RPRGGGIW.js';import'./chunk-YENNL5HG.js';import'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkKZHXYXSH_cjs=require('./chunk-KZHXYXSH.cjs');require('./chunk-MCIZG4A3.cjs'),require('./chunk-BUNLC3II.cjs');module.exports=chunkKZHXYXSH_cjs.a;
|
package/dist/graphql/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export{H as RelationLoader,J as buildGraphQLSchema,K as createGraphQLSchema,I as depthLimit,G as printSchema}from'../chunk-ZMG7Z3KF.js';import'../chunk-RTHJ6SS5.js';import'../chunk-TBHNE4VV.js';import'../chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|