@effect-auth/core 0.1.0-alpha.1 → 0.1.0-alpha.13
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 +790 -73
- package/dist/ApiKey.d.ts +207 -0
- package/dist/ApiKey.d.ts.map +1 -0
- package/dist/ApiKey.js +275 -0
- package/dist/ApiKey.js.map +1 -0
- package/dist/AuditLog.d.ts +335 -1
- package/dist/AuditLog.d.ts.map +1 -1
- package/dist/AuditLog.js +318 -1
- package/dist/AuditLog.js.map +1 -1
- package/dist/AuthConfig.d.ts +42 -0
- package/dist/AuthConfig.d.ts.map +1 -0
- package/dist/AuthConfig.js +43 -0
- package/dist/AuthConfig.js.map +1 -0
- package/dist/AuthFlow.d.ts +462 -36
- package/dist/AuthFlow.d.ts.map +1 -1
- package/dist/AuthFlow.js +657 -5
- package/dist/AuthFlow.js.map +1 -1
- package/dist/AuthKernel.d.ts +3 -0
- package/dist/AuthKernel.d.ts.map +1 -0
- package/dist/AuthKernel.js +9 -0
- package/dist/AuthKernel.js.map +1 -0
- package/dist/Challenge.d.ts +24 -4
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js +167 -1
- package/dist/Challenge.js.map +1 -1
- package/dist/Client.d.ts +449 -0
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +985 -0
- package/dist/Client.js.map +1 -0
- package/dist/Crypto.d.ts +6 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +62 -1
- package/dist/Crypto.js.map +1 -1
- package/dist/DomainVerification.d.ts +200 -0
- package/dist/DomainVerification.d.ts.map +1 -0
- package/dist/DomainVerification.js +304 -0
- package/dist/DomainVerification.js.map +1 -0
- package/dist/EffectQbSqliteStorage.d.ts +985 -0
- package/dist/EffectQbSqliteStorage.d.ts.map +1 -0
- package/dist/EffectQbSqliteStorage.js +2824 -0
- package/dist/EffectQbSqliteStorage.js.map +1 -0
- package/dist/EmailOtp.d.ts +120 -0
- package/dist/EmailOtp.d.ts.map +1 -0
- package/dist/EmailOtp.js +286 -0
- package/dist/EmailOtp.js.map +1 -0
- package/dist/EmailVerification.d.ts +121 -0
- package/dist/EmailVerification.d.ts.map +1 -0
- package/dist/EmailVerification.js +200 -0
- package/dist/EmailVerification.js.map +1 -0
- package/dist/HttpApi/Api.d.ts +2410 -0
- package/dist/HttpApi/Api.d.ts.map +1 -0
- package/dist/HttpApi/Api.js +3026 -0
- package/dist/HttpApi/Api.js.map +1 -0
- package/dist/HttpApi/Endpoints.d.ts +1073 -0
- package/dist/HttpApi/Endpoints.d.ts.map +1 -0
- package/dist/HttpApi/Endpoints.js +428 -0
- package/dist/HttpApi/Endpoints.js.map +1 -0
- package/dist/HttpApi/Errors.d.ts +114 -0
- package/dist/HttpApi/Errors.d.ts.map +1 -0
- package/dist/HttpApi/Errors.js +230 -0
- package/dist/HttpApi/Errors.js.map +1 -0
- package/dist/HttpApi/Schemas.d.ts +1254 -0
- package/dist/HttpApi/Schemas.d.ts.map +1 -0
- package/dist/HttpApi/Schemas.js +862 -0
- package/dist/HttpApi/Schemas.js.map +1 -0
- package/dist/HttpApi/Security.d.ts +159 -0
- package/dist/HttpApi/Security.d.ts.map +1 -0
- package/dist/HttpApi/Security.js +530 -0
- package/dist/HttpApi/Security.js.map +1 -0
- package/dist/HttpApi/Transport.d.ts +65 -0
- package/dist/HttpApi/Transport.d.ts.map +1 -0
- package/dist/HttpApi/Transport.js +311 -0
- package/dist/HttpApi/Transport.js.map +1 -0
- package/dist/HttpApi/index.d.ts +8 -0
- package/dist/HttpApi/index.d.ts.map +1 -0
- package/dist/HttpApi/index.js +7 -0
- package/dist/HttpApi/index.js.map +1 -0
- package/dist/HttpApi.d.ts +2 -0
- package/dist/HttpApi.d.ts.map +1 -0
- package/dist/HttpApi.js +2 -0
- package/dist/HttpApi.js.map +1 -0
- package/dist/Identifiers.d.ts +3 -0
- package/dist/Identifiers.d.ts.map +1 -1
- package/dist/Identifiers.js +2 -0
- package/dist/Identifiers.js.map +1 -1
- package/dist/IncidentAction.d.ts +80 -0
- package/dist/IncidentAction.d.ts.map +1 -0
- package/dist/IncidentAction.js +158 -0
- package/dist/IncidentAction.js.map +1 -0
- package/dist/Internal.d.ts +7 -0
- package/dist/Internal.d.ts.map +1 -0
- package/dist/Internal.js +12 -0
- package/dist/Internal.js.map +1 -0
- package/dist/Jwt.d.ts +281 -0
- package/dist/Jwt.d.ts.map +1 -0
- package/dist/Jwt.js +721 -0
- package/dist/Jwt.js.map +1 -0
- package/dist/LoginApproval.d.ts +314 -0
- package/dist/LoginApproval.d.ts.map +1 -0
- package/dist/LoginApproval.js +551 -0
- package/dist/LoginApproval.js.map +1 -0
- package/dist/LoginNotification.d.ts +183 -0
- package/dist/LoginNotification.d.ts.map +1 -0
- package/dist/LoginNotification.js +329 -0
- package/dist/LoginNotification.js.map +1 -0
- package/dist/LoginRisk.d.ts +344 -0
- package/dist/LoginRisk.d.ts.map +1 -0
- package/dist/LoginRisk.js +484 -0
- package/dist/LoginRisk.js.map +1 -0
- package/dist/MachineAuth.d.ts +73 -0
- package/dist/MachineAuth.d.ts.map +1 -0
- package/dist/MachineAuth.js +147 -0
- package/dist/MachineAuth.js.map +1 -0
- package/dist/MagicLink.d.ts +85 -0
- package/dist/MagicLink.d.ts.map +1 -0
- package/dist/MagicLink.js +206 -0
- package/dist/MagicLink.js.map +1 -0
- package/dist/Mailer.d.ts +147 -0
- package/dist/Mailer.d.ts.map +1 -0
- package/dist/Mailer.js +208 -0
- package/dist/Mailer.js.map +1 -0
- package/dist/OAuth.d.ts +1890 -0
- package/dist/OAuth.d.ts.map +1 -0
- package/dist/OAuth.js +3063 -0
- package/dist/OAuth.js.map +1 -0
- package/dist/Passkey.d.ts +334 -0
- package/dist/Passkey.d.ts.map +1 -0
- package/dist/Passkey.js +422 -0
- package/dist/Passkey.js.map +1 -0
- package/dist/PasskeySimpleWebAuthn.d.ts +11 -0
- package/dist/PasskeySimpleWebAuthn.d.ts.map +1 -0
- package/dist/PasskeySimpleWebAuthn.js +181 -0
- package/dist/PasskeySimpleWebAuthn.js.map +1 -0
- package/dist/Password.d.ts +237 -0
- package/dist/Password.d.ts.map +1 -0
- package/dist/Password.js +641 -0
- package/dist/Password.js.map +1 -0
- package/dist/Policy.d.ts +7 -4
- package/dist/Policy.d.ts.map +1 -1
- package/dist/Policy.js +28 -5
- package/dist/Policy.js.map +1 -1
- package/dist/Privacy.d.ts +15 -0
- package/dist/Privacy.d.ts.map +1 -1
- package/dist/Privacy.js +58 -1
- package/dist/Privacy.js.map +1 -1
- package/dist/RateLimiter.d.ts +104 -0
- package/dist/RateLimiter.d.ts.map +1 -0
- package/dist/RateLimiter.js +118 -0
- package/dist/RateLimiter.js.map +1 -0
- package/dist/RecoveryCode.d.ts +169 -0
- package/dist/RecoveryCode.d.ts.map +1 -0
- package/dist/RecoveryCode.js +299 -0
- package/dist/RecoveryCode.js.map +1 -0
- package/dist/RefreshToken.d.ts +222 -0
- package/dist/RefreshToken.d.ts.map +1 -0
- package/dist/RefreshToken.js +342 -0
- package/dist/RefreshToken.js.map +1 -0
- package/dist/Retention.d.ts +98 -0
- package/dist/Retention.d.ts.map +1 -0
- package/dist/Retention.js +204 -0
- package/dist/Retention.js.map +1 -0
- package/dist/SecurityTimeline.d.ts +78 -0
- package/dist/SecurityTimeline.d.ts.map +1 -0
- package/dist/SecurityTimeline.js +461 -0
- package/dist/SecurityTimeline.js.map +1 -0
- package/dist/Sessions.d.ts +123 -11
- package/dist/Sessions.d.ts.map +1 -1
- package/dist/Sessions.js +534 -1
- package/dist/Sessions.js.map +1 -1
- package/dist/StepUp.d.ts +44 -0
- package/dist/StepUp.d.ts.map +1 -0
- package/dist/StepUp.js +82 -0
- package/dist/StepUp.js.map +1 -0
- package/dist/Storage.d.ts +73 -5
- package/dist/Storage.d.ts.map +1 -1
- package/dist/Storage.js +11 -1
- package/dist/Storage.js.map +1 -1
- package/dist/StorageMigrations.d.ts +23 -1
- package/dist/StorageMigrations.d.ts.map +1 -1
- package/dist/StorageMigrations.js +462 -2
- package/dist/StorageMigrations.js.map +1 -1
- package/dist/Testing.d.ts +9 -1
- package/dist/Testing.d.ts.map +1 -1
- package/dist/Testing.js +30 -2
- package/dist/Testing.js.map +1 -1
- package/dist/Totp.d.ts +220 -0
- package/dist/Totp.d.ts.map +1 -0
- package/dist/Totp.js +477 -0
- package/dist/Totp.js.map +1 -0
- package/dist/TrustedDevice.d.ts +127 -0
- package/dist/TrustedDevice.d.ts.map +1 -0
- package/dist/TrustedDevice.js +252 -0
- package/dist/TrustedDevice.js.map +1 -0
- package/dist/WaitUntil.d.ts.map +1 -1
- package/dist/WaitUntil.js +1 -1
- package/dist/WaitUntil.js.map +1 -1
- package/dist/Webhook.d.ts +380 -0
- package/dist/Webhook.d.ts.map +1 -0
- package/dist/Webhook.js +592 -0
- package/dist/Webhook.js.map +1 -0
- package/dist/alchemy/cloudflare/Email.d.ts +25 -0
- package/dist/alchemy/cloudflare/Email.d.ts.map +1 -0
- package/dist/alchemy/cloudflare/Email.js +117 -0
- package/dist/alchemy/cloudflare/Email.js.map +1 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts +34 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.d.ts.map +1 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.js +30 -0
- package/dist/alchemy/cloudflare/RateLimitDurableObject.js.map +1 -0
- package/dist/cloudflare/Email.d.ts +25 -0
- package/dist/cloudflare/Email.d.ts.map +1 -0
- package/dist/cloudflare/Email.js +153 -0
- package/dist/cloudflare/Email.js.map +1 -0
- package/dist/cloudflare/RateLimitDurableObject.d.ts +50 -0
- package/dist/cloudflare/RateLimitDurableObject.d.ts.map +1 -0
- package/dist/cloudflare/RateLimitDurableObject.js +51 -0
- package/dist/cloudflare/RateLimitDurableObject.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/RateLimitDurableObject.d.ts +32 -0
- package/dist/internal/RateLimitDurableObject.d.ts.map +1 -0
- package/dist/internal/RateLimitDurableObject.js +80 -0
- package/dist/internal/RateLimitDurableObject.js.map +1 -0
- package/migrations/0002_auth_password.sql +25 -0
- package/migrations/0003_auth_login_approval_review.sql +22 -0
- package/migrations/0004_auth_trusted_device.sql +12 -0
- package/migrations/0005_auth_passkey.sql +17 -0
- package/migrations/0006_auth_totp_factor.sql +17 -0
- package/migrations/0007_auth_recovery_code.sql +13 -0
- package/migrations/0008_auth_api_key.sql +17 -0
- package/migrations/0009_auth_refresh_token.sql +21 -0
- package/migrations/0010_auth_jwt_revocation.sql +8 -0
- package/migrations/0011_auth_oauth_account.sql +16 -0
- package/migrations/0012_auth_oauth_provider_token_vault.sql +20 -0
- package/migrations/0013_auth_security_timeline.sql +16 -0
- package/migrations/0014_auth_webhook_outbox.sql +16 -0
- package/migrations/0015_auth_webhook_replay.sql +7 -0
- package/migrations/0016_auth_login_risk_history.sql +23 -0
- package/migrations/0017_auth_audit_log.sql +17 -0
- package/migrations/0018_auth_domain_verification.sql +18 -0
- package/migrations/0019_auth_oauth_authorization_code.sql +17 -0
- package/migrations/0020_auth_oauth_provider_mode_token.sql +24 -0
- package/migrations/0021_auth_oauth_client_secret.sql +14 -0
- package/migrations/0022_auth_oauth_client.sql +15 -0
- package/migrations/0023_auth_oauth_consent.sql +15 -0
- package/package.json +162 -26
- package/dist/D1Kysely.d.ts +0 -40
- package/dist/D1Kysely.d.ts.map +0 -1
- package/dist/D1Kysely.js +0 -75
- package/dist/D1Kysely.js.map +0 -1
- package/dist/KyselyStorage.d.ts +0 -41
- package/dist/KyselyStorage.d.ts.map +0 -1
- package/dist/KyselyStorage.js +0 -176
- package/dist/KyselyStorage.js.map +0 -1
|
@@ -31,7 +31,467 @@ create table if not exists auth_verification (
|
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
create index if not exists auth_verification_type_subject_idx on auth_verification (type, subject);
|
|
34
|
-
create index if not exists auth_verification_expires_at_idx on auth_verification (expires_at)
|
|
34
|
+
create index if not exists auth_verification_expires_at_idx on auth_verification (expires_at);`,
|
|
35
35
|
};
|
|
36
|
-
export const
|
|
36
|
+
export const authStorageMigration002 = {
|
|
37
|
+
id: "0002_auth_password",
|
|
38
|
+
sql: `create table if not exists auth_user (
|
|
39
|
+
id text primary key,
|
|
40
|
+
email text not null,
|
|
41
|
+
email_verified integer not null,
|
|
42
|
+
created_at integer not null,
|
|
43
|
+
updated_at integer not null,
|
|
44
|
+
disabled_at integer,
|
|
45
|
+
metadata text
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
create unique index if not exists auth_user_email_idx on auth_user (email);
|
|
49
|
+
|
|
50
|
+
create table if not exists auth_credential (
|
|
51
|
+
id text primary key,
|
|
52
|
+
user_id text not null,
|
|
53
|
+
type text not null,
|
|
54
|
+
password_hash text,
|
|
55
|
+
created_at integer not null,
|
|
56
|
+
updated_at integer not null,
|
|
57
|
+
revoked_at integer,
|
|
58
|
+
metadata text
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
create index if not exists auth_credential_user_id_idx on auth_credential (user_id);
|
|
62
|
+
create unique index if not exists auth_credential_user_type_idx on auth_credential (user_id, type);`,
|
|
63
|
+
};
|
|
64
|
+
export const authStorageMigration003 = {
|
|
65
|
+
id: "0003_auth_login_approval_review",
|
|
66
|
+
sql: `create table if not exists auth_login_approval_review (
|
|
67
|
+
approval_challenge_id text primary key,
|
|
68
|
+
flow_id text not null,
|
|
69
|
+
user_id text not null,
|
|
70
|
+
channel text not null,
|
|
71
|
+
reason text not null,
|
|
72
|
+
session_binding text not null,
|
|
73
|
+
same_device_required integer not null,
|
|
74
|
+
status text not null,
|
|
75
|
+
created_at integer not null,
|
|
76
|
+
expires_at integer not null,
|
|
77
|
+
reviewed_at integer,
|
|
78
|
+
reviewed_by text,
|
|
79
|
+
denied_reason text,
|
|
80
|
+
risk text,
|
|
81
|
+
metadata text,
|
|
82
|
+
review_metadata text
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
create index if not exists auth_login_approval_review_flow_id_idx on auth_login_approval_review (flow_id);
|
|
86
|
+
create index if not exists auth_login_approval_review_user_id_idx on auth_login_approval_review (user_id);
|
|
87
|
+
create index if not exists auth_login_approval_review_status_expires_at_idx on auth_login_approval_review (status, expires_at);`,
|
|
88
|
+
};
|
|
89
|
+
export const authStorageMigration004 = {
|
|
90
|
+
id: "0004_auth_trusted_device",
|
|
91
|
+
sql: `create table if not exists auth_trusted_device (
|
|
92
|
+
user_id text not null,
|
|
93
|
+
token_hash text not null,
|
|
94
|
+
created_at integer not null,
|
|
95
|
+
last_seen_at integer not null,
|
|
96
|
+
expires_at integer not null,
|
|
97
|
+
metadata text,
|
|
98
|
+
primary key (user_id, token_hash)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
create index if not exists auth_trusted_device_user_id_idx on auth_trusted_device (user_id);
|
|
102
|
+
create index if not exists auth_trusted_device_expires_at_idx on auth_trusted_device (expires_at);`,
|
|
103
|
+
};
|
|
104
|
+
export const authStorageMigration005 = {
|
|
105
|
+
id: "0005_auth_passkey",
|
|
106
|
+
sql: `create table if not exists auth_passkey_credential (
|
|
107
|
+
id text primary key,
|
|
108
|
+
user_id text not null,
|
|
109
|
+
credential_id text not null,
|
|
110
|
+
public_key text not null,
|
|
111
|
+
sign_count integer not null,
|
|
112
|
+
transports text,
|
|
113
|
+
backed_up integer,
|
|
114
|
+
created_at integer not null,
|
|
115
|
+
last_used_at integer,
|
|
116
|
+
revoked_at integer,
|
|
117
|
+
metadata text
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
create unique index if not exists auth_passkey_credential_credential_id_idx on auth_passkey_credential (credential_id);
|
|
121
|
+
create index if not exists auth_passkey_credential_user_id_idx on auth_passkey_credential (user_id);
|
|
122
|
+
create index if not exists auth_passkey_credential_revoked_at_idx on auth_passkey_credential (revoked_at);`,
|
|
123
|
+
};
|
|
124
|
+
export const authStorageMigration006 = {
|
|
125
|
+
id: "0006_auth_totp_factor",
|
|
126
|
+
sql: `create table if not exists auth_totp_factor (
|
|
127
|
+
id text primary key,
|
|
128
|
+
user_id text not null,
|
|
129
|
+
secret text not null,
|
|
130
|
+
algorithm text not null,
|
|
131
|
+
digits integer not null,
|
|
132
|
+
period integer not null,
|
|
133
|
+
created_at integer not null,
|
|
134
|
+
confirmed_at integer,
|
|
135
|
+
last_used_at integer,
|
|
136
|
+
revoked_at integer,
|
|
137
|
+
metadata text
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
create index if not exists auth_totp_factor_user_id_idx on auth_totp_factor (user_id);
|
|
141
|
+
create index if not exists auth_totp_factor_confirmed_at_idx on auth_totp_factor (confirmed_at);
|
|
142
|
+
create index if not exists auth_totp_factor_revoked_at_idx on auth_totp_factor (revoked_at);`,
|
|
143
|
+
};
|
|
144
|
+
export const authStorageMigration007 = {
|
|
145
|
+
id: "0007_auth_recovery_code",
|
|
146
|
+
sql: `create table if not exists auth_recovery_code (
|
|
147
|
+
id text primary key,
|
|
148
|
+
user_id text not null,
|
|
149
|
+
code_hash text not null,
|
|
150
|
+
created_at integer not null,
|
|
151
|
+
used_at integer,
|
|
152
|
+
revoked_at integer,
|
|
153
|
+
metadata text
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
create index if not exists auth_recovery_code_user_id_idx on auth_recovery_code (user_id);
|
|
157
|
+
create index if not exists auth_recovery_code_used_at_idx on auth_recovery_code (used_at);
|
|
158
|
+
create index if not exists auth_recovery_code_revoked_at_idx on auth_recovery_code (revoked_at);`,
|
|
159
|
+
};
|
|
160
|
+
export const authStorageMigration008 = {
|
|
161
|
+
id: "0008_auth_api_key",
|
|
162
|
+
sql: `create table if not exists auth_api_key (
|
|
163
|
+
id text primary key,
|
|
164
|
+
user_id text not null,
|
|
165
|
+
prefix text not null,
|
|
166
|
+
secret_hash text not null,
|
|
167
|
+
scopes text not null,
|
|
168
|
+
created_at integer not null,
|
|
169
|
+
expires_at integer,
|
|
170
|
+
last_used_at integer,
|
|
171
|
+
revoked_at integer,
|
|
172
|
+
metadata text
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
create unique index if not exists auth_api_key_prefix_idx on auth_api_key (prefix);
|
|
176
|
+
create index if not exists auth_api_key_user_id_idx on auth_api_key (user_id);
|
|
177
|
+
create index if not exists auth_api_key_expires_at_idx on auth_api_key (expires_at);
|
|
178
|
+
create index if not exists auth_api_key_revoked_at_idx on auth_api_key (revoked_at);`,
|
|
179
|
+
};
|
|
180
|
+
export const authStorageMigration009 = {
|
|
181
|
+
id: "0009_auth_refresh_token",
|
|
182
|
+
sql: `create table if not exists auth_refresh_token (
|
|
183
|
+
id text primary key,
|
|
184
|
+
family_id text not null,
|
|
185
|
+
user_id text not null,
|
|
186
|
+
secret_hash text not null,
|
|
187
|
+
created_at integer not null,
|
|
188
|
+
expires_at integer not null,
|
|
189
|
+
last_used_at integer,
|
|
190
|
+
rotated_at integer,
|
|
191
|
+
replaced_by_id text,
|
|
192
|
+
revoked_at integer,
|
|
193
|
+
reuse_detected_at integer,
|
|
194
|
+
metadata text
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
create unique index if not exists auth_refresh_token_secret_hash_idx on auth_refresh_token (secret_hash);
|
|
198
|
+
create index if not exists auth_refresh_token_family_id_idx on auth_refresh_token (family_id);
|
|
199
|
+
create index if not exists auth_refresh_token_user_id_idx on auth_refresh_token (user_id);
|
|
200
|
+
create index if not exists auth_refresh_token_expires_at_idx on auth_refresh_token (expires_at);
|
|
201
|
+
create index if not exists auth_refresh_token_rotated_at_idx on auth_refresh_token (rotated_at);
|
|
202
|
+
create index if not exists auth_refresh_token_revoked_at_idx on auth_refresh_token (revoked_at);`,
|
|
203
|
+
};
|
|
204
|
+
export const authStorageMigration010 = {
|
|
205
|
+
id: "0010_auth_jwt_revocation",
|
|
206
|
+
sql: `create table if not exists auth_jwt_revocation (
|
|
207
|
+
jwt_id text primary key,
|
|
208
|
+
revoked_at integer not null,
|
|
209
|
+
expires_at integer,
|
|
210
|
+
reason text
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
create index if not exists auth_jwt_revocation_expires_at_idx on auth_jwt_revocation (expires_at);`,
|
|
214
|
+
};
|
|
215
|
+
export const authStorageMigration011 = {
|
|
216
|
+
id: "0011_auth_oauth_account",
|
|
217
|
+
sql: `create table if not exists auth_oauth_account (
|
|
218
|
+
id text primary key,
|
|
219
|
+
provider_id text not null,
|
|
220
|
+
provider_account_id text not null,
|
|
221
|
+
user_id text not null,
|
|
222
|
+
email text,
|
|
223
|
+
email_verified integer,
|
|
224
|
+
created_at integer not null,
|
|
225
|
+
updated_at integer not null,
|
|
226
|
+
unlinked_at integer,
|
|
227
|
+
metadata text
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
create unique index if not exists auth_oauth_account_provider_account_idx on auth_oauth_account (provider_id, provider_account_id);
|
|
231
|
+
create index if not exists auth_oauth_account_user_id_idx on auth_oauth_account (user_id);
|
|
232
|
+
create index if not exists auth_oauth_account_unlinked_at_idx on auth_oauth_account (unlinked_at);`,
|
|
233
|
+
};
|
|
234
|
+
export const authStorageMigration012 = {
|
|
235
|
+
id: "0012_auth_oauth_provider_token_vault",
|
|
236
|
+
sql: `create table if not exists auth_oauth_provider_token_vault (
|
|
237
|
+
account_id text primary key,
|
|
238
|
+
user_id text not null,
|
|
239
|
+
provider_id text not null,
|
|
240
|
+
provider_account_id text not null,
|
|
241
|
+
access_token_ciphertext text not null,
|
|
242
|
+
refresh_token_ciphertext text,
|
|
243
|
+
id_token_ciphertext text,
|
|
244
|
+
token_type text not null,
|
|
245
|
+
scopes text,
|
|
246
|
+
expires_at integer,
|
|
247
|
+
updated_at integer not null,
|
|
248
|
+
revoked_at integer,
|
|
249
|
+
revocation_reason text
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
create index if not exists auth_oauth_provider_token_vault_user_id_idx on auth_oauth_provider_token_vault (user_id);
|
|
253
|
+
create index if not exists auth_oauth_provider_token_vault_provider_account_idx on auth_oauth_provider_token_vault (provider_id, provider_account_id);
|
|
254
|
+
create index if not exists auth_oauth_provider_token_vault_expires_at_idx on auth_oauth_provider_token_vault (expires_at);
|
|
255
|
+
create index if not exists auth_oauth_provider_token_vault_revoked_at_idx on auth_oauth_provider_token_vault (revoked_at);`,
|
|
256
|
+
};
|
|
257
|
+
export const authStorageMigration013 = {
|
|
258
|
+
id: "0013_auth_security_timeline",
|
|
259
|
+
sql: `create table if not exists auth_security_timeline (
|
|
260
|
+
id text primary key,
|
|
261
|
+
user_id text not null,
|
|
262
|
+
type text not null,
|
|
263
|
+
category text not null,
|
|
264
|
+
severity text not null,
|
|
265
|
+
occurred_at integer not null,
|
|
266
|
+
summary text not null,
|
|
267
|
+
actor text,
|
|
268
|
+
request text,
|
|
269
|
+
metadata text
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
create index if not exists auth_security_timeline_user_occurred_at_idx on auth_security_timeline (user_id, occurred_at);
|
|
273
|
+
create index if not exists auth_security_timeline_type_idx on auth_security_timeline (type);
|
|
274
|
+
create index if not exists auth_security_timeline_category_idx on auth_security_timeline (category);`,
|
|
275
|
+
};
|
|
276
|
+
export const authStorageMigration014 = {
|
|
277
|
+
id: "0014_auth_webhook_outbox",
|
|
278
|
+
sql: `create table if not exists auth_webhook_outbox (
|
|
279
|
+
id text primary key,
|
|
280
|
+
endpoint_key text not null,
|
|
281
|
+
event text not null,
|
|
282
|
+
status text not null,
|
|
283
|
+
attempts integer not null,
|
|
284
|
+
next_attempt_at integer not null,
|
|
285
|
+
created_at integer not null,
|
|
286
|
+
updated_at integer not null,
|
|
287
|
+
delivered_at integer,
|
|
288
|
+
last_error text
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
create index if not exists auth_webhook_outbox_due_idx on auth_webhook_outbox (next_attempt_at, status);
|
|
292
|
+
create index if not exists auth_webhook_outbox_endpoint_due_idx on auth_webhook_outbox (endpoint_key, next_attempt_at);
|
|
293
|
+
create index if not exists auth_webhook_outbox_status_idx on auth_webhook_outbox (status);`,
|
|
294
|
+
};
|
|
295
|
+
export const authStorageMigration015 = {
|
|
296
|
+
id: "0015_auth_webhook_replay",
|
|
297
|
+
sql: `create table if not exists auth_webhook_replay (
|
|
298
|
+
id text primary key,
|
|
299
|
+
expires_at integer not null,
|
|
300
|
+
created_at integer not null
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
create index if not exists auth_webhook_replay_expires_at_idx on auth_webhook_replay (expires_at);`,
|
|
304
|
+
};
|
|
305
|
+
export const authStorageMigration016 = {
|
|
306
|
+
id: "0016_auth_login_risk_history",
|
|
307
|
+
sql: `create table if not exists auth_login_risk_history (
|
|
308
|
+
id text primary key,
|
|
309
|
+
user_id text not null,
|
|
310
|
+
occurred_at integer not null,
|
|
311
|
+
outcome text not null,
|
|
312
|
+
method text not null,
|
|
313
|
+
amr text not null,
|
|
314
|
+
aal text not null,
|
|
315
|
+
device_status text not null,
|
|
316
|
+
device_key text,
|
|
317
|
+
location_key text,
|
|
318
|
+
country text,
|
|
319
|
+
region text,
|
|
320
|
+
latitude_micro integer,
|
|
321
|
+
longitude_micro integer,
|
|
322
|
+
risk_level text,
|
|
323
|
+
created_at integer not null
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
create index if not exists auth_login_risk_history_user_occurred_at_idx on auth_login_risk_history (user_id, occurred_at);
|
|
327
|
+
create index if not exists auth_login_risk_history_user_device_key_idx on auth_login_risk_history (user_id, device_key);
|
|
328
|
+
create index if not exists auth_login_risk_history_user_location_key_idx on auth_login_risk_history (user_id, location_key);
|
|
329
|
+
create index if not exists auth_login_risk_history_occurred_at_idx on auth_login_risk_history (occurred_at);`,
|
|
330
|
+
};
|
|
331
|
+
export const authStorageMigration017 = {
|
|
332
|
+
id: "0017_auth_audit_log",
|
|
333
|
+
sql: `create table if not exists auth_audit_log (
|
|
334
|
+
id text,
|
|
335
|
+
type text not null,
|
|
336
|
+
user_id text,
|
|
337
|
+
actor_user_id text,
|
|
338
|
+
occurred_at integer not null,
|
|
339
|
+
request_ip_hash text,
|
|
340
|
+
request_user_agent_hash text,
|
|
341
|
+
event text not null,
|
|
342
|
+
created_at integer not null
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
create index if not exists auth_audit_log_id_idx on auth_audit_log (id);
|
|
346
|
+
create index if not exists auth_audit_log_user_occurred_at_idx on auth_audit_log (user_id, occurred_at);
|
|
347
|
+
create index if not exists auth_audit_log_actor_user_occurred_at_idx on auth_audit_log (actor_user_id, occurred_at);
|
|
348
|
+
create index if not exists auth_audit_log_type_occurred_at_idx on auth_audit_log (type, occurred_at);
|
|
349
|
+
create index if not exists auth_audit_log_occurred_at_idx on auth_audit_log (occurred_at);`,
|
|
350
|
+
};
|
|
351
|
+
export const authStorageMigration018 = {
|
|
352
|
+
id: "0018_auth_domain_verification",
|
|
353
|
+
sql: `create table if not exists auth_domain_verification (
|
|
354
|
+
id text primary key,
|
|
355
|
+
owner_id text not null,
|
|
356
|
+
domain text not null,
|
|
357
|
+
proof_method text not null,
|
|
358
|
+
proof_token text not null,
|
|
359
|
+
status text not null,
|
|
360
|
+
created_at integer not null,
|
|
361
|
+
expires_at integer not null,
|
|
362
|
+
verified_at integer,
|
|
363
|
+
revoked_at integer,
|
|
364
|
+
last_checked_at integer,
|
|
365
|
+
metadata text
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
create unique index if not exists auth_domain_verification_owner_domain_idx on auth_domain_verification (owner_id, domain);
|
|
369
|
+
create index if not exists auth_domain_verification_domain_idx on auth_domain_verification (domain);
|
|
370
|
+
create index if not exists auth_domain_verification_status_expires_at_idx on auth_domain_verification (status, expires_at);`,
|
|
371
|
+
};
|
|
372
|
+
export const authStorageMigration019 = {
|
|
373
|
+
id: "0019_auth_oauth_authorization_code",
|
|
374
|
+
sql: `create table if not exists auth_oauth_authorization_code (
|
|
375
|
+
code_hash text primary key,
|
|
376
|
+
client_id text not null,
|
|
377
|
+
subject text not null,
|
|
378
|
+
redirect_uri text not null,
|
|
379
|
+
scopes text not null,
|
|
380
|
+
code_challenge text,
|
|
381
|
+
code_challenge_method text,
|
|
382
|
+
issued_at integer not null,
|
|
383
|
+
expires_at integer not null,
|
|
384
|
+
consumed_at integer,
|
|
385
|
+
metadata text
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
create index if not exists auth_oauth_authorization_code_client_expires_at_idx on auth_oauth_authorization_code (client_id, expires_at);
|
|
389
|
+
create index if not exists auth_oauth_authorization_code_expires_at_idx on auth_oauth_authorization_code (expires_at);
|
|
390
|
+
create index if not exists auth_oauth_authorization_code_consumed_at_idx on auth_oauth_authorization_code (consumed_at);`,
|
|
391
|
+
};
|
|
392
|
+
export const authStorageMigration020 = {
|
|
393
|
+
id: "0020_auth_oauth_provider_mode_token",
|
|
394
|
+
sql: `create table if not exists auth_oauth_provider_mode_token (
|
|
395
|
+
token_hash text primary key,
|
|
396
|
+
token_type text not null,
|
|
397
|
+
client_id text not null,
|
|
398
|
+
subject text not null,
|
|
399
|
+
scopes text not null,
|
|
400
|
+
issued_at integer not null,
|
|
401
|
+
expires_at integer not null,
|
|
402
|
+
issuer text,
|
|
403
|
+
audience text,
|
|
404
|
+
jwt_id text,
|
|
405
|
+
revoked_at integer,
|
|
406
|
+
revocation_reason text,
|
|
407
|
+
rotated_at integer,
|
|
408
|
+
replaced_by_token_hash text,
|
|
409
|
+
metadata text
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
create index if not exists auth_oauth_provider_mode_token_client_expires_at_idx on auth_oauth_provider_mode_token (client_id, expires_at);
|
|
413
|
+
create index if not exists auth_oauth_provider_mode_token_subject_idx on auth_oauth_provider_mode_token (subject);
|
|
414
|
+
create index if not exists auth_oauth_provider_mode_token_expires_at_idx on auth_oauth_provider_mode_token (expires_at);
|
|
415
|
+
create index if not exists auth_oauth_provider_mode_token_revoked_at_idx on auth_oauth_provider_mode_token (revoked_at);
|
|
416
|
+
create index if not exists auth_oauth_provider_mode_token_rotated_at_idx on auth_oauth_provider_mode_token (rotated_at);
|
|
417
|
+
create index if not exists auth_oauth_provider_mode_token_jwt_id_idx on auth_oauth_provider_mode_token (jwt_id);`,
|
|
418
|
+
};
|
|
419
|
+
export const authStorageMigration021 = {
|
|
420
|
+
id: "0021_auth_oauth_client_secret",
|
|
421
|
+
sql: `create table if not exists auth_oauth_client_secret (
|
|
422
|
+
prefix text primary key,
|
|
423
|
+
client_id text not null,
|
|
424
|
+
secret_hash text not null,
|
|
425
|
+
authentication_methods text not null,
|
|
426
|
+
created_at integer not null,
|
|
427
|
+
expires_at integer,
|
|
428
|
+
last_used_at integer,
|
|
429
|
+
revoked_at integer,
|
|
430
|
+
metadata text
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
create index if not exists auth_oauth_client_secret_client_prefix_idx on auth_oauth_client_secret (client_id, prefix);
|
|
434
|
+
create index if not exists auth_oauth_client_secret_client_id_idx on auth_oauth_client_secret (client_id);`,
|
|
435
|
+
};
|
|
436
|
+
export const authStorageMigration022 = {
|
|
437
|
+
id: "0022_auth_oauth_client",
|
|
438
|
+
sql: `create table if not exists auth_oauth_client (
|
|
439
|
+
id text primary key,
|
|
440
|
+
type text not null,
|
|
441
|
+
status text not null,
|
|
442
|
+
name text,
|
|
443
|
+
redirect_uris text not null,
|
|
444
|
+
allowed_grant_types text not null,
|
|
445
|
+
allowed_response_types text not null,
|
|
446
|
+
allowed_scopes text,
|
|
447
|
+
created_at integer,
|
|
448
|
+
updated_at integer,
|
|
449
|
+
metadata text
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
create index if not exists auth_oauth_client_status_idx on auth_oauth_client (status);`,
|
|
453
|
+
};
|
|
454
|
+
export const authStorageMigration023 = {
|
|
455
|
+
id: "0023_auth_oauth_consent",
|
|
456
|
+
sql: `create table if not exists auth_oauth_consent (
|
|
457
|
+
id text primary key,
|
|
458
|
+
user_id text not null,
|
|
459
|
+
client_id text not null,
|
|
460
|
+
scopes text not null,
|
|
461
|
+
granted_at integer not null,
|
|
462
|
+
expires_at integer,
|
|
463
|
+
revoked_at integer,
|
|
464
|
+
metadata text
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
create unique index if not exists auth_oauth_consent_user_client_idx on auth_oauth_consent (user_id, client_id);
|
|
468
|
+
create index if not exists auth_oauth_consent_user_id_idx on auth_oauth_consent (user_id);
|
|
469
|
+
create index if not exists auth_oauth_consent_expires_at_idx on auth_oauth_consent (expires_at);
|
|
470
|
+
create index if not exists auth_oauth_consent_revoked_at_idx on auth_oauth_consent (revoked_at);`,
|
|
471
|
+
};
|
|
472
|
+
export const authStorageMigrations = [
|
|
473
|
+
authStorageMigration001,
|
|
474
|
+
authStorageMigration002,
|
|
475
|
+
authStorageMigration003,
|
|
476
|
+
authStorageMigration004,
|
|
477
|
+
authStorageMigration005,
|
|
478
|
+
authStorageMigration006,
|
|
479
|
+
authStorageMigration007,
|
|
480
|
+
authStorageMigration008,
|
|
481
|
+
authStorageMigration009,
|
|
482
|
+
authStorageMigration010,
|
|
483
|
+
authStorageMigration011,
|
|
484
|
+
authStorageMigration012,
|
|
485
|
+
authStorageMigration013,
|
|
486
|
+
authStorageMigration014,
|
|
487
|
+
authStorageMigration015,
|
|
488
|
+
authStorageMigration016,
|
|
489
|
+
authStorageMigration017,
|
|
490
|
+
authStorageMigration018,
|
|
491
|
+
authStorageMigration019,
|
|
492
|
+
authStorageMigration020,
|
|
493
|
+
authStorageMigration021,
|
|
494
|
+
authStorageMigration022,
|
|
495
|
+
authStorageMigration023,
|
|
496
|
+
];
|
|
37
497
|
//# sourceMappingURL=StorageMigrations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageMigrations.js","sourceRoot":"","sources":["../src/StorageMigrations.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC3D,EAAE,EAAE,mBAAmB;IACvB,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE;;;;;;;;;;;;;;;;yHAgBkH;CACxH,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC3D,EAAE,EAAE,qCAAqC;IACzC,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;iHAuB0G;CAChH,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC3D,EAAE,EAAE,+BAA+B;IACnC,GAAG,EAAE;;;;;;;;;;;;;2GAaoG;CAC1G,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC3D,EAAE,EAAE,wBAAwB;IAC5B,GAAG,EAAE;;;;;;;;;;;;;;uFAcgF;CACtF,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IAC3D,EAAE,EAAE,yBAAyB;IAC7B,GAAG,EAAE;;;;;;;;;;;;;;iGAc0F;CAChG,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;CACf,CAAC"}
|
package/dist/Testing.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
|
-
|
|
2
|
+
import { Crypto } from "./Crypto.js";
|
|
3
|
+
import type { CryptoService } from "./Crypto.js";
|
|
4
|
+
import { PasswordHasher } from "./Password.js";
|
|
5
|
+
import type { PasswordHasherService } from "./Password.js";
|
|
6
|
+
export declare const makeTestCrypto: () => CryptoService;
|
|
7
|
+
export declare const CryptoTestLive: Layer.Layer<Crypto, never, never>;
|
|
8
|
+
export declare const makeTestPasswordHasher: () => PasswordHasherService;
|
|
9
|
+
export declare const PasswordHasherTestLive: Layer.Layer<PasswordHasher, never, never>;
|
|
10
|
+
export declare const CoreTestingLive: Layer.Layer<Crypto | import("./WaitUntil.js").WaitUntil | import("./Privacy.js").Privacy | import("./AuditLog.js").AuditLog | PasswordHasher, never, never>;
|
|
3
11
|
//# sourceMappingURL=Testing.d.ts.map
|
package/dist/Testing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Testing.d.ts","sourceRoot":"","sources":["../src/Testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Testing.d.ts","sourceRoot":"","sources":["../src/Testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAAY,MAAM,QAAQ,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAY3D,eAAO,MAAM,cAAc,QAAO,aA+BjC,CAAC;AAEF,eAAO,MAAM,cAAc,mCAA0C,CAAC;AAEtE,eAAO,MAAM,sBAAsB,QAAO,qBAQtC,CAAC;AAEL,eAAO,MAAM,sBAAsB,2CAElC,CAAC;AAEF,eAAO,MAAM,eAAe,6JAM3B,CAAC"}
|
package/dist/Testing.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
import { Layer } from "effect";
|
|
1
|
+
import { Effect, Layer, Redacted } from "effect";
|
|
2
2
|
import { AuditLogNoopLive } from "./AuditLog.js";
|
|
3
|
+
import { Crypto } from "./Crypto.js";
|
|
4
|
+
import { PasswordHasher } from "./Password.js";
|
|
3
5
|
import { PrivacyTestLive } from "./Privacy.js";
|
|
4
6
|
import { WaitUntilNoopLive } from "./WaitUntil.js";
|
|
5
|
-
|
|
7
|
+
const bytesToString = (bytes) => [...bytes].join(",");
|
|
8
|
+
const valueToString = (value) => typeof value === "string" ? value : bytesToString(value);
|
|
9
|
+
const keyToString = (key) => key instanceof Uint8Array ? bytesToString(key) : Redacted.value(key);
|
|
10
|
+
export const makeTestCrypto = () => {
|
|
11
|
+
let counter = 0;
|
|
12
|
+
return Crypto.make({
|
|
13
|
+
randomBytes: (byteLength) => Effect.sync(() => {
|
|
14
|
+
counter += 1;
|
|
15
|
+
return Uint8Array.from({ length: byteLength }, (_, index) => (counter + index) % 256);
|
|
16
|
+
}),
|
|
17
|
+
randomToken: (byteLength = 32) => Effect.sync(() => {
|
|
18
|
+
counter += 1;
|
|
19
|
+
return `test-token-${byteLength}-${counter}`;
|
|
20
|
+
}),
|
|
21
|
+
digestSha256: (input) => Effect.succeed(`test-digest:${valueToString(input.data)}`),
|
|
22
|
+
hmacSha256: (input) => Effect.succeed(`test-hmac:${keyToString(input.key)}:${valueToString(input.data)}`),
|
|
23
|
+
timingSafeEqual: (input) => Effect.succeed(input.left.length === input.right.length &&
|
|
24
|
+
input.left.every((value, index) => value === input.right[index])),
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const CryptoTestLive = Layer.succeed(Crypto)(makeTestCrypto());
|
|
28
|
+
export const makeTestPasswordHasher = () => PasswordHasher.make({
|
|
29
|
+
hash: (input) => Effect.succeed(`test-hash:${Redacted.value(input.password)}`),
|
|
30
|
+
verify: (input) => Effect.succeed(input.hash === `test-hash:${Redacted.value(input.password)}`),
|
|
31
|
+
});
|
|
32
|
+
export const PasswordHasherTestLive = Layer.succeed(PasswordHasher)(makeTestPasswordHasher());
|
|
33
|
+
export const CoreTestingLive = Layer.mergeAll(AuditLogNoopLive, CryptoTestLive, PasswordHasherTestLive, PrivacyTestLive, WaitUntilNoopLive);
|
|
6
34
|
//# sourceMappingURL=Testing.js.map
|
package/dist/Testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Testing.js","sourceRoot":"","sources":["../src/Testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"Testing.js","sourceRoot":"","sources":["../src/Testing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,KAAiB,EAAU,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1E,MAAM,aAAa,GAAG,CAAC,KAA0B,EAAU,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAE3D,MAAM,WAAW,GAAG,CAAC,GAAc,EAAU,EAAE,CAC7C,GAAG,YAAY,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAkB,EAAE;IAChD,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,OAAO,MAAM,CAAC,IAAI,CAAC;QACjB,WAAW,EAAE,CAAC,UAAU,EAAE,EAAE,CAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YAC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