@openhi/constructs 0.0.141 → 0.0.143
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/lib/index.d.mts +16 -5
- package/lib/index.d.ts +45 -5
- package/lib/index.js +25 -6
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +25 -6
- package/lib/index.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.js +762 -397
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +762 -397
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/package.json +3 -3
package/lib/index.d.mts
CHANGED
|
@@ -1688,14 +1688,20 @@ declare class OpenHiAuthService extends OpenHiService {
|
|
|
1688
1688
|
* - `https://admin{,-<childZonePrefix>}.<zone>/oauth/{callback,logout}`
|
|
1689
1689
|
* - `https://www{,-<childZonePrefix>}.<zone>/oauth/{callback,logout}`
|
|
1690
1690
|
*
|
|
1691
|
-
* Both deployed-host pairs are auto-injected on every stage.
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1691
|
+
* Both deployed-host pairs are auto-injected on every stage. The stage's
|
|
1692
|
+
* `additionalTrustedClientOrigins` entries (e.g. on-site customer SPA
|
|
1693
|
+
* hosts) are filtered to `https://`-prefix values and contribute
|
|
1694
|
+
* `/oauth/callback` + `/oauth/logout` URLs to the merge — Cognito rejects
|
|
1695
|
+
* non-localhost http callbacks, so `http://` entries are silently dropped.
|
|
1696
|
+
* On non-prod stages the localhost dev URLs from
|
|
1697
|
+
* {@link LOCALHOST_OAUTH_CALLBACK_URLS} /
|
|
1698
|
+
* {@link LOCALHOST_OAUTH_LOGOUT_URLS} join the merge; on prod they are
|
|
1694
1699
|
* deliberately excluded.
|
|
1695
1700
|
*
|
|
1696
1701
|
* If `zoneName` is absent (no-DNS test configurations), the deployed-host
|
|
1697
|
-
* pairs are skipped — only the localhost set
|
|
1698
|
-
*
|
|
1702
|
+
* pairs are skipped — only the localhost set and any configured
|
|
1703
|
+
* additional `https://` origins survive (the latter on every stage).
|
|
1704
|
+
* Override to customize.
|
|
1699
1705
|
*/
|
|
1700
1706
|
protected resolveOAuthRedirectUrls(): {
|
|
1701
1707
|
callbackUrls: Array<string>;
|
|
@@ -2028,6 +2034,11 @@ declare class OpenHiRestApiService extends OpenHiService {
|
|
|
2028
2034
|
* the website service will see at synth time. Both hostnames are
|
|
2029
2035
|
* `https://`-only — they always resolve to real DNS records.
|
|
2030
2036
|
*
|
|
2037
|
+
* The stage's `additionalTrustedClientOrigins` config entries (e.g. on-site
|
|
2038
|
+
* customer SPA hosts) are appended verbatim — both `http://` and `https://`
|
|
2039
|
+
* entries flow into CORS. Scheme filtering is OAuth-specific and happens
|
|
2040
|
+
* in `OpenHiAuthService.resolveOAuthRedirectUrls`.
|
|
2041
|
+
*
|
|
2031
2042
|
* Auto-injected on every stage (no `isNonProd` gate) so the admin SPA can
|
|
2032
2043
|
* call the API cross-origin without the caller having to predict the
|
|
2033
2044
|
* per-deploy hostname. Override to customize the auto-injected set.
|
package/lib/index.d.ts
CHANGED
|
@@ -95,14 +95,43 @@ interface OpenHiConfig {
|
|
|
95
95
|
[OPEN_HI_STAGE.DEV]?: {
|
|
96
96
|
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
|
|
97
97
|
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
|
|
98
|
+
/**
|
|
99
|
+
* Additional client origins trusted by this stage beyond the
|
|
100
|
+
* stage-owned admin/website hosts that auto-injection derives from
|
|
101
|
+
* branch context. Each entry is a full `<scheme>://<host>` string
|
|
102
|
+
* with no path and no trailing slash (e.g.
|
|
103
|
+
* `https://main.onsitedev.codedrifters.com`). Consumed by both the
|
|
104
|
+
* REST API CORS allow-list and the Auth OAuth callback list at the
|
|
105
|
+
* service layer.
|
|
106
|
+
*/
|
|
107
|
+
additionalTrustedClientOrigins?: ReadonlyArray<string>;
|
|
98
108
|
};
|
|
99
109
|
[OPEN_HI_STAGE.STAGE]?: {
|
|
100
110
|
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
|
|
101
111
|
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
|
|
112
|
+
/**
|
|
113
|
+
* Additional client origins trusted by this stage beyond the
|
|
114
|
+
* stage-owned admin/website hosts that auto-injection derives from
|
|
115
|
+
* branch context. Each entry is a full `<scheme>://<host>` string
|
|
116
|
+
* with no path and no trailing slash (e.g.
|
|
117
|
+
* `https://main.onsitestage.codedrifters.com`). Consumed by both
|
|
118
|
+
* the REST API CORS allow-list and the Auth OAuth callback list
|
|
119
|
+
* at the service layer.
|
|
120
|
+
*/
|
|
121
|
+
additionalTrustedClientOrigins?: ReadonlyArray<string>;
|
|
102
122
|
};
|
|
103
123
|
[OPEN_HI_STAGE.PROD]?: {
|
|
104
124
|
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
|
|
105
125
|
[OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
|
|
126
|
+
/**
|
|
127
|
+
* Additional client origins trusted by this stage beyond the
|
|
128
|
+
* stage-owned admin/website hosts that auto-injection derives from
|
|
129
|
+
* branch context. Each entry is a full `<scheme>://<host>` string
|
|
130
|
+
* with no path and no trailing slash. Consumed by both the REST
|
|
131
|
+
* API CORS allow-list and the Auth OAuth callback list at the
|
|
132
|
+
* service layer.
|
|
133
|
+
*/
|
|
134
|
+
additionalTrustedClientOrigins?: ReadonlyArray<string>;
|
|
106
135
|
};
|
|
107
136
|
};
|
|
108
137
|
}
|
|
@@ -2325,14 +2354,20 @@ declare class OpenHiAuthService extends OpenHiService {
|
|
|
2325
2354
|
* - `https://admin{,-<childZonePrefix>}.<zone>/oauth/{callback,logout}`
|
|
2326
2355
|
* - `https://www{,-<childZonePrefix>}.<zone>/oauth/{callback,logout}`
|
|
2327
2356
|
*
|
|
2328
|
-
* Both deployed-host pairs are auto-injected on every stage.
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2357
|
+
* Both deployed-host pairs are auto-injected on every stage. The stage's
|
|
2358
|
+
* `additionalTrustedClientOrigins` entries (e.g. on-site customer SPA
|
|
2359
|
+
* hosts) are filtered to `https://`-prefix values and contribute
|
|
2360
|
+
* `/oauth/callback` + `/oauth/logout` URLs to the merge — Cognito rejects
|
|
2361
|
+
* non-localhost http callbacks, so `http://` entries are silently dropped.
|
|
2362
|
+
* On non-prod stages the localhost dev URLs from
|
|
2363
|
+
* {@link LOCALHOST_OAUTH_CALLBACK_URLS} /
|
|
2364
|
+
* {@link LOCALHOST_OAUTH_LOGOUT_URLS} join the merge; on prod they are
|
|
2331
2365
|
* deliberately excluded.
|
|
2332
2366
|
*
|
|
2333
2367
|
* If `zoneName` is absent (no-DNS test configurations), the deployed-host
|
|
2334
|
-
* pairs are skipped — only the localhost set
|
|
2335
|
-
*
|
|
2368
|
+
* pairs are skipped — only the localhost set and any configured
|
|
2369
|
+
* additional `https://` origins survive (the latter on every stage).
|
|
2370
|
+
* Override to customize.
|
|
2336
2371
|
*/
|
|
2337
2372
|
protected resolveOAuthRedirectUrls(): {
|
|
2338
2373
|
callbackUrls: Array<string>;
|
|
@@ -2665,6 +2700,11 @@ declare class OpenHiRestApiService extends OpenHiService {
|
|
|
2665
2700
|
* the website service will see at synth time. Both hostnames are
|
|
2666
2701
|
* `https://`-only — they always resolve to real DNS records.
|
|
2667
2702
|
*
|
|
2703
|
+
* The stage's `additionalTrustedClientOrigins` config entries (e.g. on-site
|
|
2704
|
+
* customer SPA hosts) are appended verbatim — both `http://` and `https://`
|
|
2705
|
+
* entries flow into CORS. Scheme filtering is OAuth-specific and happens
|
|
2706
|
+
* in `OpenHiAuthService.resolveOAuthRedirectUrls`.
|
|
2707
|
+
*
|
|
2668
2708
|
* Auto-injected on every stage (no `isNonProd` gate) so the admin SPA can
|
|
2669
2709
|
* call the API cross-origin without the caller having to predict the
|
|
2670
2710
|
* per-deploy hostname. Override to customize the auto-injected set.
|
package/lib/index.js
CHANGED
|
@@ -7196,6 +7196,11 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7196
7196
|
* the website service will see at synth time. Both hostnames are
|
|
7197
7197
|
* `https://`-only — they always resolve to real DNS records.
|
|
7198
7198
|
*
|
|
7199
|
+
* The stage's `additionalTrustedClientOrigins` config entries (e.g. on-site
|
|
7200
|
+
* customer SPA hosts) are appended verbatim — both `http://` and `https://`
|
|
7201
|
+
* entries flow into CORS. Scheme filtering is OAuth-specific and happens
|
|
7202
|
+
* in `OpenHiAuthService.resolveOAuthRedirectUrls`.
|
|
7203
|
+
*
|
|
7199
7204
|
* Auto-injected on every stage (no `isNonProd` gate) so the admin SPA can
|
|
7200
7205
|
* call the API cross-origin without the caller having to predict the
|
|
7201
7206
|
* per-deploy hostname. Override to customize the auto-injected set.
|
|
@@ -7215,7 +7220,9 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
7215
7220
|
childZonePrefix: this.childZonePrefix,
|
|
7216
7221
|
zoneName
|
|
7217
7222
|
});
|
|
7218
|
-
|
|
7223
|
+
const stageType = this.ohEnv.ohStage.stageType;
|
|
7224
|
+
const additional = this.ohEnv.ohStage.ohApp.config.deploymentTargets?.[stageType]?.additionalTrustedClientOrigins ?? [];
|
|
7225
|
+
return [`https://${adminHost}`, `https://${websiteHost}`, ...additional];
|
|
7219
7226
|
}
|
|
7220
7227
|
/**
|
|
7221
7228
|
* Builds the full `CorsPreflightOptions` from a merged origins array,
|
|
@@ -7941,14 +7948,20 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
|
|
|
7941
7948
|
* - `https://admin{,-<childZonePrefix>}.<zone>/oauth/{callback,logout}`
|
|
7942
7949
|
* - `https://www{,-<childZonePrefix>}.<zone>/oauth/{callback,logout}`
|
|
7943
7950
|
*
|
|
7944
|
-
* Both deployed-host pairs are auto-injected on every stage.
|
|
7945
|
-
*
|
|
7946
|
-
*
|
|
7951
|
+
* Both deployed-host pairs are auto-injected on every stage. The stage's
|
|
7952
|
+
* `additionalTrustedClientOrigins` entries (e.g. on-site customer SPA
|
|
7953
|
+
* hosts) are filtered to `https://`-prefix values and contribute
|
|
7954
|
+
* `/oauth/callback` + `/oauth/logout` URLs to the merge — Cognito rejects
|
|
7955
|
+
* non-localhost http callbacks, so `http://` entries are silently dropped.
|
|
7956
|
+
* On non-prod stages the localhost dev URLs from
|
|
7957
|
+
* {@link LOCALHOST_OAUTH_CALLBACK_URLS} /
|
|
7958
|
+
* {@link LOCALHOST_OAUTH_LOGOUT_URLS} join the merge; on prod they are
|
|
7947
7959
|
* deliberately excluded.
|
|
7948
7960
|
*
|
|
7949
7961
|
* If `zoneName` is absent (no-DNS test configurations), the deployed-host
|
|
7950
|
-
* pairs are skipped — only the localhost set
|
|
7951
|
-
*
|
|
7962
|
+
* pairs are skipped — only the localhost set and any configured
|
|
7963
|
+
* additional `https://` origins survive (the latter on every stage).
|
|
7964
|
+
* Override to customize.
|
|
7952
7965
|
*/
|
|
7953
7966
|
resolveOAuthRedirectUrls() {
|
|
7954
7967
|
const isNonProd = this.ohEnv.ohStage.stageType !== import_config7.OPEN_HI_STAGE.PROD;
|
|
@@ -7970,15 +7983,21 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
|
|
|
7970
7983
|
});
|
|
7971
7984
|
deployedOrigins.push(`https://${adminHost}`, `https://${websiteHost}`);
|
|
7972
7985
|
}
|
|
7986
|
+
const stageType = this.ohEnv.ohStage.stageType;
|
|
7987
|
+
const additionalHttpsOrigins = this.ohEnv.ohStage.ohApp.config.deploymentTargets?.[stageType]?.additionalTrustedClientOrigins?.filter(
|
|
7988
|
+
(o) => o.startsWith("https://")
|
|
7989
|
+
) ?? [];
|
|
7973
7990
|
const localhostCallbacks = isNonProd ? LOCALHOST_OAUTH_CALLBACK_URLS : [];
|
|
7974
7991
|
const localhostLogouts = isNonProd ? LOCALHOST_OAUTH_LOGOUT_URLS : [];
|
|
7975
7992
|
return {
|
|
7976
7993
|
callbackUrls: [
|
|
7977
7994
|
...deployedOrigins.map((o) => `${o}/oauth/callback`),
|
|
7995
|
+
...additionalHttpsOrigins.map((o) => `${o}/oauth/callback`),
|
|
7978
7996
|
...localhostCallbacks
|
|
7979
7997
|
],
|
|
7980
7998
|
logoutUrls: [
|
|
7981
7999
|
...deployedOrigins.map((o) => `${o}/oauth/logout`),
|
|
8000
|
+
...additionalHttpsOrigins.map((o) => `${o}/oauth/logout`),
|
|
7982
8001
|
...localhostLogouts
|
|
7983
8002
|
]
|
|
7984
8003
|
};
|