@holo-js/kernel 0.4.0 → 0.4.2

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.
@@ -1 +1 @@
1
- 9eb8051fbe40b02e51b66e4640091d67d598fe4ce40e80d8d7454e882cb62bc6
1
+ ac53a613c45d3d351e02f4111384787c95033deb5c62c9dc99a071dea8ce1595
package/dist/index.d.ts CHANGED
@@ -483,5 +483,25 @@ declare function createCookieWriteUnavailableError(message: string, cause?: unkn
483
483
 
484
484
  declare function resolveRetryBackoffSeconds(backoff: number | readonly number[], attempt: number): number;
485
485
 
486
- export { COOKIE_WRITE_UNAVAILABLE, DEFAULT_HOLO_PROJECT_PATHS, DEFAULT_REDIS_CONNECTION, DEFAULT_REDIS_DB, DEFAULT_REDIS_HOST, DEFAULT_REDIS_PORT, HOLO_PROJECT_PREPARE_API_VERSION, HoloProjectPrepareError, HoloRequestUrlError, RuntimeLifecycle, cookieEncryptionInternals, createCookieWriteUnavailableError, createRuntimeLifecycle, defineHoloPlugin, defineHoloProject, defineHoloProjectPreparer, defineRedisConfig, holoRedisDefaults, loadHoloPluginBootModules, loadHoloPluginContributionModules, loadHoloPluginDefinitions, localStoragePathInternals, normalizeHoloPluginDefinition, normalizeHoloProjectConfig, normalizeRedisConfig, requestUrlInternals, resolveHoloPluginModulePath, resolveNormalizedRedisConnection, resolveRequestUrl, resolveRetryBackoffSeconds, sameOriginRedirectPath };
486
+ type ResponseCookieOptions = {
487
+ path: string;
488
+ domain?: string;
489
+ maxAge?: number;
490
+ expires?: Date;
491
+ secure?: boolean;
492
+ httpOnly?: boolean;
493
+ sameSite?: 'lax' | 'strict' | 'none';
494
+ partitioned?: boolean;
495
+ };
496
+ type ParsedResponseCookie = {
497
+ readonly name: string;
498
+ readonly value: string;
499
+ readonly options: ResponseCookieOptions;
500
+ };
501
+ declare function parseResponseCookie(cookie: string): ParsedResponseCookie | null;
502
+ declare const responseCookieInternals: {
503
+ parseResponseCookie: typeof parseResponseCookie;
504
+ };
505
+
506
+ export { COOKIE_WRITE_UNAVAILABLE, DEFAULT_HOLO_PROJECT_PATHS, DEFAULT_REDIS_CONNECTION, DEFAULT_REDIS_DB, DEFAULT_REDIS_HOST, DEFAULT_REDIS_PORT, HOLO_PROJECT_PREPARE_API_VERSION, HoloProjectPrepareError, HoloRequestUrlError, RuntimeLifecycle, cookieEncryptionInternals, createCookieWriteUnavailableError, createRuntimeLifecycle, defineHoloPlugin, defineHoloProject, defineHoloProjectPreparer, defineRedisConfig, holoRedisDefaults, loadHoloPluginBootModules, loadHoloPluginContributionModules, loadHoloPluginDefinitions, localStoragePathInternals, normalizeHoloPluginDefinition, normalizeHoloProjectConfig, normalizeRedisConfig, requestUrlInternals, resolveHoloPluginModulePath, resolveNormalizedRedisConnection, resolveRequestUrl, resolveRetryBackoffSeconds, responseCookieInternals, sameOriginRedirectPath };
487
507
  export type { ConcurrencyOptions, DatabaseLogger, HoloConnectionAddressProvider, HoloDatabaseDriver, HoloForwardedRequest, HoloForwardedRequestResolver, HoloGeneratedProjectArtifact, HoloManagedProjectArtifact, HoloPluginBroadcastContributions, HoloPluginCacheContributions, HoloPluginCliContributions, HoloPluginConfigContributions, HoloPluginContributions, HoloPluginDefinition, HoloPluginDependencyContributions, HoloPluginFrameworkContribution, HoloPluginFrameworkTsconfigKind, HoloPluginMailContributions, HoloPluginMigrationContributions, HoloPluginNotificationContributions, HoloPluginPackageManager, HoloPluginProjectContributions, HoloPluginQueueContributions, HoloPluginRuntimeContributions, HoloPluginRuntimeMapContributions, HoloPluginRuntimeModule, HoloProjectArtifactContents, HoloProjectConfig, HoloProjectConnectionConfig, HoloProjectDatabaseConfig, HoloProjectPaths, HoloProjectPrepareChange, HoloProjectPrepareChangeKind, HoloProjectPrepareCommand, HoloProjectPrepareContext, HoloProjectPrepareDiagnostic, HoloProjectPrepareFailure, HoloProjectPrepareFramework, HoloProjectPrepareFullRetry, HoloProjectPrepareLogger, HoloProjectPrepareModule, HoloProjectPreparePlugin, HoloProjectPrepareResult, HoloProjectPrepareRun, HoloProjectPrepareSource, HoloProjectPrepareWatch, HoloProjectPreparedResult, HoloProjectPreparer, HoloRedisClusterNodeConfig, HoloRedisConfig, HoloRedisConnectionConfig, HoloRequestHeaders, HoloRequestInput, LoadedHoloPluginDefinition, MigrationErrorLog, MigrationStartLog, MigrationSuccessLog, NormalizedHoloProjectConfig, NormalizedHoloRedisClusterNodeConfig, NormalizedHoloRedisConfig, NormalizedHoloRedisConnectionConfig, PluginLoadOptions, QueryErrorLog, QueryStartLog, QuerySuccessLog, RuntimeContribution, RuntimeLifecycleContext, SeederErrorLog, SeederStartLog, SeederSuccessLog, TransactionLog, TransactionScopeKind };
package/dist/index.mjs CHANGED
@@ -682,6 +682,74 @@ function resolveRetryBackoffSeconds(backoff, attempt) {
682
682
  }
683
683
  return backoff[Math.min(Math.max(attempt - 1, 0), backoff.length - 1)] ?? 0;
684
684
  }
