@undefineds.co/xpod 0.3.24 → 0.3.26

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.
Files changed (89) hide show
  1. package/config/cloud.json +6 -5
  2. package/config/main.json +0 -3
  3. package/config/xpod.base.json +0 -32
  4. package/dist/api/container/index.js +3 -0
  5. package/dist/api/container/index.js.map +1 -1
  6. package/dist/api/container/routes.js +2 -0
  7. package/dist/api/container/routes.js.map +1 -1
  8. package/dist/api/container/types.d.ts +5 -0
  9. package/dist/api/container/types.js.map +1 -1
  10. package/dist/authorization/AuthMode.d.ts +8 -0
  11. package/dist/authorization/AuthMode.js +51 -0
  12. package/dist/authorization/AuthMode.js.map +1 -0
  13. package/dist/authorization/PodAuthorizationResources.d.ts +18 -0
  14. package/dist/authorization/PodAuthorizationResources.js +108 -0
  15. package/dist/authorization/PodAuthorizationResources.js.map +1 -0
  16. package/dist/cli/commands/start.js +11 -2
  17. package/dist/cli/commands/start.js.map +1 -1
  18. package/dist/components/components.jsonld +3 -2
  19. package/dist/components/context.jsonld +115 -14
  20. package/dist/index.d.ts +5 -3
  21. package/dist/index.js +6 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/main.js +11 -2
  24. package/dist/main.js.map +1 -1
  25. package/dist/provision/LocalPodProvisioningService.d.ts +6 -2
  26. package/dist/provision/LocalPodProvisioningService.js +36 -33
  27. package/dist/provision/LocalPodProvisioningService.js.map +1 -1
  28. package/dist/provision/LocalPodProvisioningService.jsonld +65 -8
  29. package/dist/runtime/XpodRuntime.js +0 -1
  30. package/dist/runtime/XpodRuntime.js.map +1 -1
  31. package/dist/runtime/bootstrap.d.ts +4 -2
  32. package/dist/runtime/bootstrap.js +82 -12
  33. package/dist/runtime/bootstrap.js.map +1 -1
  34. package/dist/runtime/css-process.d.ts +6 -1
  35. package/dist/runtime/css-process.js +55 -7
  36. package/dist/runtime/css-process.js.map +1 -1
  37. package/dist/runtime/lifecycle.d.ts +2 -3
  38. package/dist/runtime/lifecycle.js +2 -2
  39. package/dist/runtime/lifecycle.js.map +1 -1
  40. package/dist/runtime/runtime-types.d.ts +2 -1
  41. package/dist/runtime/runtime-types.js.map +1 -1
  42. package/dist/storage/accessors/SolidRdfDataAccessor.d.ts +2 -3
  43. package/dist/storage/accessors/SolidRdfDataAccessor.js +48 -42
  44. package/dist/storage/accessors/SolidRdfDataAccessor.js.map +1 -1
  45. package/dist/storage/accessors/SolidRdfDataAccessor.jsonld +1 -1
  46. package/dist/storage/keyvalue/BaseKeyValueStorage.d.ts +33 -0
  47. package/dist/storage/keyvalue/BaseKeyValueStorage.js +106 -0
  48. package/dist/storage/keyvalue/BaseKeyValueStorage.js.map +1 -0
  49. package/dist/storage/keyvalue/BaseKeyValueStorage.jsonld +177 -0
  50. package/dist/storage/keyvalue/PostgresKeyValueStorage.d.ts +9 -18
  51. package/dist/storage/keyvalue/PostgresKeyValueStorage.js +24 -96
  52. package/dist/storage/keyvalue/PostgresKeyValueStorage.js.map +1 -1
  53. package/dist/storage/keyvalue/PostgresKeyValueStorage.jsonld +15 -58
  54. package/dist/storage/keyvalue/SqliteKeyValueStorage.d.ts +9 -15
  55. package/dist/storage/keyvalue/SqliteKeyValueStorage.js +36 -104
  56. package/dist/storage/keyvalue/SqliteKeyValueStorage.js.map +1 -1
  57. package/dist/storage/keyvalue/SqliteKeyValueStorage.jsonld +21 -52
  58. package/dist/storage/quint/BaseQuintStore.d.ts +4 -1
  59. package/dist/storage/quint/BaseQuintStore.js +59 -46
  60. package/dist/storage/quint/BaseQuintStore.js.map +1 -1
  61. package/dist/storage/quint/PgQuintStore.d.ts +4 -3
  62. package/dist/storage/quint/PgQuintStore.js.map +1 -1
  63. package/dist/storage/quint/SqliteQuintStore.d.ts +43 -54
  64. package/dist/storage/quint/SqliteQuintStore.js +197 -520
  65. package/dist/storage/quint/SqliteQuintStore.js.map +1 -1
  66. package/dist/storage/quint/SqliteQuintStore.jsonld +38 -86
  67. package/dist/storage/rdf/PostgresRdfEngine.d.ts +118 -0
  68. package/dist/storage/rdf/PostgresRdfEngine.js +2609 -0
  69. package/dist/storage/rdf/PostgresRdfEngine.js.map +1 -0
  70. package/dist/storage/rdf/PostgresRdfEngine.jsonld +657 -0
  71. package/dist/storage/rdf/SolidRdfEngine.d.ts +2 -2
  72. package/dist/storage/rdf/SolidRdfEngine.js.map +1 -1
  73. package/dist/storage/rdf/SolidRdfEngine.jsonld +3 -0
  74. package/dist/storage/rdf/SolidRdfSparqlEngine.d.ts +3 -3
  75. package/dist/storage/rdf/SolidRdfSparqlEngine.js +20 -20
  76. package/dist/storage/rdf/SolidRdfSparqlEngine.js.map +1 -1
  77. package/dist/storage/rdf/SolidRdfSparqlEngine.jsonld +1 -1
  78. package/dist/storage/rdf/index.d.ts +2 -1
  79. package/dist/storage/rdf/index.js +3 -1
  80. package/dist/storage/rdf/index.js.map +1 -1
  81. package/dist/storage/rdf/types.d.ts +19 -0
  82. package/dist/storage/rdf/types.js.map +1 -1
  83. package/dist/storage/rdf/types.jsonld +115 -0
  84. package/package.json +2 -2
  85. package/config/runtime-open.json +0 -22
  86. package/dist/authorization/AuthModeSelector.d.ts +0 -10
  87. package/dist/authorization/AuthModeSelector.js +0 -27
  88. package/dist/authorization/AuthModeSelector.js.map +0 -1
  89. package/dist/authorization/AuthModeSelector.jsonld +0 -81
@@ -25,6 +25,18 @@
25
25
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_identityDbUrl",
26
26
  "range": "xsd:string"
27
27
  },
28
+ {
29
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_rdfIndexPath",
30
+ "range": {
31
+ "@type": "ParameterRangeUnion",
32
+ "parameterRangeElements": [
33
+ "xsd:string",
34
+ {
35
+ "@type": "ParameterRangeUndefined"
36
+ }
37
+ ]
38
+ }
39
+ },
28
40
  {
29
41
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_oidcIssuer",
30
42
  "range": {
@@ -36,6 +48,35 @@
36
48
  }
37
49
  ]
38
50
  }
51
+ },
52
+ {
53
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_authMode",
54
+ "range": {
55
+ "@type": "ParameterRangeUnion",
56
+ "parameterRangeElements": [
57
+ {
58
+ "@type": "ParameterRangeUnion",
59
+ "parameterRangeElements": [
60
+ {
61
+ "@type": "ParameterRangeLiteral",
62
+ "parameterRangeValueLiteral": "acp"
63
+ },
64
+ {
65
+ "@type": "ParameterRangeLiteral",
66
+ "parameterRangeValueLiteral": "acl"
67
+ },
68
+ {
69
+ "@type": "ParameterRangeLiteral",
70
+ "parameterRangeValueLiteral": "allow-all"
71
+ }
72
+ ]
73
+ },
74
+ "xsd:string",
75
+ {
76
+ "@type": "ParameterRangeUndefined"
77
+ }
78
+ ]
79
+ }
39
80
  }
40
81
  ],
41
82
  "memberFields": [
@@ -59,10 +100,18 @@
59
100
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_identityDbPath",
60
101
  "memberFieldName": "identityDbPath"
61
102
  },
103
+ {
104
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_rdfIndexPath",
105
+ "memberFieldName": "rdfIndexPath"
106
+ },
62
107
  {
63
108
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_oidcIssuer",
64
109
  "memberFieldName": "oidcIssuer"
65
110
  },
111
+ {
112
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_authMode",
113
+ "memberFieldName": "authMode"
114
+ },
66
115
  {
67
116
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_sqliteRuntime",
68
117
  "memberFieldName": "sqliteRuntime"
@@ -84,16 +133,12 @@
84
133
  "memberFieldName": "writeQuints"
85
134
  },
86
135
  {
87
- "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_buildPodQuads",
88
- "memberFieldName": "buildPodQuads"
89
- },
90
- {
91
- "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_addRootAcrQuads",
92
- "memberFieldName": "addRootAcrQuads"
136
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_writeRdfIndex",
137
+ "memberFieldName": "writeRdfIndex"
93
138
  },
94
139
  {
95
- "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_addPublicReadAcrQuads",
96
- "memberFieldName": "addPublicReadAcrQuads"
140
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_buildPodQuads",
141
+ "memberFieldName": "buildPodQuads"
97
142
  },
98
143
  {
99
144
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService__member_writeIdentityIndexes",
@@ -128,11 +173,23 @@
128
173
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_identityDbUrl"
129
174
  }
130
175
  },
