@ms-cloudpack/api-server 0.14.4 → 0.16.0
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/apis/addPackageOverride.d.ts +5 -45
- package/lib/apis/addPackageOverride.d.ts.map +1 -1
- package/lib/apis/addPackageOverride.js +5 -5
- package/lib/apis/addPackageOverride.js.map +1 -1
- package/lib/apis/ensurePackageBundled.d.ts +5 -52
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +13 -7
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/getData.d.ts +5 -41
- package/lib/apis/getData.d.ts.map +1 -1
- package/lib/apis/getData.js +4 -4
- package/lib/apis/getData.js.map +1 -1
- package/lib/apis/getSessionId.d.ts +5 -40
- package/lib/apis/getSessionId.d.ts.map +1 -1
- package/lib/apis/getSessionId.js +4 -4
- package/lib/apis/getSessionId.js.map +1 -1
- package/lib/apis/index.d.ts +1 -1
- package/lib/apis/index.d.ts.map +1 -1
- package/lib/apis/index.js.map +1 -1
- package/lib/apis/onDataChanged.d.ts +5 -41
- package/lib/apis/onDataChanged.d.ts.map +1 -1
- package/lib/apis/onDataChanged.js +4 -4
- package/lib/apis/onDataChanged.js.map +1 -1
- package/lib/apis/openCodeEditor.d.ts +4 -36
- package/lib/apis/openCodeEditor.d.ts.map +1 -1
- package/lib/apis/openCodeEditor.js +2 -2
- package/lib/apis/openCodeEditor.js.map +1 -1
- package/lib/apis/openConfigEditor.d.ts +4 -33
- package/lib/apis/openConfigEditor.d.ts.map +1 -1
- package/lib/apis/openConfigEditor.js +3 -1
- package/lib/apis/openConfigEditor.js.map +1 -1
- package/lib/apis/openFilePath.d.ts +4 -36
- package/lib/apis/openFilePath.d.ts.map +1 -1
- package/lib/apis/openFilePath.js +2 -2
- package/lib/apis/openFilePath.js.map +1 -1
- package/lib/apis/reportMetric.d.ts +4 -40
- package/lib/apis/reportMetric.d.ts.map +1 -1
- package/lib/apis/reportMetric.js +4 -3
- package/lib/apis/reportMetric.js.map +1 -1
- package/lib/apis/syncDownload.d.ts +4 -44
- package/lib/apis/syncDownload.d.ts.map +1 -1
- package/lib/apis/syncDownload.js +2 -2
- package/lib/apis/syncDownload.js.map +1 -1
- package/lib/apis/syncUpload.d.ts +4 -50
- package/lib/apis/syncUpload.d.ts.map +1 -1
- package/lib/apis/syncUpload.js +2 -2
- package/lib/apis/syncUpload.js.map +1 -1
- package/lib/apis/validatePackageOverride.d.ts +10 -42
- package/lib/apis/validatePackageOverride.d.ts.map +1 -1
- package/lib/apis/validatePackageOverride.js +3 -4
- package/lib/apis/validatePackageOverride.js.map +1 -1
- package/lib/apis.d.ts +2 -1
- package/lib/apis.d.ts.map +1 -1
- package/lib/apis.js +1 -0
- package/lib/apis.js.map +1 -1
- package/lib/common/createPartialApiContext.d.ts +14 -0
- package/lib/common/createPartialApiContext.d.ts.map +1 -0
- package/lib/common/createPartialApiContext.js +101 -0
- package/lib/common/createPartialApiContext.js.map +1 -0
- package/lib/common/createSession.d.ts +13 -0
- package/lib/common/createSession.d.ts.map +1 -0
- package/lib/common/createSession.js +62 -0
- package/lib/common/createSession.js.map +1 -0
- package/lib/data/busSources.d.ts +417 -89
- package/lib/data/busSources.d.ts.map +1 -1
- package/lib/index.d.ts +9 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/startApiServer.d.ts +2 -2
- package/lib/startApiServer.d.ts.map +1 -1
- package/lib/startApiServer.js +2 -2
- package/lib/startApiServer.js.map +1 -1
- package/lib/trpc/common.d.ts +5 -53
- package/lib/trpc/common.d.ts.map +1 -1
- package/lib/trpc/common.js +3 -9
- package/lib/trpc/common.js.map +1 -1
- package/lib/trpc/createAppRouter.d.ts +25 -400
- package/lib/trpc/createAppRouter.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +5 -20
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.js.map +1 -1
- package/lib/trpc/createContextFactory.d.ts +6 -22
- package/lib/trpc/createContextFactory.d.ts.map +1 -1
- package/lib/trpc/createContextFactory.js +4 -4
- package/lib/trpc/createContextFactory.js.map +1 -1
- package/lib/trpc/createRouterFromApis.d.ts +1 -16
- package/lib/trpc/createRouterFromApis.d.ts.map +1 -1
- package/lib/types/ApiParams.d.ts +12 -0
- package/lib/types/ApiParams.d.ts.map +1 -0
- package/lib/types/ApiParams.js +2 -0
- package/lib/types/ApiParams.js.map +1 -0
- package/lib/types/Context.d.ts +19 -0
- package/lib/types/Context.d.ts.map +1 -0
- package/lib/types/Context.js +2 -0
- package/lib/types/Context.js.map +1 -0
- package/lib/types/CreateHtmlFunction.d.ts.map +1 -1
- package/lib/types/CreateHtmlFunction.js.map +1 -1
- package/lib/types/CreateHtmlOptions.d.ts +7 -4
- package/lib/types/CreateHtmlOptions.d.ts.map +1 -1
- package/lib/types/CreateHtmlOptions.js.map +1 -1
- package/lib/types/CreateHtmlResult.d.ts +8 -1
- package/lib/types/CreateHtmlResult.d.ts.map +1 -1
- package/lib/types/CreateHtmlResult.js +0 -3
- package/lib/types/CreateHtmlResult.js.map +1 -1
- package/lib/types/CreateHtmlScript.d.ts.map +1 -1
- package/lib/types/CreateHtmlScript.js.map +1 -1
- package/lib/types/Task.d.ts +2 -2
- package/lib/types/Task.d.ts.map +1 -1
- package/lib/types/Task.js.map +1 -1
- package/lib/types/TaskDescription.d.ts +319 -63
- package/lib/types/TaskDescription.d.ts.map +1 -1
- package/lib/types/TaskEndDescription.d.ts +316 -60
- package/lib/types/TaskEndDescription.d.ts.map +1 -1
- package/lib/types/TaskEndDescription.js +3 -3
- package/lib/types/TaskEndDescription.js.map +1 -1
- package/lib/utilities/addOverride.d.ts +2 -6
- package/lib/utilities/addOverride.d.ts.map +1 -1
- package/lib/utilities/addOverride.js +1 -1
- package/lib/utilities/addOverride.js.map +1 -1
- package/lib/utilities/bundleTask.d.ts +3 -1
- package/lib/utilities/bundleTask.d.ts.map +1 -1
- package/lib/utilities/bundleTask.js +5 -4
- package/lib/utilities/bundleTask.js.map +1 -1
- package/lib/utilities/calculateHashOfInlinedDependencies.d.ts +9 -0
- package/lib/utilities/calculateHashOfInlinedDependencies.d.ts.map +1 -0
- package/lib/utilities/calculateHashOfInlinedDependencies.js +18 -0
- package/lib/utilities/calculateHashOfInlinedDependencies.js.map +1 -0
- package/lib/utilities/createBundleRequestForPackage.d.ts +2 -1
- package/lib/utilities/createBundleRequestForPackage.d.ts.map +1 -1
- package/lib/utilities/createBundleRequestForPackage.js +3 -2
- package/lib/utilities/createBundleRequestForPackage.js.map +1 -1
- package/lib/utilities/createBundleTask.d.ts +7 -1
- package/lib/utilities/createBundleTask.d.ts.map +1 -1
- package/lib/utilities/createBundleTask.js +4 -3
- package/lib/utilities/createBundleTask.js.map +1 -1
- package/lib/utilities/findPackageOverride.d.ts +1 -1
- package/lib/utilities/findPackageOverride.d.ts.map +1 -1
- package/lib/utilities/findPackageOverride.js.map +1 -1
- package/lib/utilities/getBundleDetails.d.ts +2 -0
- package/lib/utilities/getBundleDetails.d.ts.map +1 -1
- package/lib/utilities/getBundleDetails.js +3 -7
- package/lib/utilities/getBundleDetails.js.map +1 -1
- package/lib/utilities/getPackageHashEntries.d.ts +69 -0
- package/lib/utilities/getPackageHashEntries.d.ts.map +1 -0
- package/lib/utilities/getPackageHashEntries.js +29 -0
- package/lib/utilities/getPackageHashEntries.js.map +1 -0
- package/lib/utilities/getPackagePath.d.ts +16 -0
- package/lib/utilities/getPackagePath.d.ts.map +1 -0
- package/lib/utilities/getPackagePath.js +19 -0
- package/lib/utilities/getPackagePath.js.map +1 -0
- package/lib/utilities/getPackagesToSync.js +1 -1
- package/lib/utilities/getPackagesToSync.js.map +1 -1
- package/lib/utilities/getSourceHash.d.ts +9 -0
- package/lib/utilities/getSourceHash.d.ts.map +1 -0
- package/lib/utilities/getSourceHash.js +21 -0
- package/lib/utilities/getSourceHash.js.map +1 -0
- package/lib/utilities/hashPackage.d.ts +6 -4
- package/lib/utilities/hashPackage.d.ts.map +1 -1
- package/lib/utilities/hashPackage.js +21 -15
- package/lib/utilities/hashPackage.js.map +1 -1
- package/lib/utilities/resolveDependenciesTask.d.ts +16 -0
- package/lib/utilities/resolveDependenciesTask.d.ts.map +1 -0
- package/lib/utilities/resolveDependenciesTask.js +65 -0
- package/lib/utilities/resolveDependenciesTask.js.map +1 -0
- package/lib/utilities/validateOverride.d.ts +2 -6
- package/lib/utilities/validateOverride.d.ts.map +1 -1
- package/lib/utilities/validateOverride.js.map +1 -1
- package/package.json +10 -9
- package/lib/types/BundleResultExtended.d.ts +0 -23
- package/lib/types/BundleResultExtended.d.ts.map +0 -1
- package/lib/types/BundleResultExtended.js +0 -2
- package/lib/types/BundleResultExtended.js.map +0 -1
- package/lib/types/DevServer.d.ts +0 -33
- package/lib/types/DevServer.d.ts.map +0 -1
- package/lib/types/DevServer.js +0 -2
- package/lib/types/DevServer.js.map +0 -1
- package/lib/types/PackageOverride.d.ts +0 -8
- package/lib/types/PackageOverride.d.ts.map +0 -1
- package/lib/types/PackageOverride.js +0 -2
- package/lib/types/PackageOverride.js.map +0 -1
- package/lib/types/Route.d.ts +0 -23
- package/lib/types/Route.d.ts.map +0 -1
- package/lib/types/Route.js +0 -2
- package/lib/types/Route.js.map +0 -1
- package/lib/types/SessionStats.d.ts +0 -8
- package/lib/types/SessionStats.d.ts.map +0 -1
- package/lib/types/SessionStats.js +0 -2
- package/lib/types/SessionStats.js.map +0 -1
- package/lib/types/TaskError.d.ts +0 -25
- package/lib/types/TaskError.d.ts.map +0 -1
- package/lib/types/TaskError.js +0 -10
- package/lib/types/TaskError.js.map +0 -1
- package/lib/types/TelemetryConfig.d.ts +0 -7
- package/lib/types/TelemetryConfig.d.ts.map +0 -1
- package/lib/types/TelemetryConfig.js +0 -2
- package/lib/types/TelemetryConfig.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCloudpackServer.js","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,EAAE,eAAe,EAAkB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAK3C;IACC,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,WAAW,CAAC;IAC1E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,EAAE,CAAC;IAC3C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC;QAC1C,UAAU,EAAE,IAAI,EAAE;QAClB,MAAM;QACN,aAAa;QACb,KAAK;KACN,CAAC,CAAC;IACH,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE5C,eAAe,CAAY;QACzB,GAAG;QACH,MAAM;QACN,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEvB,MAAM,gBAAgB,GAAG,MAAM,aAAa,EAAE,CAAC;IAC/C,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAE5D,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,EAAE,GAAG,iBAAiB,MAAM,QAAQ,IAAI,IAAI,EAAE;QACjD,IAAI;QACJ,GAAG,EAAE,gBAAgB;QAErB,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAID,8FAA8F;AAC9F,8DAA8D;AAC9D,SAAS,WAAW,CAClB,IAAW,EACX,GAAa;IAEb,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAChC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE;QAC1B,GAAG,CAAC,GAAkB,CAAC,GAAG,CAAC,KAAgD,EAAE,EAAE;QAC7E,+DAA+D;QAC/D,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAuG,CACxG,CAAC;AACJ,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type {
|
|
1
|
+
{"version":3,"file":"createCloudpackServer.js","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,EAAE,eAAe,EAAkB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAK3C;IACC,MAAM,aAAa,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,WAAW,CAAC;IAC1E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC;IACvD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,EAAE,CAAC;IAC3C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC;QAC1C,UAAU,EAAE,IAAI,EAAE;QAClB,MAAM;QACN,aAAa;QACb,KAAK;KACN,CAAC,CAAC;IACH,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/C,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAE5C,eAAe,CAAY;QACzB,GAAG;QACH,MAAM;QACN,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEvB,MAAM,gBAAgB,GAAG,MAAM,aAAa,EAAE,CAAC;IAC/C,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAE5D,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,EAAE,GAAG,iBAAiB,MAAM,QAAQ,IAAI,IAAI,EAAE;QACjD,IAAI;QACJ,GAAG,EAAE,gBAAgB;QAErB,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAID,8FAA8F;AAC9F,8DAA8D;AAC9D,SAAS,WAAW,CAClB,IAAW,EACX,GAAa;IAEb,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAChC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE;QAC1B,GAAG,CAAC,GAAkB,CAAC,GAAG,CAAC,KAAgD,EAAE,EAAE;QAC7E,+DAA+D;QAC/D,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAuG,CACxG,CAAC;AACJ,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { applyWSSHandler } from '@trpc/server/adapters/ws';\nimport getPort from 'get-port';\nimport { WebSocketServer } from 'ws';\nimport type { Session } from '../types/Session.js';\nimport { createAppRouter, type AppRouter } from './createAppRouter.js';\nimport { createContextFactory } from './createContextFactory.js';\nimport { createHTTPServer } from './httpAdapter.js';\nimport cors from 'cors';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\n\nexport async function createCloudpackServer(options: {\n session: Session;\n telemetryClient: TelemetryClient;\n reporter: TaskReporter;\n packages: PackageDefinitionsCache;\n}) {\n const createContext = await createContextFactory(options);\n const hostname = options.session.config?.devServer?.domain || 'localhost';\n const https = options.session.config?.devServer?.https;\n const port = await getPort({ port: [9890, 9891, 9892, 9893] });\n const { router, apis } = createAppRouter();\n const { server, listen } = createHTTPServer({\n middleware: cors(),\n router,\n createContext,\n https,\n });\n const webSocketProtocol = https ? 'wss' : 'ws';\n const wss = new WebSocketServer({ server });\n\n applyWSSHandler<AppRouter>({\n wss,\n router,\n createContext,\n });\n\n listen(port, hostname);\n\n const localCallContext = await createContext();\n const apisWithContext = withContext(apis, localCallContext);\n\n return {\n ...apisWithContext,\n url: `${webSocketProtocol}://${hostname}:${port}`,\n port,\n ctx: localCallContext,\n\n close: async () => {\n await localCallContext.dispose();\n server.close();\n wss.close();\n },\n };\n}\n\nexport type CloudpackServer = ReturnType<typeof createCloudpackServer>;\n\n/** Helper to tie the local call context with the apis so callers don't have to cache them. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withContext<TApis extends { [key: string]: (options: { input: any; ctx: TContext }) => any }, TContext>(\n apis: TApis,\n ctx: TContext,\n) {\n return Object.entries(apis).reduce(\n (acc, [key, apiFunction]) => {\n acc[key as keyof TApis] = (input: Parameters<TApis[typeof key]>[0]['input']) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n apiFunction({ input, ctx });\n return acc;\n },\n {} as { [key in keyof TApis]: (options: Parameters<TApis[key]>[0]['input']) => ReturnType<TApis[key]> },\n );\n}\n"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Session } from '../types/Session.js';
|
|
2
|
+
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
4
3
|
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
5
|
-
import {
|
|
4
|
+
import type { Context } from '../types/Context.js';
|
|
5
|
+
import type { Session } from '../types/Session.js';
|
|
6
|
+
export type CreateContext = () => Promise<Context>;
|
|
6
7
|
/**
|
|
7
8
|
* Creates the server context and returns a connection context factory.
|
|
8
9
|
* The context object is accessible to apis and serves as a way to share stateful
|
|
@@ -11,24 +12,7 @@ import { TaskRunner } from '../utilities/TaskRunner.js';
|
|
|
11
12
|
export declare function createContextFactory(options: {
|
|
12
13
|
session: Session;
|
|
13
14
|
reporter: TaskReporter;
|
|
14
|
-
|
|
15
|
-
packages: PackageDefinitionsCache;
|
|
16
|
-
}): Promise<() => Promise<{
|
|
17
|
-
session: Session;
|
|
18
|
-
bus: import("@ms-cloudpack/data-bus").DataBus;
|
|
19
|
-
rootSpan: Span | undefined;
|
|
20
|
-
reporter: TaskReporter;
|
|
21
|
-
watcher: {
|
|
22
|
-
watch({ path, watchPaths, }: {
|
|
23
|
-
path: string;
|
|
24
|
-
watchPaths?: string[] | undefined;
|
|
25
|
-
}, onPackageChanged: () => void): () => Promise<void>;
|
|
26
|
-
unwatchAll(): Promise<void>;
|
|
27
|
-
};
|
|
15
|
+
telemetryClient: TelemetryClient;
|
|
28
16
|
packages: PackageDefinitionsCache;
|
|
29
|
-
|
|
30
|
-
dispose(): Promise<void>;
|
|
31
|
-
}>>;
|
|
32
|
-
export type CreateContext = Awaited<ReturnType<typeof createContextFactory>>;
|
|
33
|
-
export type Context = Awaited<ReturnType<CreateContext>>;
|
|
17
|
+
}): Promise<CreateContext>;
|
|
34
18
|
//# sourceMappingURL=createContextFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContextFactory.d.ts","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createContextFactory.d.ts","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnD;;;;GAIG;AAEH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,uBAAuB,CAAC;CACnC,0BA6CA"}
|
|
@@ -8,7 +8,7 @@ import { TaskRunner } from '../utilities/TaskRunner.js';
|
|
|
8
8
|
*/
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
10
10
|
export async function createContextFactory(options) {
|
|
11
|
-
const { session,
|
|
11
|
+
const { session, telemetryClient, reporter, packages } = options;
|
|
12
12
|
// const host = config?.devServer?.domain || 'localhost';
|
|
13
13
|
// const port = await getPort({ port: [9890, 9891, 9892, 9893] });
|
|
14
14
|
// const bus = createDataBus();
|
|
@@ -19,14 +19,14 @@ export async function createContextFactory(options) {
|
|
|
19
19
|
// us to choose what we expose to each client from server context, but also allows us to
|
|
20
20
|
// add additional context to each connection.
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
22
|
-
async
|
|
22
|
+
const createContext = async () => {
|
|
23
23
|
return {
|
|
24
24
|
// session manager
|
|
25
25
|
session,
|
|
26
26
|
// data bus
|
|
27
27
|
bus,
|
|
28
28
|
// telemetry
|
|
29
|
-
|
|
29
|
+
telemetryClient,
|
|
30
30
|
// logging
|
|
31
31
|
reporter,
|
|
32
32
|
// file watcher
|
|
@@ -40,7 +40,7 @@ export async function createContextFactory(options) {
|
|
|
40
40
|
await watcher.unwatchAll();
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
return createContext;
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=createContextFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContextFactory.js","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createContextFactory.js","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAMxD;;;;GAIG;AACH,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAK1C;IACC,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACjE,yDAAyD;IACzD,kEAAkE;IAClE,+BAA+B;IAE/B,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,yFAAyF;IACzF,wFAAwF;IACxF,6CAA6C;IAC7C,4DAA4D;IAC5D,MAAM,aAAa,GAAkB,KAAK,IAAI,EAAE;QAC9C,OAAO;YACL,kBAAkB;YAClB,OAAO;YAEP,WAAW;YACX,GAAG;YAEH,YAAY;YACZ,eAAe;YAEf,UAAU;YACV,QAAQ;YAER,eAAe;YACf,OAAO;YAEP,WAAW;YACX,QAAQ;YAER,QAAQ;YACR,UAAU;YAEV,2CAA2C;YAC3C,KAAK,CAAC,OAAO;gBACX,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC7B,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { createDataBus } from '@ms-cloudpack/data-bus';\nimport { createWatcher } from '@ms-cloudpack/file-watcher';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { Context } from '../types/Context.js';\nimport type { Session } from '../types/Session.js';\n\nexport type CreateContext = () => Promise<Context>;\n\n/**\n * Creates the server context and returns a connection context factory.\n * The context object is accessible to apis and serves as a way to share stateful\n * objects across them.\n */\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function createContextFactory(options: {\n session: Session;\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n packages: PackageDefinitionsCache;\n}) {\n const { session, telemetryClient, reporter, packages } = options;\n // const host = config?.devServer?.domain || 'localhost';\n // const port = await getPort({ port: [9890, 9891, 9892, 9893] });\n // const bus = createDataBus();\n\n const bus = createDataBus();\n const watcher = createWatcher();\n const taskRunner = new TaskRunner();\n\n // Return the factory function which creates a context object per connection. This allows\n // us to choose what we expose to each client from server context, but also allows us to\n // add additional context to each connection.\n // eslint-disable-next-line @typescript-eslint/require-await\n const createContext: CreateContext = async () => {\n return {\n // session manager\n session,\n\n // data bus\n bus,\n\n // telemetry\n telemetryClient,\n\n // logging\n reporter,\n\n // file watcher\n watcher,\n\n // packages\n packages,\n\n // tasks\n taskRunner,\n\n // dispose things that the context creates.\n async dispose() {\n await watcher.unwatchAll();\n },\n };\n };\n\n return createContext;\n}\n"]}
|
|
@@ -4,22 +4,7 @@ export declare function createRouterFromApis<TData extends {
|
|
|
4
4
|
procedure: AnyProcedure;
|
|
5
5
|
};
|
|
6
6
|
}>(apis: TData): import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
7
|
-
ctx:
|
|
8
|
-
session: import("../index.js").Session;
|
|
9
|
-
bus: import("@ms-cloudpack/data-bus").DataBus;
|
|
10
|
-
rootSpan: import("@opentelemetry/api").Span | undefined;
|
|
11
|
-
reporter: import("@ms-cloudpack/task-reporter").TaskReporter;
|
|
12
|
-
watcher: {
|
|
13
|
-
watch({ path, watchPaths, }: {
|
|
14
|
-
path: string;
|
|
15
|
-
watchPaths?: string[] | undefined;
|
|
16
|
-
}, onPackageChanged: () => void): () => Promise<void>;
|
|
17
|
-
unwatchAll(): Promise<void>;
|
|
18
|
-
};
|
|
19
|
-
packages: import("@ms-cloudpack/bundler-types").PackageDefinitionsCache;
|
|
20
|
-
taskRunner: import("../index.js").TaskRunner;
|
|
21
|
-
dispose(): Promise<void>;
|
|
22
|
-
};
|
|
7
|
+
ctx: import("../index.js").Context;
|
|
23
8
|
meta: object;
|
|
24
9
|
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
25
10
|
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRouterFromApis.d.ts","sourceRoot":"","sources":["../../src/trpc/createRouterFromApis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,oBAAoB,CAAC,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,EAAE,IAAI,EAAE,KAAK
|
|
1
|
+
{"version":3,"file":"createRouterFromApis.d.ts","sourceRoot":"","sources":["../../src/trpc/createRouterFromApis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,oBAAoB,CAAC,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,EAAE,IAAI,EAAE,KAAK;;;;;wDAU7G"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from './Context.js';
|
|
2
|
+
/**
|
|
3
|
+
* API function parameter object. These property names are defined by TRPC.
|
|
4
|
+
*
|
|
5
|
+
* If `input` is not needed, use `ApiParams<void, yourKeysHere>`.
|
|
6
|
+
* If `ctx` is not needed, use `ApiParams<yourInputHere, never>`.
|
|
7
|
+
*/
|
|
8
|
+
export interface ApiParams<TInput, TContextKeys extends keyof Context> {
|
|
9
|
+
input: TInput;
|
|
10
|
+
ctx: Pick<Context, TContextKeys>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ApiParams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiParams.d.ts","sourceRoot":"","sources":["../../src/types/ApiParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,SAAS,CAAC,MAAM,EAAE,YAAY,SAAS,MAAM,OAAO;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiParams.js","sourceRoot":"","sources":["../../src/types/ApiParams.ts"],"names":[],"mappings":"","sourcesContent":["import type { Context } from './Context.js';\n\n/**\n * API function parameter object. These property names are defined by TRPC.\n *\n * If `input` is not needed, use `ApiParams<void, yourKeysHere>`.\n * If `ctx` is not needed, use `ApiParams<yourInputHere, never>`.\n */\nexport interface ApiParams<TInput, TContextKeys extends keyof Context> {\n input: TInput;\n ctx: Pick<Context, TContextKeys>;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
2
|
+
import type { DataBus } from '@ms-cloudpack/data-bus';
|
|
3
|
+
import type { Watcher } from '@ms-cloudpack/file-watcher';
|
|
4
|
+
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
5
|
+
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
6
|
+
import type { Session } from '../types/Session.js';
|
|
7
|
+
import type { TaskRunner } from '../utilities/TaskRunner.js';
|
|
8
|
+
/** Context for Cloudpack API server procedures. */
|
|
9
|
+
export interface Context {
|
|
10
|
+
session: Session;
|
|
11
|
+
bus: DataBus;
|
|
12
|
+
telemetryClient: TelemetryClient;
|
|
13
|
+
reporter: TaskReporter;
|
|
14
|
+
watcher: Watcher;
|
|
15
|
+
packages: PackageDefinitionsCache;
|
|
16
|
+
taskRunner: TaskRunner;
|
|
17
|
+
dispose(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,mDAAmD;AACnD,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { DataBus } from '@ms-cloudpack/data-bus';\nimport type { Watcher } from '@ms-cloudpack/file-watcher';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { Session } from '../types/Session.js';\nimport type { TaskRunner } from '../utilities/TaskRunner.js';\n\n/** Context for Cloudpack API server procedures. */\nexport interface Context {\n session: Session;\n bus: DataBus;\n telemetryClient: TelemetryClient;\n reporter: TaskReporter;\n watcher: Watcher;\n packages: PackageDefinitionsCache;\n taskRunner: TaskRunner;\n dispose(): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlFunction.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;
|
|
1
|
+
{"version":3,"file":"CreateHtmlFunction.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,gBAAgB,CAAC,GAAG,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlFunction.js","sourceRoot":"","sources":["../../src/types/CreateHtmlFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type { CreateHtmlOptions } from './CreateHtmlOptions.js';\nimport type { CreateHtmlResult } from './CreateHtmlResult.js';\n\n/**\n * A custom server render function that can be used to override the default HTML response.\n */\
|
|
1
|
+
{"version":3,"file":"CreateHtmlFunction.js","sourceRoot":"","sources":["../../src/types/CreateHtmlFunction.ts"],"names":[],"mappings":"","sourcesContent":["import type { CreateHtmlOptions } from './CreateHtmlOptions.js';\nimport type { CreateHtmlResult } from './CreateHtmlResult.js';\n\n/**\n * A custom server render function that can be used to override the default HTML response.\n */\nexport type CreateHtmlFunction = (options: CreateHtmlOptions) => Promise<CreateHtmlResult> | CreateHtmlResult;\n"]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ImportMap } from '@ms-cloudpack/package-utilities';
|
|
2
2
|
import type { PackageJson } from '@ms-cloudpack/bundler-types';
|
|
3
|
+
import type { Route } from '@ms-cloudpack/config';
|
|
4
|
+
import type { Request, Response } from '@ms-cloudpack/create-express-app';
|
|
3
5
|
import type { Session } from './Session.js';
|
|
4
|
-
import type { Route } from './Route.js';
|
|
5
6
|
/**
|
|
6
|
-
* The input options for a createHtml custom server render function.
|
|
7
|
+
* The input options for a `createHtml` custom server render function.
|
|
7
8
|
*/
|
|
8
|
-
export
|
|
9
|
+
export interface CreateHtmlOptions {
|
|
9
10
|
session: Session;
|
|
10
11
|
route: Route;
|
|
11
12
|
baseUrl: string;
|
|
@@ -14,5 +15,7 @@ export type CreateHtmlOptions = {
|
|
|
14
15
|
overlayScript: string | undefined;
|
|
15
16
|
entryScript: string | undefined;
|
|
16
17
|
inlineScripts: string[];
|
|
17
|
-
|
|
18
|
+
req: Request;
|
|
19
|
+
res: Response;
|
|
20
|
+
}
|
|
18
21
|
//# sourceMappingURL=CreateHtmlOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlOptions.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CreateHtmlOptions.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,QAAQ,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlOptions.js","sourceRoot":"","sources":["../../src/types/CreateHtmlOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImportMap } from '@ms-cloudpack/package-utilities';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport type {
|
|
1
|
+
{"version":3,"file":"CreateHtmlOptions.js","sourceRoot":"","sources":["../../src/types/CreateHtmlOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { ImportMap } from '@ms-cloudpack/package-utilities';\nimport type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { Route } from '@ms-cloudpack/config';\nimport type { Request, Response } from '@ms-cloudpack/create-express-app';\nimport type { Session } from './Session.js';\n\n/**\n * The input options for a `createHtml` custom server render function.\n */\nexport interface CreateHtmlOptions {\n session: Session;\n route: Route;\n baseUrl: string;\n definition: PackageJson;\n importMap: ImportMap;\n overlayScript: string | undefined;\n entryScript: string | undefined;\n inlineScripts: string[];\n req: Request;\n res: Response;\n}\n"]}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a custom HtmlResult object returned from running the renderScript for a Route
|
|
3
|
+
*/
|
|
4
|
+
export type CustomHtmlResult = {
|
|
5
|
+
type: 'static-html' | 'js' | 'json';
|
|
6
|
+
content: string;
|
|
7
|
+
};
|
|
1
8
|
/**
|
|
2
9
|
* The expected result of the createHtml custom server render function.
|
|
3
10
|
*/
|
|
4
11
|
export type CreateHtmlResult = string | {
|
|
5
12
|
html: string;
|
|
6
13
|
statusCode: number;
|
|
7
|
-
};
|
|
14
|
+
} | CustomHtmlResult;
|
|
8
15
|
//# sourceMappingURL=CreateHtmlResult.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlResult.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlResult.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"CreateHtmlResult.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,MAAM,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,GACD,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlResult.js","sourceRoot":"","sources":["../../src/types/CreateHtmlResult.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CreateHtmlResult.js","sourceRoot":"","sources":["../../src/types/CreateHtmlResult.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Represents a custom HtmlResult object returned from running the renderScript for a Route\n */\nexport type CustomHtmlResult = {\n type: 'static-html' | 'js' | 'json';\n content: string;\n};\n\n/**\n * The expected result of the createHtml custom server render function.\n */\nexport type CreateHtmlResult =\n | string\n | {\n html: string;\n statusCode: number;\n }\n | CustomHtmlResult;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlScript.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlScript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;GAEG;
|
|
1
|
+
{"version":3,"file":"CreateHtmlScript.d.ts","sourceRoot":"","sources":["../../src/types/CreateHtmlScript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateHtmlScript.js","sourceRoot":"","sources":["../../src/types/CreateHtmlScript.ts"],"names":[],"mappings":"","sourcesContent":["import type { CreateHtmlFunction } from './CreateHtmlFunction.js';\n\n/**\n * The expected shape of the createHtml custom server render function script.\n */\
|
|
1
|
+
{"version":3,"file":"CreateHtmlScript.js","sourceRoot":"","sources":["../../src/types/CreateHtmlScript.ts"],"names":[],"mappings":"","sourcesContent":["import type { CreateHtmlFunction } from './CreateHtmlFunction.js';\n\n/**\n * The expected shape of the createHtml custom server render function script.\n */\nexport type CreateHtmlScript = { default: CreateHtmlFunction };\n"]}
|
package/lib/types/Task.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TaskError } from './TaskError.js';
|
|
2
1
|
import type { TaskStartDescription } from './TaskStartDescription.js';
|
|
3
2
|
import type { TaskEndDescription } from './TaskEndDescription.js';
|
|
3
|
+
import type { TaskMessage } from './TaskMessage.js';
|
|
4
4
|
export interface Task<TReturn> {
|
|
5
5
|
name: string;
|
|
6
6
|
id: string;
|
|
@@ -10,7 +10,7 @@ export interface Task<TReturn> {
|
|
|
10
10
|
watch?: boolean;
|
|
11
11
|
dispose?: () => Promise<void>;
|
|
12
12
|
onDispose?: () => void;
|
|
13
|
-
getErrors?: () =>
|
|
13
|
+
getErrors?: () => TaskMessage[] | undefined;
|
|
14
14
|
getStartDescription?: () => TaskStartDescription;
|
|
15
15
|
getEndDescription?: (result: TReturn | undefined) => TaskEndDescription;
|
|
16
16
|
}
|
package/lib/types/Task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../src/types/Task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../src/types/Task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,IAAI,CAAC,OAAO;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,WAAW,EAAE,GAAG,SAAS,CAAC;IAC5C,mBAAmB,CAAC,EAAE,MAAM,oBAAoB,CAAC;IACjD,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,KAAK,kBAAkB,CAAC;CACzE"}
|
package/lib/types/Task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../src/types/Task.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../src/types/Task.ts"],"names":[],"mappings":"","sourcesContent":["import type { TaskStartDescription } from './TaskStartDescription.js';\nimport type { TaskEndDescription } from './TaskEndDescription.js';\nimport type { TaskMessage } from './TaskMessage.js';\n\nexport interface Task<TReturn> {\n name: string;\n id: string;\n dir?: string;\n execute: () => Promise<TReturn | undefined>;\n clear?: () => void;\n watch?: boolean;\n dispose?: () => Promise<void>;\n onDispose?: () => void;\n getErrors?: () => TaskMessage[] | undefined;\n getStartDescription?: () => TaskStartDescription;\n getEndDescription?: (result: TReturn | undefined) => TaskEndDescription;\n}\n"]}
|