685
+
686
+ // src/responseCookie.ts
687
+ function safeDecodeCookieSegment(value) {
688
+ try {
689
+ return decodeURIComponent(value);
690
+ } catch {
691
+ return value;
692
+ }
693
+ }
694
+ function parseResponseCookie(cookie) {
695
+ const [nameValue = "", ...attributes] = cookie.split(";");
696
+ const separator = nameValue.indexOf("=");
697
+ if (!nameValue || separator <= 0) {
698
+ return null;
699
+ }
700
+ const options = { path: "/", secure: false, httpOnly: false };
701
+ for (const rawAttribute of attributes) {
702
+ const attribute = rawAttribute.trim();
703
+ if (!attribute) {
704
+ continue;
705
+ }
706
+ const attributeSeparator = attribute.indexOf("=");
707
+ const key = (attributeSeparator === -1 ? attribute : attribute.slice(0, attributeSeparator)).trim().toLowerCase();
708
+ const value = attributeSeparator === -1 ? "" : attribute.slice(attributeSeparator + 1).trim();
709
+ switch (key) {
710
+ case "path":
711
+ options.path = value || "/";
712
+ break;
713
+ case "domain":
714
+ options.domain = value;
715
+ break;
716
+ case "max-age": {
717
+ const maxAge = Number(value);
718
+ if (Number.isFinite(maxAge)) {
719
+ options.maxAge = maxAge;
720
+ }
721
+ break;
722
+ }
723
+ case "expires": {
724
+ const expires = new Date(value);
725
+ if (!Number.isNaN(expires.getTime())) {
726
+ options.expires = expires;
727
+ }
728
+ break;
729
+ }
730
+ case "secure":
731
+ options.secure = true;
732
+ break;
733
+ case "httponly":
734
+ options.httpOnly = true;
735
+ break;
736
+ case "samesite":
737
+ if (value.toLowerCase() === "lax" || value.toLowerCase() === "strict" || value.toLowerCase() === "none") {
738
+ options.sameSite = value.toLowerCase();
739
+ }
740
+ break;
741
+ case "partitioned":
742
+ options.partitioned = value ? value.toLowerCase() === "true" : true;
743
+ break;
744
+ }
745
+ }
746
+ return {
747
+ name: safeDecodeCookieSegment(nameValue.slice(0, separator)),
748
+ value: safeDecodeCookieSegment(nameValue.slice(separator + 1)),
749
+ options
750
+ };
751
+ }
752
+ var responseCookieInternals = { parseResponseCookie };
685
753
  export {
686
754
  COOKIE_WRITE_UNAVAILABLE,
687
755
  DEFAULT_HOLO_PROJECT_PATHS,
@@ -727,5 +795,6 @@ export {
727
795
  resolveNormalizedRedisConnection,
728
796
  resolveRequestUrl,
729
797
  resolveRetryBackoffSeconds,
798
+ responseCookieInternals,
730
799
  sameOriginRedirectPath
731
800
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/kernel",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Holo-JS Framework - contracts, plugins, and runtime lifecycle",
5
5
  "type": "module",
6
6
  "license": "MIT",