176
+ {
177
+ "keyRaw": "rdfIndexPath",
178
+ "value": {
179
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_rdfIndexPath"
180
+ }
181
+ },
131
182
  {
132
183
  "keyRaw": "oidcIssuer",
133
184
  "value": {
134
185
  "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_oidcIssuer"
135
186
  }
187
+ },
188
+ {
189
+ "keyRaw": "authMode",
190
+ "value": {
191
+ "@id": "undefineds:dist/provision/LocalPodProvisioningService.jsonld#LocalPodProvisioningService_options_authMode"
192
+ }
136
193
  }
137
194
  ]
138
195
  }
@@ -56,7 +56,6 @@ async function startXpodRuntime(options = {}) {
56
56
  host,
57
57
  runtimeShorthand: environment.shorthand,
58
58
  supervisor,
59
- open: options.open ?? false,
60
59
  createCssRuntimeConfig: bootstrap_1.createCssRuntimeConfig,
61
60
  cssRunner,
62
61
  });
@@ -1 +1 @@
1
- {"version":3,"file":"XpodRuntime.js","sourceRoot":"","sources":["../../src/runtime/XpodRuntime.ts"],"names":[],"mappings":";;AAoBA,4CAoGC;AAxHD,iEAAqD;AACrD,+CAAqE;AACrE,yDAAsD;AACtD,2CAIqB;AACrB,uEAAoE;AACpE,+CAAgE;AAChE,2CAOqB;AAGd,KAAK,UAAU,gBAAgB,CAAC,UAA8B,EAAE;IACrE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,qCAAiB,CAAC;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;IACxD,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC;IACpE,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,IAAA,mCAAuB,EAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEzE,IAAA,6BAAiB,EAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAA,oCAAY,EAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAA,6CAA+B,EAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE9E,MAAM,uBAAuB,GAAG,KAAK,CAAC,SAAS,KAAK,QAAQ;QAC1D,CAAC,CA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ACJ,UAAU;YACV,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,SAAS;SACV,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,GAAG,MAAM,IAAA,+BAAmB,EAAC;YAC3C,KAAK;YACL,IAAI;YACJ,UAAU;YACV,eAAe,EAAE,IAAI;YACrB,aAAa;SACd,CAAC,CAAC;QACH,WAAW,CAAC,OAAO,EAAE,CAAC;QAEtB,OAAO;YACL,EAAE;YACF,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU;YACV,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,KAAK,EAAE,KAAK,EAAC,KAA6B,EAAE,IAAkB,EAAqB,EAAE;gBACnF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,GAAG,EAAE,CAAC;oBACtD,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC;gBACrE,CAAC;gBACD,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACrC,CAAC;YACD,IAAI;SACL,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,MAAM,IAAI,EAAE,CAAC;QACb,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import { getLoggerFor } from 'global-logger-factory';\nimport { closeAllIdentityConnections } from '../identity/drizzle/db';\nimport { Supervisor } from '../supervisor/Supervisor';\nimport {\n createCssRuntimeConfig,\n initRuntimeLogger,\n resolveRuntimeBootstrap,\n} from './bootstrap';\nimport { nodeRuntimeDriver } from './driver/node/NodeRuntimeDriver';\nimport { createRuntimeEnvironmentSession } from './environment';\nimport {\n registerManagedRuntimeServices,\n startApiRuntime,\n startCssRuntime,\n startGatewayRuntime,\n stopRuntimeServices,\n type RuntimeServices,\n} from './lifecycle';\nimport type { XpodRuntimeHandle, XpodRuntimeOptions } from './runtime-types';\n\nexport async function startXpodRuntime(options: XpodRuntimeOptions = {}): Promise<XpodRuntimeHandle> {\n const driver = options.driver ?? nodeRuntimeDriver;\n const host = options.host ?? driver.host;\n const platform = options.platform ?? driver.platform;\n const cssRunner = options.cssRunner ?? driver.cssRunner;\n const apiRunner = options.apiRunner ?? driver.apiRunner;\n const gatewayRunner = options.gatewayRunner ?? driver.gatewayRunner;\n const id = platform.createRuntimeId();\n const state = await resolveRuntimeBootstrap(id, options, host, platform);\n\n initRuntimeLogger(state.logLevel, platform);\n const logger = getLoggerFor('XpodRuntime');\n const environment = createRuntimeEnvironmentSession(state, options, platform);\n\n const unregisterSocketOrigins = state.transport === 'socket'\n ? host.registerSocketOrigins(state.baseUrl, state.sockets.gateway!)\n : async(): Promise<void> => undefined;\n\n const supervisor = new Supervisor({ handleProcessSignals: false });\n const services: RuntimeServices = {};\n let stopped = false;\n let stopPromise: Promise<void> | undefined;\n\n const stop = async(): Promise<void> => {\n if (stopPromise) {\n return stopPromise;\n }\n\n stopPromise = (async() => {\n if (stopped) {\n return;\n }\n stopped = true;\n\n await stopRuntimeServices({\n services,\n supervisor,\n logger,\n host,\n state,\n unregisterSocketOrigins,\n closeIdentityConnections: closeAllIdentityConnections,\n restoreRuntimeEnv: environment.restore,\n });\n })();\n\n return stopPromise;\n };\n\n registerManagedRuntimeServices(supervisor, services);\n\n try {\n services.cssApp = await startCssRuntime({\n state,\n host,\n runtimeShorthand: environment.shorthand,\n supervisor,\n open: options.open ?? false,\n createCssRuntimeConfig,\n cssRunner,\n });\n\n services.apiService = await startApiRuntime({\n state,\n host,\n supervisor,\n authContext: options.authContext,\n apiRunner,\n });\n\n services.gateway = await startGatewayRuntime({\n state,\n host,\n supervisor,\n shutdownHandler: stop,\n gatewayRunner,\n });\n environment.restore();\n\n return {\n id,\n mode: state.mode,\n transport: state.transport,\n baseUrl: state.baseUrl,\n supervisor,\n ports: state.ports,\n sockets: state.sockets,\n fetch: async(input: string | URL | Request, init?: RequestInit): Promise<Response> => {\n if (typeof input === 'string' || input instanceof URL) {\n return platform.fetch(new URL(String(input), state.baseUrl), init);\n }\n return platform.fetch(input, init);\n },\n stop,\n };\n } catch (error) {\n environment.restore();\n await stop();\n throw error;\n }\n}\n\nexport type { XpodRuntimeHandle, XpodRuntimeOptions } from './runtime-types';\n"]}
1
+ {"version":3,"file":"XpodRuntime.js","sourceRoot":"","sources":["../../src/runtime/XpodRuntime.ts"],"names":[],"mappings":";;AAoBA,4CAmGC;AAvHD,iEAAqD;AACrD,+CAAqE;AACrE,yDAAsD;AACtD,2CAIqB;AACrB,uEAAoE;AACpE,+CAAgE;AAChE,2CAOqB;AAGd,KAAK,UAAU,gBAAgB,CAAC,UAA8B,EAAE;IACrE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,qCAAiB,CAAC;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC;IACrD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;IACxD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;IACxD,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC;IACpE,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,IAAA,mCAAuB,EAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEzE,IAAA,6BAAiB,EAAC,K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cesContent":["import { getLoggerFor } from 'global-logger-factory';\nimport { closeAllIdentityConnections } from '../identity/drizzle/db';\nimport { Supervisor } from '../supervisor/Supervisor';\nimport {\n createCssRuntimeConfig,\n initRuntimeLogger,\n resolveRuntimeBootstrap,\n} from './bootstrap';\nimport { nodeRuntimeDriver } from './driver/node/NodeRuntimeDriver';\nimport { createRuntimeEnvironmentSession } from './environment';\nimport {\n registerManagedRuntimeServices,\n startApiRuntime,\n startCssRuntime,\n startGatewayRuntime,\n stopRuntimeServices,\n type RuntimeServices,\n} from './lifecycle';\nimport type { XpodRuntimeHandle, XpodRuntimeOptions } from './runtime-types';\n\nexport async function startXpodRuntime(options: XpodRuntimeOptions = {}): Promise<XpodRuntimeHandle> {\n const driver = options.driver ?? nodeRuntimeDriver;\n const host = options.host ?? driver.host;\n const platform = options.platform ?? driver.platform;\n const cssRunner = options.cssRunner ?? driver.cssRunner;\n const apiRunner = options.apiRunner ?? driver.apiRunner;\n const gatewayRunner = options.gatewayRunner ?? driver.gatewayRunner;\n const id = platform.createRuntimeId();\n const state = await resolveRuntimeBootstrap(id, options, host, platform);\n\n initRuntimeLogger(state.logLevel, platform);\n const logger = getLoggerFor('XpodRuntime');\n const environment = createRuntimeEnvironmentSession(state, options, platform);\n\n const unregisterSocketOrigins = state.transport === 'socket'\n ? host.registerSocketOrigins(state.baseUrl, state.sockets.gateway!)\n : async(): Promise<void> => undefined;\n\n const supervisor = new Supervisor({ handleProcessSignals: false });\n const services: RuntimeServices = {};\n let stopped = false;\n let stopPromise: Promise<void> | undefined;\n\n const stop = async(): Promise<void> => {\n if (stopPromise) {\n return stopPromise;\n }\n\n stopPromise = (async() => {\n if (stopped) {\n return;\n }\n stopped = true;\n\n await stopRuntimeServices({\n services,\n supervisor,\n logger,\n host,\n state,\n unregisterSocketOrigins,\n closeIdentityConnections: closeAllIdentityConnections,\n restoreRuntimeEnv: environment.restore,\n });\n })();\n\n return stopPromise;\n };\n\n registerManagedRuntimeServices(supervisor, services);\n\n try {\n services.cssApp = await startCssRuntime({\n state,\n host,\n runtimeShorthand: environment.shorthand,\n supervisor,\n createCssRuntimeConfig,\n cssRunner,\n });\n\n services.apiService = await startApiRuntime({\n state,\n host,\n supervisor,\n authContext: options.authContext,\n apiRunner,\n });\n\n services.gateway = await startGatewayRuntime({\n state,\n host,\n supervisor,\n shutdownHandler: stop,\n gatewayRunner,\n });\n environment.restore();\n\n return {\n id,\n mode: state.mode,\n transport: state.transport,\n baseUrl: state.baseUrl,\n supervisor,\n ports: state.ports,\n sockets: state.sockets,\n fetch: async(input: string | URL | Request, init?: RequestInit): Promise<Response> => {\n if (typeof input === 'string' || input instanceof URL) {\n return platform.fetch(new URL(String(input), state.baseUrl), init);\n }\n return platform.fetch(input, init);\n },\n stop,\n };\n } catch (error) {\n environment.restore();\n await stop();\n throw error;\n }\n}\n\nexport type { XpodRuntimeHandle, XpodRuntimeOptions } from './runtime-types';\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { RuntimeHost } from './host/types';
2
2
  import type { RuntimePlatform } from './platform/types';
3
3
  import type { XpodRuntimeOptions, XpodRuntimePorts, XpodRuntimeSockets } from './runtime-types';
4
+ import type { AuthMode } from '../authorization/AuthMode';
4
5
  export interface RuntimeBootstrapState {
5
6
  id: string;
6
7
  host: RuntimeHost;
@@ -13,7 +14,7 @@ export interface RuntimeBootstrapState {
13
14
  rdfIndexPath: string;
14
15
  identityDbUrl: string;
15
16
  usageDbUrl: string;
16
- cssAuthMode: 'acp' | 'acl' | 'allow-all';
17
+ cssAuthMode: AuthMode;
17
18
  apiOpen: boolean;
18
19
  logLevel: string;
19
20
  baseUrl: string;
@@ -21,8 +22,9 @@ export interface RuntimeBootstrapState {
21
22
  ports: XpodRuntimePorts;
22
23
  sockets: XpodRuntimeSockets;
23
24
  }
25
+ export declare function cssAuthModeConfigImports(authMode: AuthMode): string[];
24
26
  export declare function resolveRuntimeBootstrap(id: string, options: XpodRuntimeOptions, host: RuntimeHost, platform?: RuntimePlatform): Promise<RuntimeBootstrapState>;
25
27
  export declare function buildRuntimeEnv(state: RuntimeBootstrapState, options: XpodRuntimeOptions, envFromFile?: Record<string, string | undefined>): Record<string, string | undefined>;
26
28
  export declare function buildRuntimeShorthand(runtimeEnv: Record<string, string | undefined>, options: XpodRuntimeOptions, state: RuntimeBootstrapState, baseEnv?: Record<string, string | undefined>): Record<string, string | number | boolean>;
27
- export declare function createCssRuntimeConfig(state: RuntimeBootstrapState, open: boolean, platform?: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'writeTextFile'>): string;
29
+ export declare function createCssRuntimeConfig(state: RuntimeBootstrapState, _open?: boolean, platform?: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>): string;
28
30
  export declare function initRuntimeLogger(level: string, platform?: Pick<RuntimePlatform, 'cwd' | 'joinPath'>): void;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.cssAuthModeConfigImports = cssAuthModeConfigImports;
6
7
  exports.resolveRuntimeBootstrap = resolveRuntimeBootstrap;
7
8
  exports.buildRuntimeEnv = buildRuntimeEnv;
8
9
  exports.buildRuntimeShorthand = buildRuntimeShorthand;
@@ -15,6 +16,10 @@ const ConfigurableLoggerFactory_1 = require("../logging/ConfigurableLoggerFactor
15
16
  const package_root_1 = require("./package-root");
16
17
  const oidc_issuer_1 = require("./oidc-issuer");
17
18
  const NodeRuntimePlatform_1 = require("./platform/node/NodeRuntimePlatform");
19
+ const env_utils_1 = require("./env-utils");
20
+ const AuthMode_1 = require("../authorization/AuthMode");
21
+ const CSS_COMPONENTS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld';
22
+ const ASYNC_HANDLERS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld';
18
23
  function ensureTrailingSlash(url) {
19
24
  return url.endsWith('/') ? url : `${url}/`;
20
25
  }
@@ -77,6 +82,29 @@ function normalizeDatabaseUrl(value, platform = NodeRuntimePlatform_1.nodeRuntim
77
82
  }
78
83
  return `sqlite:${platform.resolvePath(value)}`;
79
84
  }
85
+ function readRuntimeEnvFile(envFilePath, platform) {
86
+ return envFilePath ? (0, env_utils_1.loadEnvFile)(envFilePath, platform) : {};
87
+ }
88
+ function cssAuthModeConfigImports(authMode) {
89
+ switch (authMode) {
90
+ case 'acl':
91
+ return [
92
+ 'css:config/ldp/authorization/webacl.json',
93
+ 'css:config/util/auxiliary/acl.json',
94
+ ];
95
+ case 'allow-all':
96
+ return [
97
+ 'css:config/ldp/authorization/allow-all.json',
98
+ 'css:config/util/auxiliary/empty.json',
99
+ ];
100
+ case 'acp':
101
+ default:
102
+ return [
103
+ 'css:config/ldp/authorization/acp.json',
104
+ 'css:config/util/auxiliary/acr.json',
105
+ ];
106
+ }
107
+ }
80
108
  async function resolveRuntimeBootstrap(id, options, host, platform = NodeRuntimePlatform_1.nodeRuntimePlatform) {
81
109
  const mode = options.mode ?? 'local';
82
110
  const transport = host.resolveTransport(options.transport);
@@ -87,7 +115,13 @@ async function resolveRuntimeBootstrap(id, options, host, platform = NodeRuntime
87
115
  const rdfIndexPath = platform.resolvePath(options.rdfIndexPath ?? platform.joinPath(runtimeRoot, 'rdf-index.sqlite'));
88
116
  const identityDbUrl = normalizeDatabaseUrl(options.identityDbUrl ?? platform.joinPath(runtimeRoot, 'identity.sqlite'), platform);
89
117
  const usageDbUrl = normalizeDatabaseUrl(options.usageDbUrl ?? platform.joinPath(runtimeRoot, 'usage.sqlite'), platform);
90
- const cssAuthMode = options.authMode ?? (options.open ? 'allow-all' : 'acp');
118
+ const envFilePath = options.envFile ? platform.resolvePath(options.envFile) : undefined;
119
+ const authModeEnv = {
120
+ ...platform.baseEnv,
121
+ ...readRuntimeEnvFile(envFilePath, platform),
122
+ ...options.env,
123
+ };
124
+ const cssAuthMode = options.open ? 'allow-all' : (0, AuthMode_1.resolveAuthModeInput)(options.authMode, authModeEnv);
91
125
  const apiOpen = options.apiOpen ?? options.open ?? false;
92
126
  const logLevel = options.logLevel ?? platform.getEnv('CSS_LOGGING_LEVEL') ?? 'warn';
93
127
  platform.ensureDir(runtimeRoot);
@@ -129,7 +163,7 @@ async function resolveRuntimeBootstrap(id, options, host, platform = NodeRuntime
129
163
  apiOpen,
130
164
  logLevel,
131
165
  baseUrl,
132
- envFilePath: options.envFile ? platform.resolvePath(options.envFile) : undefined,
166
+ envFilePath,
133
167
  ports,
134
168
  sockets,
135
169
  };
@@ -140,7 +174,7 @@ function buildRuntimeEnv(state, options, envFromFile = {}) {
140
174
  ...options.env,
141
175
  };
142
176
  const externalOidcIssuer = (0, oidc_issuer_1.resolveExternalOidcIssuer)(mergedEnv);
143
- return {
177
+ const runtimeEnv = {
144
178
  ...mergedEnv,
145
179
  XPOD_ENV_PATH: state.envFilePath,
146
180
  XPOD_EDITION: state.mode,
@@ -149,6 +183,7 @@ function buildRuntimeEnv(state, options, envFromFile = {}) {
149
183
  ? (0, oidc_issuer_1.oidcTokenEndpoint)(externalOidcIssuer)
150
184
  : `${state.baseUrl}.oidc/token`,
151
185
  CSS_ROOT_FILE_PATH: state.rootFilePath,
186
+ CSS_RDF_INDEX_PATH: state.rdfIndexPath,
152
187
  CSS_SPARQL_ENDPOINT: state.sparqlEndpoint,
153
188
  SPARQL_ENDPOINT: state.sparqlEndpoint,
154
189
  CSS_IDENTITY_DB_URL: state.identityDbUrl,
@@ -161,6 +196,7 @@ function buildRuntimeEnv(state, options, envFromFile = {}) {
161
196
  CORS_ORIGINS: new URL(state.baseUrl).origin,
162
197
  CSS_LOGGING_LEVEL: state.logLevel,
163
198
  };
199
+ return (0, AuthMode_1.applyAuthModeEnv)(runtimeEnv, state.cssAuthMode);
164
200
  }
165
201
  function buildRuntimeShorthand(runtimeEnv, options, state, baseEnv = NodeRuntimePlatform_1.nodeRuntimePlatform.baseEnv) {
166
202
  const envValue = (key) => runtimeEnv[key] ?? baseEnv[key];
@@ -201,11 +237,8 @@ function buildRuntimeShorthand(runtimeEnv, options, state, baseEnv = NodeRuntime
201
237
  ...(options.shorthand ?? {}),
202
238
  };
203
239
  }
204
- function createCssRuntimeConfig(state, open, platform = NodeRuntimePlatform_1.nodeRuntimePlatform) {
240
+ function createCssRuntimeConfig(state, _open, platform = NodeRuntimePlatform_1.nodeRuntimePlatform) {
205
241
  const configPath = normalizeWindowsAbsolutePath(platform.joinPath(package_root_1.PACKAGE_ROOT, `config/${state.mode}.json`));
206
- if (!open) {
207
- return configPath;
208
- }
209
242
  const runtimeRoot = normalizeWindowsAbsolutePath(state.runtimeRoot);
210
243
  const runtimeConfigPath = arePathsOnDifferentWindowsDrives(runtimeRoot, configPath)
211
244
  ? (() => {
@@ -214,19 +247,56 @@ function createCssRuntimeConfig(state, open, platform = NodeRuntimePlatform_1.no
214
247
  return normalizeWindowsAbsolutePath(platform.joinPath(runtimeConfigDir, 'css-runtime.config.json'));
215
248
  })()
216
249
  : normalizeWindowsAbsolutePath(platform.joinPath(runtimeRoot, 'css-runtime.config.json'));
217
- const openConfigPath = normalizeWindowsAbsolutePath(platform.joinPath(package_root_1.PACKAGE_ROOT, 'config/runtime-open.json'));
250
+ const runtimeConfigDir = platform.dirname(runtimeConfigPath);
251
+ const runtimeConfigImportPath = rewriteConfigForFileUrlImportsIfNeeded(configPath, platform.joinPath(runtimeConfigDir, 'config'), platform);
218
252
  platform.writeTextFile(runtimeConfigPath, JSON.stringify({
219
253
  '@context': [
220
- 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',
221
- 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',
254
+ CSS_COMPONENTS_CONTEXT,
255
+ ASYNC_HANDLERS_CONTEXT,
222
256
  ],
223
257
  import: [
224
- toConfigImportSpecifier(runtimeConfigPath, configPath),
225
- toConfigImportSpecifier(runtimeConfigPath, openConfigPath),
258
+ toConfigImportSpecifier(runtimeConfigPath, runtimeConfigImportPath),
259
+ ...cssAuthModeConfigImports(state.cssAuthMode),
226
260
  ],
227
261
  }, null, 2));
228
262
  return runtimeConfigPath;
229
263
  }
264
+ function rewriteConfigForFileUrlImportsIfNeeded(configPath, outputDir, platform, rewritten = new Map()) {
265
+ const normalizedConfigPath = normalizeWindowsAbsolutePath(configPath);
266
+ if (isWindowsAbsolutePath(normalizedConfigPath) || !pathNeedsEscapedFileUrl(normalizedConfigPath)) {
267
+ return normalizedConfigPath;
268
+ }
269
+ const existing = rewritten.get(normalizedConfigPath);
270
+ if (existing) {
271
+ return existing;
272
+ }
273
+ platform.ensureDir(outputDir);
274
+ const outputPath = normalizeWindowsAbsolutePath(platform.joinPath(outputDir, node_path_1.default.posix.basename(normalizedConfigPath)));
275
+ rewritten.set(normalizedConfigPath, outputPath);
276
+ const parsed = JSON.parse(platform.readTextFile(normalizedConfigPath));
277
+ parsed.import = rewriteConfigImports(normalizedConfigPath, parsed.import, outputDir, platform, rewritten);
278
+ platform.writeTextFile(outputPath, `${JSON.stringify(parsed, null, 2)}\n`);
279
+ return outputPath;
280
+ }
281
+ function rewriteConfigImports(sourceConfigPath, imports, outputDir, platform, rewritten) {
282
+ if (typeof imports === 'string') {
283
+ return rewriteConfigImport(sourceConfigPath, imports, outputDir, platform, rewritten);
284
+ }
285
+ if (Array.isArray(imports)) {
286
+ return imports.map((value) => typeof value === 'string'
287
+ ? rewriteConfigImport(sourceConfigPath, value, outputDir, platform, rewritten)
288
+ : value);
289
+ }
290
+ return imports;
291
+ }
292
+ function rewriteConfigImport(sourceConfigPath, importValue, outputDir, platform, rewritten) {
293
+ if (!importValue.startsWith('./') && !importValue.startsWith('../')) {
294
+ return importValue;
295
+ }
296
+ const targetPath = normalizeWindowsAbsolutePath(node_path_1.default.posix.resolve(platform.dirname(sourceConfigPath), importValue));
297
+ const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, platform, rewritten);
298
+ return (0, node_url_1.pathToFileURL)(rewrittenTargetPath).href;
299
+ }
230
300
  function initRuntimeLogger(level, platform = NodeRuntimePlatform_1.nodeRuntimePlatform) {
231
301
  const loggerFactory = new ConfigurableLoggerFactory_1.ConfigurableLoggerFactory(level, {
232
302
  fileName: platform.joinPath(platform.cwd(), 'logs/xpod-%DATE%.log'),
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":";;;;;AAgHA,0DAoEC;AAED,0CAgCC;AAED,sDA4CC;AAED,wDAoCC;AAED,8CASC;AArTD,iEAA+D;AAC/D,0DAA6B;AAC7B,uCAAyC;AACzC,oFAAiF;AACjF,iDAA8C;AAE9C,+CAA6E;AAC7E,6EAA0E;AAyB1E,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC7C,CAAC;AAED,SAAS,4BAA4B,CAAC,QAAgB;IACpD,OAAO,QAAQ,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,qBAAqB,CAAC,QAAgB;IAC7C,OAAO,iBAAiB,CAAC,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,MAAM,cAAc,GAAG,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IAC9D,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,mBAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,C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Y,EAAE,0BAA0B,CAAC,CAAC,CAAC;IACjH,QAAQ,CAAC,aAAa,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC;QACvD,UAAU,EAAE;YACV,6GAA6G;YAC7G,2GAA2G;SAC5G;QACD,MAAM,EAAE;YACN,uBAAuB,CAAC,iBAAiB,EAAE,UAAU,CAAC;YACtD,uBAAuB,CAAC,iBAAiB,EAAE,cAAc,CAAC;SAC3D;KACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAEb,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,SAAgB,iBAAiB,CAC/B,KAAa,EACb,WAAsD,yCAAmB;IAEzE,MAAM,aAAa,GAAG,IAAI,qDAAyB,CAAC,KAAK,EAAE;QACzD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,sBAAsB,CAAC;QACnE,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,IAAA,8CAAsB,EAAC,aAAa,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { setGlobalLoggerFactory } from 'global-logger-factory';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { ConfigurableLoggerFactory } from '../logging/ConfigurableLoggerFactory';\nimport { PACKAGE_ROOT } from './package-root';\nimport type { RuntimeHost } from './host/types';\nimport { oidcTokenEndpoint, resolveExternalOidcIssuer } from './oidc-issuer';\nimport { nodeRuntimePlatform } from './platform/node/NodeRuntimePlatform';\nimport type { RuntimePlatform } from './platform/types';\nimport type { XpodRuntimeOptions, XpodRuntimePorts, XpodRuntimeSockets } from './runtime-types';\n\nexport interface RuntimeBootstrapState {\n id: string;\n host: RuntimeHost;\n mode: 'local' | 'cloud';\n transport: 'socket' | 'port';\n bindHost: string;\n runtimeRoot: string;\n rootFilePath: string;\n sparqlEndpoint: string;\n rdfIndexPath: string;\n identityDbUrl: string;\n usageDbUrl: string;\n cssAuthMode: 'acp' | 'acl' | 'allow-all';\n apiOpen: boolean;\n logLevel: string;\n baseUrl: string;\n envFilePath?: string;\n ports: XpodRuntimePorts;\n sockets: XpodRuntimeSockets;\n}\n\nfunction ensureTrailingSlash(url: string): string {\n return url.endsWith('/') ? url : `${url}/`;\n}\n\nfunction normalizeWindowsAbsolutePath(filePath: string): string {\n return filePath.replace(/^[\\\\/]+(?=[A-Za-z]:[\\\\/])/, '');\n}\n\nfunction isWindowsAbsolutePath(filePath: string): boolean {\n return /^[A-Za-z]:[\\\\/]/.test(normalizeWindowsAbsolutePath(filePath));\n}\n\nfunction getWindowsDriveRoot(filePath: string): string | undefined {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath);\n return isWindowsAbsolutePath(normalizedPath) ? path.win32.parse(normalizedPath).root.toLowerCase() : undefined;\n}\n\nfunction arePathsOnDifferentWindowsDrives(firstPath: string, secondPath: string): boolean {\n const firstRoot = getWindowsDriveRoot(firstPath);\n const secondRoot = getWindowsDriveRoot(secondPath);\n return Boolean(firstRoot && secondRoot && firstRoot !== secondRoot);\n}\n\nfunction toWindowsFileUrl(filePath: string): string {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath).replace(/\\\\/g, '/');\n return new URL(`file:///${normalizedPath}`).href;\n}\n\nfunction toConfigImportSpecifier(fromFilePath: string, toFilePath: string): string {\n const normalizedFromPath = normalizeWindowsAbsolutePath(fromFilePath);\n const normalizedToPath = normalizeWindowsAbsolutePath(toFilePath);\n if (!isWindowsAbsolutePath(normalizedFromPath) && (pathNeedsEscapedFileUrl(normalizedFromPath) || pathNeedsEscapedFileUrl(normalizedToPath))) {\n return pathToFileURL(normalizedToPath).href;\n }\n\n const useWindowsPaths = isWindowsAbsolutePath(normalizedFromPath) || isWindowsAbsolutePath(normalizedToPath);\n const pathApi = useWindowsPaths ? path.win32 : path.posix;\n const fromDirectoryPath = pathApi.dirname(useWindowsPaths ? normalizedFromPath : fromFilePath);\n const targetPath = useWindowsPaths ? normalizedToPath : toFilePath;\n\n if (useWindowsPaths && arePathsOnDifferentWindowsDrives(fromDirectoryPath, targetPath)) {\n return toWindowsFileUrl(targetPath);\n }\n\n const relativePath = pathApi.relative(fromDirectoryPath, targetPath).replace(/\\\\/g, '/');\n if (relativePath.startsWith('./') || relativePath.startsWith('../')) {\n return relativePath;\n }\n return `./${relativePath}`;\n}\n\nfunction pathNeedsEscapedFileUrl(filePath: string): boolean {\n return /\\s/.test(filePath);\n}\n\nfunction withDefinedEntries(entries: Array<[string, string | number | boolean | undefined]>): Record<string, string | number | boolean> {\n const result: Record<string, string | number | boolean> = {};\n for (const [key, value] of entries) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction normalizeDatabaseUrl(\n value: string,\n platform: Pick<RuntimePlatform, 'resolvePath'> = nodeRuntimePlatform,\n): string {\n if (\n value.startsWith('sqlite:') ||\n value.startsWith('postgres://') ||\n value.startsWith('postgresql://') ||\n value.startsWith('mysql://')\n ) {\n return value;\n }\n return `sqlite:${platform.resolvePath(value)}`;\n}\n\nexport async function resolveRuntimeBootstrap(\n id: string,\n options: XpodRuntimeOptions,\n host: RuntimeHost,\n platform: RuntimePlatform = nodeRuntimePlatform,\n): Promise<RuntimeBootstrapState> {\n const mode = options.mode ?? 'local';\n const transport = host.resolveTransport(options.transport);\n const bindHost = options.bindHost ?? '127.0.0.1';\n const runtimeRoot = platform.resolvePath(options.runtimeRoot ?? platform.joinPath(platform.cwd(), '.test-data', 'xpod-runtime', id));\n const rootFilePath = platform.resolvePath(options.rootFilePath ?? platform.joinPath(runtimeRoot, 'data'));\n const sparqlEndpoint = normalizeDatabaseUrl(options.sparqlEndpoint ?? platform.joinPath(runtimeRoot, 'quadstore.sqlite'), platform);\n const rdfIndexPath = platform.resolvePath(options.rdfIndexPath ?? platform.joinPath(runtimeRoot, 'rdf-index.sqlite'));\n const identityDbUrl = normalizeDatabaseUrl(options.identityDbUrl ?? platform.joinPath(runtimeRoot, 'identity.sqlite'), platform);\n const usageDbUrl = normalizeDatabaseUrl(options.usageDbUrl ?? platform.joinPath(runtimeRoot, 'usage.sqlite'), platform);\n const cssAuthMode = options.authMode ?? (options.open ? 'allow-all' : 'acp');\n const apiOpen = options.apiOpen ?? options.open ?? false;\n const logLevel = options.logLevel ?? platform.getEnv('CSS_LOGGING_LEVEL') ?? 'warn';\n\n platform.ensureDir(runtimeRoot);\n platform.ensureDir(rootFilePath);\n\n const socketsRoot = platform.joinPath(runtimeRoot, 'sockets');\n if (transport === 'socket') {\n platform.ensureDir(socketsRoot);\n }\n const ports: XpodRuntimePorts = transport === 'port'\n ? await host.allocatePorts({\n gatewayPort: options.gatewayPort,\n cssPort: options.cssPort,\n apiPort: options.apiPort,\n basePort: 5600,\n })\n : {};\n const sockets: XpodRuntimeSockets = {};\n\n if (transport === 'socket') {\n sockets.gateway = platform.resolvePath(options.gatewaySocketPath ?? platform.joinPath(socketsRoot, 'gateway.sock'));\n sockets.css = platform.resolvePath(options.cssSocketPath ?? platform.joinPath(socketsRoot, 'css.sock'));\n sockets.api = platform.resolvePath(options.apiSocketPath ?? platform.joinPath(socketsRoot, 'api.sock'));\n }\n\n const baseUrl = ensureTrailingSlash(\n options.baseUrl ?? (transport === 'socket'\n ? 'http://localhost'\n : `http://${bindHost}:${ports.gateway}`),\n );\n\n return {\n id,\n host,\n mode,\n transport,\n bindHost,\n runtimeRoot,\n rootFilePath,\n sparqlEndpoint,\n rdfIndexPath,\n identityDbUrl,\n usageDbUrl,\n cssAuthMode,\n apiOpen,\n logLevel,\n baseUrl,\n envFilePath: options.envFile ? platform.resolvePath(options.envFile) : undefined,\n ports,\n sockets,\n };\n}\n\nexport function buildRuntimeEnv(\n state: RuntimeBootstrapState,\n options: XpodRuntimeOptions,\n envFromFile: Record<string, string | undefined> = {},\n): Record<string, string | undefined> {\n const mergedEnv = {\n ...envFromFile,\n ...options.env,\n };\n const externalOidcIssuer = resolveExternalOidcIssuer(mergedEnv);\n\n return {\n ...mergedEnv,\n XPOD_ENV_PATH: state.envFilePath,\n XPOD_EDITION: state.mode,\n CSS_BASE_URL: state.baseUrl,\n CSS_TOKEN_ENDPOINT: externalOidcIssuer\n ? oidcTokenEndpoint(externalOidcIssuer)\n : `${state.baseUrl}.oidc/token`,\n CSS_ROOT_FILE_PATH: state.rootFilePath,\n CSS_SPARQL_ENDPOINT: state.sparqlEndpoint,\n SPARQL_ENDPOINT: state.sparqlEndpoint,\n CSS_IDENTITY_DB_URL: state.identityDbUrl,\n DATABASE_URL: state.identityDbUrl,\n CSS_PORT: state.ports.css !== undefined ? String(state.ports.css) : undefined,\n API_PORT: state.ports.api !== undefined ? String(state.ports.api) : undefined,\n API_HOST: state.bindHost,\n API_SOCKET_PATH: state.sockets.api,\n XPOD_MAIN_PORT: state.ports.gateway !== undefined ? String(state.ports.gateway) : undefined,\n CORS_ORIGINS: new URL(state.baseUrl).origin,\n CSS_LOGGING_LEVEL: state.logLevel,\n };\n}\n\nexport function buildRuntimeShorthand(\n runtimeEnv: Record<string, string | undefined>,\n options: XpodRuntimeOptions,\n state: RuntimeBootstrapState,\n baseEnv: Record<string, string | undefined> = nodeRuntimePlatform.baseEnv,\n): Record<string, string | number | boolean> {\n const envValue = (key: string): string | undefined => runtimeEnv[key] ?? baseEnv[key];\n const externalOidcIssuer = resolveExternalOidcIssuer({\n oidcIssuer: envValue('oidcIssuer'),\n });\n\n return {\n ...withDefinedEntries([\n ['baseStorageDomain', envValue('CSS_BASE_STORAGE_DOMAIN')],\n ['minioAccessKey', envValue('CSS_MINIO_ACCESS_KEY')],\n ['minioSecretKey', envValue('CSS_MINIO_SECRET_KEY')],\n ['minioEndpoint', envValue('CSS_MINIO_ENDPOINT')],\n ['minioBucketName', envValue('CSS_MINIO_BUCKET_NAME')],\n ['redisClient', envValue('CSS_REDIS_CLIENT')],\n ['redisUsername', envValue('CSS_REDIS_USERNAME')],\n ['redisPassword', envValue('CSS_REDIS_PASSWORD')],\n ['emailConfigHost', envValue('CSS_EMAIL_CONFIG_HOST') ?? ''],\n ['emailConfigPort', envValue('CSS_EMAIL_CONFIG_PORT') ?? '587'],\n ['emailConfigAuthUser', envValue('CSS_EMAIL_CONFIG_AUTH_USER') ?? ''],\n ['emailConfigAuthPass', envValue('CSS_EMAIL_CONFIG_AUTH_PASS') ?? ''],\n ['oidcIssuer', externalOidcIssuer],\n ['allowedHosts', envValue('CSS_ALLOWED_HOSTS')],\n ['nodeId', envValue('XPOD_NODE_ID')],\n ['nodeToken', envValue('XPOD_NODE_TOKEN')],\n ['serviceToken', envValue('XPOD_SERVICE_TOKEN')],\n ]),\n baseUrl: state.baseUrl,\n rootFilePath: state.rootFilePath,\n sparqlEndpoint: state.sparqlEndpoint,\n rdfIndexPath: state.rdfIndexPath,\n identityDbUrl: state.identityDbUrl,\n usageDbUrl: state.usageDbUrl,\n logLevel: state.logLevel,\n authMode: state.cssAuthMode,\n edition: state.mode === 'cloud' ? 'server' : 'local',\n edgeNodesEnabled: options.edgeNodesEnabled ?? false,\n centerRegistrationEnabled: options.centerRegistrationEnabled ?? false,\n ...(options.shorthand ?? {}),\n };\n}\n\nexport function createCssRuntimeConfig(\n state: RuntimeBootstrapState,\n open: boolean,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'writeTextFile'> = nodeRuntimePlatform,\n): string {\n const configPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, `config/${state.mode}.json`));\n if (!open) {\n return configPath;\n }\n\n const runtimeRoot = normalizeWindowsAbsolutePath(state.runtimeRoot);\n const runtimeConfigPath = arePathsOnDifferentWindowsDrives(runtimeRoot, configPath)\n ? (() => {\n const runtimeConfigDir = normalizeWindowsAbsolutePath(platform.joinPath(\n platform.dirname(configPath),\n '..',\n '.xpod-runtime',\n state.id,\n ));\n platform.ensureDir(runtimeConfigDir);\n return normalizeWindowsAbsolutePath(platform.joinPath(runtimeConfigDir, 'css-runtime.config.json'));\n })()\n : normalizeWindowsAbsolutePath(platform.joinPath(runtimeRoot, 'css-runtime.config.json'));\n const openConfigPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, 'config/runtime-open.json'));\n platform.writeTextFile(runtimeConfigPath, JSON.stringify({\n '@context': [\n 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',\n 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',\n ],\n import: [\n toConfigImportSpecifier(runtimeConfigPath, configPath),\n toConfigImportSpecifier(runtimeConfigPath, openConfigPath),\n ],\n }, null, 2));\n\n return runtimeConfigPath;\n}\n\nexport function initRuntimeLogger(\n level: string,\n platform: Pick<RuntimePlatform, 'cwd' | 'joinPath'> = nodeRuntimePlatform,\n): void {\n const loggerFactory = new ConfigurableLoggerFactory(level, {\n fileName: platform.joinPath(platform.cwd(), 'logs/xpod-%DATE%.log'),\n showLocation: true,\n });\n setGlobalLoggerFactory(loggerFactory);\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":";;;;;AA6HA,4DAmBC;AAED,0DA0EC;AAED,0CAmCC;AAED,sDA4CC;AAED,wDAqCC;AAwED,8CASC;AAvaD,iEAA+D;AAC/D,0DAA6B;AAC7B,uCAAyC;AACzC,oFAAiF;AACjF,iDAA8C;AAE9C,+CAA6E;AAC7E,6EAA0E;AAE1E,2CAA0C;AAG1C,wDAAmF;AAEnF,MAAM,sBAAsB,GAAG,6GAA6G,CAAC;AAC7I,MAAM,sBAAsB,GAAG,2GAA2G,CAAC;AAuB3I,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC7C,CAAC;AAED,SAAS,4BAA4B,CAAC,QAAgB;IACpD,OAAO,QAAQ,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;AAC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,SAAS,CAAC,CAAC;IAC/G,OAAO,IAAA,wBAAa,EAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC;AAED,SAAgB,iBAAiB,CAC/B,KAAa,EACb,WAAsD,yCAAmB;IAEzE,MAAM,aAAa,GAAG,IAAI,qDAAyB,CAAC,KAAK,EAAE;QACzD,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,sBAAsB,CAAC;QACnE,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,IAAA,8CAAsB,EAAC,aAAa,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { setGlobalLoggerFactory } from 'global-logger-factory';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { ConfigurableLoggerFactory } from '../logging/ConfigurableLoggerFactory';\nimport { PACKAGE_ROOT } from './package-root';\nimport type { RuntimeHost } from './host/types';\nimport { oidcTokenEndpoint, resolveExternalOidcIssuer } from './oidc-issuer';\nimport { nodeRuntimePlatform } from './platform/node/NodeRuntimePlatform';\nimport type { RuntimePlatform } from './platform/types';\nimport { loadEnvFile } from './env-utils';\nimport type { XpodRuntimeOptions, XpodRuntimePorts, XpodRuntimeSockets } from './runtime-types';\nimport type { AuthMode } from '../authorization/AuthMode';\nimport { applyAuthModeEnv, resolveAuthModeInput } from '../authorization/AuthMode';\n\nconst CSS_COMPONENTS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld';\nconst ASYNC_HANDLERS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld';\n\nexport interface RuntimeBootstrapState {\n id: string;\n host: RuntimeHost;\n mode: 'local' | 'cloud';\n transport: 'socket' | 'port';\n bindHost: string;\n runtimeRoot: string;\n rootFilePath: string;\n sparqlEndpoint: string;\n rdfIndexPath: string;\n identityDbUrl: string;\n usageDbUrl: string;\n cssAuthMode: AuthMode;\n apiOpen: boolean;\n logLevel: string;\n baseUrl: string;\n envFilePath?: string;\n ports: XpodRuntimePorts;\n sockets: XpodRuntimeSockets;\n}\n\nfunction ensureTrailingSlash(url: string): string {\n return url.endsWith('/') ? url : `${url}/`;\n}\n\nfunction normalizeWindowsAbsolutePath(filePath: string): string {\n return filePath.replace(/^[\\\\/]+(?=[A-Za-z]:[\\\\/])/, '');\n}\n\nfunction isWindowsAbsolutePath(filePath: string): boolean {\n return /^[A-Za-z]:[\\\\/]/.test(normalizeWindowsAbsolutePath(filePath));\n}\n\nfunction getWindowsDriveRoot(filePath: string): string | undefined {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath);\n return isWindowsAbsolutePath(normalizedPath) ? path.win32.parse(normalizedPath).root.toLowerCase() : undefined;\n}\n\nfunction arePathsOnDifferentWindowsDrives(firstPath: string, secondPath: string): boolean {\n const firstRoot = getWindowsDriveRoot(firstPath);\n const secondRoot = getWindowsDriveRoot(secondPath);\n return Boolean(firstRoot && secondRoot && firstRoot !== secondRoot);\n}\n\nfunction toWindowsFileUrl(filePath: string): string {\n const normalizedPath = normalizeWindowsAbsolutePath(filePath).replace(/\\\\/g, '/');\n return new URL(`file:///${normalizedPath}`).href;\n}\n\nfunction toConfigImportSpecifier(fromFilePath: string, toFilePath: string): string {\n const normalizedFromPath = normalizeWindowsAbsolutePath(fromFilePath);\n const normalizedToPath = normalizeWindowsAbsolutePath(toFilePath);\n if (!isWindowsAbsolutePath(normalizedFromPath) && (pathNeedsEscapedFileUrl(normalizedFromPath) || pathNeedsEscapedFileUrl(normalizedToPath))) {\n return pathToFileURL(normalizedToPath).href;\n }\n\n const useWindowsPaths = isWindowsAbsolutePath(normalizedFromPath) || isWindowsAbsolutePath(normalizedToPath);\n const pathApi = useWindowsPaths ? path.win32 : path.posix;\n const fromDirectoryPath = pathApi.dirname(useWindowsPaths ? normalizedFromPath : fromFilePath);\n const targetPath = useWindowsPaths ? normalizedToPath : toFilePath;\n\n if (useWindowsPaths && arePathsOnDifferentWindowsDrives(fromDirectoryPath, targetPath)) {\n return toWindowsFileUrl(targetPath);\n }\n\n const relativePath = pathApi.relative(fromDirectoryPath, targetPath).replace(/\\\\/g, '/');\n if (relativePath.startsWith('./') || relativePath.startsWith('../')) {\n return relativePath;\n }\n return `./${relativePath}`;\n}\n\nfunction pathNeedsEscapedFileUrl(filePath: string): boolean {\n return /\\s/.test(filePath);\n}\n\nfunction withDefinedEntries(entries: Array<[string, string | number | boolean | undefined]>): Record<string, string | number | boolean> {\n const result: Record<string, string | number | boolean> = {};\n for (const [key, value] of entries) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction normalizeDatabaseUrl(\n value: string,\n platform: Pick<RuntimePlatform, 'resolvePath'> = nodeRuntimePlatform,\n): string {\n if (\n value.startsWith('sqlite:') ||\n value.startsWith('postgres://') ||\n value.startsWith('postgresql://') ||\n value.startsWith('mysql://')\n ) {\n return value;\n }\n return `sqlite:${platform.resolvePath(value)}`;\n}\n\nfunction readRuntimeEnvFile(\n envFilePath: string | undefined,\n platform: Pick<RuntimePlatform, 'fileExists' | 'readTextFile'>,\n): Record<string, string> {\n return envFilePath ? loadEnvFile(envFilePath, platform) : {};\n}\n\nexport function cssAuthModeConfigImports(authMode: AuthMode): string[] {\n switch (authMode) {\n case 'acl':\n return [\n 'css:config/ldp/authorization/webacl.json',\n 'css:config/util/auxiliary/acl.json',\n ];\n case 'allow-all':\n return [\n 'css:config/ldp/authorization/allow-all.json',\n 'css:config/util/auxiliary/empty.json',\n ];\n case 'acp':\n default:\n return [\n 'css:config/ldp/authorization/acp.json',\n 'css:config/util/auxiliary/acr.json',\n ];\n }\n}\n\nexport async function resolveRuntimeBootstrap(\n id: string,\n options: XpodRuntimeOptions,\n host: RuntimeHost,\n platform: RuntimePlatform = nodeRuntimePlatform,\n): Promise<RuntimeBootstrapState> {\n const mode = options.mode ?? 'local';\n const transport = host.resolveTransport(options.transport);\n const bindHost = options.bindHost ?? '127.0.0.1';\n const runtimeRoot = platform.resolvePath(options.runtimeRoot ?? platform.joinPath(platform.cwd(), '.test-data', 'xpod-runtime', id));\n const rootFilePath = platform.resolvePath(options.rootFilePath ?? platform.joinPath(runtimeRoot, 'data'));\n const sparqlEndpoint = normalizeDatabaseUrl(options.sparqlEndpoint ?? platform.joinPath(runtimeRoot, 'quadstore.sqlite'), platform);\n const rdfIndexPath = platform.resolvePath(options.rdfIndexPath ?? platform.joinPath(runtimeRoot, 'rdf-index.sqlite'));\n const identityDbUrl = normalizeDatabaseUrl(options.identityDbUrl ?? platform.joinPath(runtimeRoot, 'identity.sqlite'), platform);\n const usageDbUrl = normalizeDatabaseUrl(options.usageDbUrl ?? platform.joinPath(runtimeRoot, 'usage.sqlite'), platform);\n const envFilePath = options.envFile ? platform.resolvePath(options.envFile) : undefined;\n const authModeEnv = {\n ...platform.baseEnv,\n ...readRuntimeEnvFile(envFilePath, platform),\n ...options.env,\n };\n const cssAuthMode = options.open ? 'allow-all' : resolveAuthModeInput(options.authMode, authModeEnv);\n const apiOpen = options.apiOpen ?? options.open ?? false;\n const logLevel = options.logLevel ?? platform.getEnv('CSS_LOGGING_LEVEL') ?? 'warn';\n\n platform.ensureDir(runtimeRoot);\n platform.ensureDir(rootFilePath);\n\n const socketsRoot = platform.joinPath(runtimeRoot, 'sockets');\n if (transport === 'socket') {\n platform.ensureDir(socketsRoot);\n }\n const ports: XpodRuntimePorts = transport === 'port'\n ? await host.allocatePorts({\n gatewayPort: options.gatewayPort,\n cssPort: options.cssPort,\n apiPort: options.apiPort,\n basePort: 5600,\n })\n : {};\n const sockets: XpodRuntimeSockets = {};\n\n if (transport === 'socket') {\n sockets.gateway = platform.resolvePath(options.gatewaySocketPath ?? platform.joinPath(socketsRoot, 'gateway.sock'));\n sockets.css = platform.resolvePath(options.cssSocketPath ?? platform.joinPath(socketsRoot, 'css.sock'));\n sockets.api = platform.resolvePath(options.apiSocketPath ?? platform.joinPath(socketsRoot, 'api.sock'));\n }\n\n const baseUrl = ensureTrailingSlash(\n options.baseUrl ?? (transport === 'socket'\n ? 'http://localhost'\n : `http://${bindHost}:${ports.gateway}`),\n );\n\n return {\n id,\n host,\n mode,\n transport,\n bindHost,\n runtimeRoot,\n rootFilePath,\n sparqlEndpoint,\n rdfIndexPath,\n identityDbUrl,\n usageDbUrl,\n cssAuthMode,\n apiOpen,\n logLevel,\n baseUrl,\n envFilePath,\n ports,\n sockets,\n };\n}\n\nexport function buildRuntimeEnv(\n state: RuntimeBootstrapState,\n options: XpodRuntimeOptions,\n envFromFile: Record<string, string | undefined> = {},\n): Record<string, string | undefined> {\n const mergedEnv = {\n ...envFromFile,\n ...options.env,\n };\n const externalOidcIssuer = resolveExternalOidcIssuer(mergedEnv);\n\n const runtimeEnv = {\n ...mergedEnv,\n XPOD_ENV_PATH: state.envFilePath,\n XPOD_EDITION: state.mode,\n CSS_BASE_URL: state.baseUrl,\n CSS_TOKEN_ENDPOINT: externalOidcIssuer\n ? oidcTokenEndpoint(externalOidcIssuer)\n : `${state.baseUrl}.oidc/token`,\n CSS_ROOT_FILE_PATH: state.rootFilePath,\n CSS_RDF_INDEX_PATH: state.rdfIndexPath,\n CSS_SPARQL_ENDPOINT: state.sparqlEndpoint,\n SPARQL_ENDPOINT: state.sparqlEndpoint,\n CSS_IDENTITY_DB_URL: state.identityDbUrl,\n DATABASE_URL: state.identityDbUrl,\n CSS_PORT: state.ports.css !== undefined ? String(state.ports.css) : undefined,\n API_PORT: state.ports.api !== undefined ? String(state.ports.api) : undefined,\n API_HOST: state.bindHost,\n API_SOCKET_PATH: state.sockets.api,\n XPOD_MAIN_PORT: state.ports.gateway !== undefined ? String(state.ports.gateway) : undefined,\n CORS_ORIGINS: new URL(state.baseUrl).origin,\n CSS_LOGGING_LEVEL: state.logLevel,\n };\n\n return applyAuthModeEnv(runtimeEnv, state.cssAuthMode);\n}\n\nexport function buildRuntimeShorthand(\n runtimeEnv: Record<string, string | undefined>,\n options: XpodRuntimeOptions,\n state: RuntimeBootstrapState,\n baseEnv: Record<string, string | undefined> = nodeRuntimePlatform.baseEnv,\n): Record<string, string | number | boolean> {\n const envValue = (key: string): string | undefined => runtimeEnv[key] ?? baseEnv[key];\n const externalOidcIssuer = resolveExternalOidcIssuer({\n oidcIssuer: envValue('oidcIssuer'),\n });\n\n return {\n ...withDefinedEntries([\n ['baseStorageDomain', envValue('CSS_BASE_STORAGE_DOMAIN')],\n ['minioAccessKey', envValue('CSS_MINIO_ACCESS_KEY')],\n ['minioSecretKey', envValue('CSS_MINIO_SECRET_KEY')],\n ['minioEndpoint', envValue('CSS_MINIO_ENDPOINT')],\n ['minioBucketName', envValue('CSS_MINIO_BUCKET_NAME')],\n ['redisClient', envValue('CSS_REDIS_CLIENT')],\n ['redisUsername', envValue('CSS_REDIS_USERNAME')],\n ['redisPassword', envValue('CSS_REDIS_PASSWORD')],\n ['emailConfigHost', envValue('CSS_EMAIL_CONFIG_HOST') ?? ''],\n ['emailConfigPort', envValue('CSS_EMAIL_CONFIG_PORT') ?? '587'],\n ['emailConfigAuthUser', envValue('CSS_EMAIL_CONFIG_AUTH_USER') ?? ''],\n ['emailConfigAuthPass', envValue('CSS_EMAIL_CONFIG_AUTH_PASS') ?? ''],\n ['oidcIssuer', externalOidcIssuer],\n ['allowedHosts', envValue('CSS_ALLOWED_HOSTS')],\n ['nodeId', envValue('XPOD_NODE_ID')],\n ['nodeToken', envValue('XPOD_NODE_TOKEN')],\n ['serviceToken', envValue('XPOD_SERVICE_TOKEN')],\n ]),\n baseUrl: state.baseUrl,\n rootFilePath: state.rootFilePath,\n sparqlEndpoint: state.sparqlEndpoint,\n rdfIndexPath: state.rdfIndexPath,\n identityDbUrl: state.identityDbUrl,\n usageDbUrl: state.usageDbUrl,\n logLevel: state.logLevel,\n authMode: state.cssAuthMode,\n edition: state.mode === 'cloud' ? 'server' : 'local',\n edgeNodesEnabled: options.edgeNodesEnabled ?? false,\n centerRegistrationEnabled: options.centerRegistrationEnabled ?? false,\n ...(options.shorthand ?? {}),\n };\n}\n\nexport function createCssRuntimeConfig(\n state: RuntimeBootstrapState,\n _open?: boolean,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'> = nodeRuntimePlatform,\n): string {\n const configPath = normalizeWindowsAbsolutePath(platform.joinPath(PACKAGE_ROOT, `config/${state.mode}.json`));\n const runtimeRoot = normalizeWindowsAbsolutePath(state.runtimeRoot);\n const runtimeConfigPath = arePathsOnDifferentWindowsDrives(runtimeRoot, configPath)\n ? (() => {\n const runtimeConfigDir = normalizeWindowsAbsolutePath(platform.joinPath(\n platform.dirname(configPath),\n '..',\n '.xpod-runtime',\n state.id,\n ));\n platform.ensureDir(runtimeConfigDir);\n return normalizeWindowsAbsolutePath(platform.joinPath(runtimeConfigDir, 'css-runtime.config.json'));\n })()\n : normalizeWindowsAbsolutePath(platform.joinPath(runtimeRoot, 'css-runtime.config.json'));\n const runtimeConfigDir = platform.dirname(runtimeConfigPath);\n const runtimeConfigImportPath = rewriteConfigForFileUrlImportsIfNeeded(\n configPath,\n platform.joinPath(runtimeConfigDir, 'config'),\n platform,\n );\n platform.writeTextFile(runtimeConfigPath, JSON.stringify({\n '@context': [\n CSS_COMPONENTS_CONTEXT,\n ASYNC_HANDLERS_CONTEXT,\n ],\n import: [\n toConfigImportSpecifier(runtimeConfigPath, runtimeConfigImportPath),\n ...cssAuthModeConfigImports(state.cssAuthMode),\n ],\n }, null, 2));\n\n return runtimeConfigPath;\n}\n\nfunction rewriteConfigForFileUrlImportsIfNeeded(\n configPath: string,\n outputDir: string,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>,\n rewritten = new Map<string, string>(),\n): string {\n const normalizedConfigPath = normalizeWindowsAbsolutePath(configPath);\n if (isWindowsAbsolutePath(normalizedConfigPath) || !pathNeedsEscapedFileUrl(normalizedConfigPath)) {\n return normalizedConfigPath;\n }\n\n const existing = rewritten.get(normalizedConfigPath);\n if (existing) {\n return existing;\n }\n\n platform.ensureDir(outputDir);\n const outputPath = normalizeWindowsAbsolutePath(platform.joinPath(outputDir, path.posix.basename(normalizedConfigPath)));\n rewritten.set(normalizedConfigPath, outputPath);\n\n const parsed = JSON.parse(platform.readTextFile(normalizedConfigPath)) as Record<string, unknown>;\n parsed.import = rewriteConfigImports(\n normalizedConfigPath,\n parsed.import,\n outputDir,\n platform,\n rewritten,\n );\n platform.writeTextFile(outputPath, `${JSON.stringify(parsed, null, 2)}\\n`);\n return outputPath;\n}\n\nfunction rewriteConfigImports(\n sourceConfigPath: string,\n imports: unknown,\n outputDir: string,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>,\n rewritten: Map<string, string>,\n): unknown {\n if (typeof imports === 'string') {\n return rewriteConfigImport(sourceConfigPath, imports, outputDir, platform, rewritten);\n }\n\n if (Array.isArray(imports)) {\n return imports.map((value) => typeof value === 'string'\n ? rewriteConfigImport(sourceConfigPath, value, outputDir, platform, rewritten)\n : value);\n }\n\n return imports;\n}\n\nfunction rewriteConfigImport(\n sourceConfigPath: string,\n importValue: string,\n outputDir: string,\n platform: Pick<RuntimePlatform, 'dirname' | 'ensureDir' | 'joinPath' | 'readTextFile' | 'writeTextFile'>,\n rewritten: Map<string, string>,\n): string {\n if (!importValue.startsWith('./') && !importValue.startsWith('../')) {\n return importValue;\n }\n\n const targetPath = normalizeWindowsAbsolutePath(\n path.posix.resolve(platform.dirname(sourceConfigPath), importValue),\n );\n const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, platform, rewritten);\n return pathToFileURL(rewrittenTargetPath).href;\n}\n\nexport function initRuntimeLogger(\n level: string,\n platform: Pick<RuntimePlatform, 'cwd' | 'joinPath'> = nodeRuntimePlatform,\n): void {\n const loggerFactory = new ConfigurableLoggerFactory(level, {\n fileName: platform.joinPath(platform.cwd(), 'logs/xpod-%DATE%.log'),\n showLocation: true,\n });\n setGlobalLoggerFactory(loggerFactory);\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { AuthMode } from '../authorization/AuthMode';
1
2
  /**
2
3
  * Build the environment for the CSS child process.
3
4
  *
@@ -5,11 +6,13 @@
5
6
  * The legacy CSS child process path injects it through a generated
6
7
  * Components.js config instead of CSS_* env aliases.
7
8
  */
8
- export declare function buildCssChildEnv(baseUrl: string, cssPort: number, oidcIssuer?: string, baseEnv?: NodeJS.ProcessEnv): Record<string, string>;
9
+ export declare function buildCssChildEnv(baseUrl: string, cssPort: number, oidcIssuer?: string, authModeInput?: AuthMode | string, baseEnv?: NodeJS.ProcessEnv): Record<string, string>;
9
10
  export declare function createCssChildRuntimeConfig(options: {
10
11
  configPath: string;
11
12
  runtimeRoot: string;
13
+ authMode?: AuthMode | string;
12
14
  externalOidcIssuer?: string;
15
+ baseEnv?: NodeJS.ProcessEnv;
13
16
  }): {
14
17
  configPath: string;
15
18
  cwd?: string;
@@ -27,6 +30,8 @@ export declare function buildApiChildEnv(options: {
27
30
  mainPort: number;
28
31
  cssPort: number;
29
32
  baseUrl: string;
33
+ rdfIndexPath?: string;
34
+ authMode?: AuthMode | string;
30
35
  externalOidcIssuer?: string;
31
36
  baseEnv?: NodeJS.ProcessEnv;
32
37
  }): Record<string, string>;
@@ -11,6 +11,11 @@ const node_fs_1 = __importDefault(require("node:fs"));
11
11
  const node_path_1 = __importDefault(require("node:path"));
12
12
  const node_url_1 = require("node:url");
13
13
  const oidc_issuer_1 = require("./oidc-issuer");
14
+ const AuthMode_1 = require("../authorization/AuthMode");
15
+ const bootstrap_1 = require("./bootstrap");
16
+ const CSS_COMPONENTS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld';
17
+ const XPOD_COMPONENTS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld';
18
+ const ASYNC_HANDLERS_CONTEXT = 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld';
14
19
  /**
15
20
  * Build the environment for the CSS child process.
16
21
  *
@@ -18,14 +23,16 @@ const oidc_issuer_1 = require("./oidc-issuer");
18
23
  * The legacy CSS child process path injects it through a generated
19
24
  * Components.js config instead of CSS_* env aliases.
20
25
  */
21
- function buildCssChildEnv(baseUrl, cssPort, oidcIssuer, baseEnv = process.env) {
26
+ function buildCssChildEnv(baseUrl, cssPort, oidcIssuer, authModeInput, baseEnv = process.env) {
27
+ const authMode = (0, AuthMode_1.resolveAuthModeInput)(authModeInput, baseEnv);
22
28
  const env = {
23
29
  ...baseEnv,
24
30
  CSS_PORT: cssPort.toString(),
25
31
  CSS_BASE_URL: baseUrl,
26
32
  };
33
+ (0, AuthMode_1.applyAuthModeEnv)(env, authMode);
27
34
  for (const key of Object.keys(env)) {
28
- if (key === 'oidcIssuer' || isExternalOidcPollutionKey(key)) {
35
+ if (key === 'oidcIssuer' || (isExternalOidcPollutionKey(key) && !(0, AuthMode_1.isAuthModeEnvKey)(key))) {
29
36
  delete env[key];
30
37
  }
31
38
  }
@@ -56,14 +63,17 @@ function pathNeedsEscapedFileUrl(filePath) {
56
63
  function createCssChildRuntimeConfig(options) {
57
64
  node_fs_1.default.mkdirSync(options.runtimeRoot, { recursive: true });
58
65
  const runtimeConfigPath = node_path_1.default.join(options.runtimeRoot, 'css-child-runtime.config.json');
66
+ const configImportPath = rewriteConfigForFileUrlImportsIfNeeded(node_path_1.default.resolve(options.configPath), node_path_1.default.join(options.runtimeRoot, 'config'));
67
+ const authMode = (0, AuthMode_1.resolveAuthModeInput)(options.authMode, options.baseEnv);
59
68
  node_fs_1.default.writeFileSync(runtimeConfigPath, JSON.stringify({
60
69
  '@context': [
61
- 'https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld',
62
- 'https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld',
63
- 'https://linkedsoftwaredependencies.org/bundles/npm/asynchronous-handlers/^1.0.0/components/context.jsonld',
70
+ CSS_COMPONENTS_CONTEXT,
71
+ XPOD_COMPONENTS_CONTEXT,
72
+ ASYNC_HANDLERS_CONTEXT,
64
73
  ],
65
74
  import: [
66
- toImportSpecifier(runtimeConfigPath, options.configPath),
75
+ toImportSpecifier(runtimeConfigPath, configImportPath),
76
+ ...(0, bootstrap_1.cssAuthModeConfigImports)(authMode),
67
77
  ],
68
78
  '@graph': [],
69
79
  }, null, 2), 'utf-8');
@@ -81,6 +91,41 @@ function createCssChildRuntimeConfig(options) {
81
91
  cwd: options.externalOidcIssuer ? options.runtimeRoot : undefined,
82
92
  };
83
93
  }
94
+ function rewriteConfigForFileUrlImportsIfNeeded(configPath, outputDir, rewritten = new Map()) {
95
+ if (!pathNeedsEscapedFileUrl(configPath)) {
96
+ return configPath;
97
+ }
98
+ const existing = rewritten.get(configPath);
99
+ if (existing) {
100
+ return existing;
101
+ }
102
+ node_fs_1.default.mkdirSync(outputDir, { recursive: true });
103
+ const outputPath = node_path_1.default.join(outputDir, node_path_1.default.basename(configPath));
104
+ rewritten.set(configPath, outputPath);
105
+ const parsed = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf-8'));
106
+ parsed.import = rewriteConfigImports(configPath, parsed.import, outputDir, rewritten);
107
+ node_fs_1.default.writeFileSync(outputPath, `${JSON.stringify(parsed, null, 2)}\n`, 'utf-8');
108
+ return outputPath;
109
+ }
110
+ function rewriteConfigImports(sourceConfigPath, imports, outputDir, rewritten) {
111
+ if (typeof imports === 'string') {
112
+ return rewriteConfigImport(sourceConfigPath, imports, outputDir, rewritten);
113
+ }
114
+ if (Array.isArray(imports)) {
115
+ return imports.map((value) => typeof value === 'string'
116
+ ? rewriteConfigImport(sourceConfigPath, value, outputDir, rewritten)
117
+ : value);
118
+ }
119
+ return imports;
120
+ }
121
+ function rewriteConfigImport(sourceConfigPath, importValue, outputDir, rewritten) {
122
+ if (!importValue.startsWith('./') && !importValue.startsWith('../')) {
123
+ return importValue;
124
+ }
125
+ const targetPath = node_path_1.default.resolve(node_path_1.default.dirname(sourceConfigPath), importValue);
126
+ const rewrittenTargetPath = rewriteConfigForFileUrlImportsIfNeeded(targetPath, outputDir, rewritten);
127
+ return (0, node_url_1.pathToFileURL)(rewrittenTargetPath).href;
128
+ }
84
129
  function buildCssArgs(options) {
85
130
  return [
86
131
  options.cssBinary,
@@ -91,16 +136,19 @@ function buildCssArgs(options) {
91
136
  ];
92
137
  }
93
138
  function buildApiChildEnv(options) {
94
- return {
139
+ const authMode = (0, AuthMode_1.resolveAuthModeInput)(options.authMode, options.baseEnv);
140
+ const env = {
95
141
  ...(options.baseEnv ?? process.env),
96
142
  ...(options.externalOidcIssuer ? { oidcIssuer: options.externalOidcIssuer } : {}),
97
143
  API_PORT: options.apiPort.toString(),
98
144
  XPOD_MAIN_PORT: options.mainPort.toString(),
99
145
  CSS_INTERNAL_URL: `http://localhost:${options.cssPort}`,
100
146
  CSS_BASE_URL: options.baseUrl,
147
+ ...(options.rdfIndexPath ? { CSS_RDF_INDEX_PATH: options.rdfIndexPath } : {}),
101
148
  CSS_TOKEN_ENDPOINT: options.externalOidcIssuer
102
149
  ? (0, oidc_issuer_1.oidcTokenEndpoint)(options.externalOidcIssuer)
103
150
  : `${options.baseUrl}.oidc/token`,
104
151
  };
152
+ return (0, AuthMode_1.applyAuthModeEnv)(env, authMode);
105
153
  }
106
154
  //# sourceMappingURL=css-process.js.map