@ms-cloudpack/api-server 0.60.2 → 0.61.1
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 +1 -1
- package/lib/apis/addPackageOverride.d.ts.map +1 -1
- package/lib/apis/addPackageOverride.js.map +1 -1
- package/lib/apis/ensurePackageBundled.d.ts +4 -4
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +6 -15
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/getSessionId.d.ts +1 -1
- package/lib/apis/getSessionId.d.ts.map +1 -1
- package/lib/apis/getSessionId.js.map +1 -1
- package/lib/apis/linkPath.d.ts +1 -1
- package/lib/apis/linkPath.d.ts.map +1 -1
- package/lib/apis/linkPath.js.map +1 -1
- package/lib/apis/openConfigEditor.d.ts +1 -1
- package/lib/apis/openConfigEditor.d.ts.map +1 -1
- package/lib/apis/openConfigEditor.js.map +1 -1
- package/lib/apis/openFilePath.d.ts +1 -1
- package/lib/apis/openFilePath.d.ts.map +1 -1
- package/lib/apis/openFilePath.js.map +1 -1
- package/lib/apis/reportSpan.d.ts +1 -1
- package/lib/apis/reportSpan.d.ts.map +1 -1
- package/lib/apis/reportSpan.js.map +1 -1
- package/lib/apis/restartAllTasks.d.ts +1 -1
- package/lib/apis/restartAllTasks.d.ts.map +1 -1
- package/lib/apis/restartAllTasks.js.map +1 -1
- package/lib/apis/restartTask.d.ts +1 -1
- package/lib/apis/restartTask.d.ts.map +1 -1
- package/lib/apis/restartTask.js.map +1 -1
- package/lib/apis/syncDownload.d.ts +5 -2
- package/lib/apis/syncDownload.d.ts.map +1 -1
- package/lib/apis/syncDownload.js +4 -2
- package/lib/apis/syncDownload.js.map +1 -1
- package/lib/apis/syncUpload.d.ts +7 -4
- package/lib/apis/syncUpload.d.ts.map +1 -1
- package/lib/apis/syncUpload.js +30 -13
- package/lib/apis/syncUpload.js.map +1 -1
- package/lib/apis/unlinkPath.d.ts +1 -1
- package/lib/apis/unlinkPath.d.ts.map +1 -1
- package/lib/apis/unlinkPath.js.map +1 -1
- package/lib/apis/validatePackageOverride.d.ts +1 -1
- package/lib/apis/validatePackageOverride.d.ts.map +1 -1
- package/lib/apis/validatePackageOverride.js.map +1 -1
- package/lib/common/createApiContext.d.ts +3 -2
- package/lib/common/createApiContext.d.ts.map +1 -1
- package/lib/common/createApiContext.js +4 -8
- package/lib/common/createApiContext.js.map +1 -1
- package/lib/task-scheduler/TaskScheduler.d.ts +1 -1
- package/lib/task-scheduler/TaskScheduler.d.ts.map +1 -1
- package/lib/types/ApiParams.d.ts +9 -6
- package/lib/types/ApiParams.d.ts.map +1 -1
- package/lib/types/ApiParams.js.map +1 -1
- package/lib/types/Context.d.ts +10 -6
- package/lib/types/Context.d.ts.map +1 -1
- package/lib/types/Context.js.map +1 -1
- package/lib/utilities/addOverride.d.ts +2 -2
- package/lib/utilities/addOverride.d.ts.map +1 -1
- package/lib/utilities/addOverride.js.map +1 -1
- package/lib/utilities/createBundleTask.d.ts.map +1 -1
- package/lib/utilities/createBundleTask.js +2 -4
- package/lib/utilities/createBundleTask.js.map +1 -1
- package/lib/utilities/createRemoteCacheClient.d.ts +3 -3
- package/lib/utilities/createRemoteCacheClient.d.ts.map +1 -1
- package/lib/utilities/createRemoteCacheClient.js +3 -4
- package/lib/utilities/createRemoteCacheClient.js.map +1 -1
- package/lib/utilities/notifyReload.d.ts +2 -2
- package/lib/utilities/notifyReload.d.ts.map +1 -1
- package/lib/utilities/notifyReload.js.map +1 -1
- package/lib/utilities/validateOverride.d.ts +2 -2
- package/lib/utilities/validateOverride.d.ts.map +1 -1
- package/lib/utilities/validateOverride.js.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncUpload.js","sourceRoot":"","sources":["../../src/apis/syncUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAoC,MA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urePackageBundled, type EnsurePackageBundledContext } from './ensurePackageBundled.js';\nimport { PerfMeasurementSyncUpload } from '../performance/markers.js';\nimport { getRemoteCachePromiseResultCounts } from '../utilities/getRemoteCachePromiseResultCounts.js';\nimport { createRemoteCacheClientOperationOptions } from '../utilities/createRemoteCacheClientOperationOptions.js';\nimport { createUploadTask } from '../utilities/createUploadTask.js';\nimport { isStaticRoute } from '@ms-cloudpack/common-types';\nimport path from 'path';\nimport { getBundleLocation } from '../utilities/getBundleLocation.js';\nimport { cp } from 'fs/promises';\nimport objectHash from 'object-hash';\nimport type { SyncResult } from '../types/SyncResult.js';\nimport { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';\nimport { getRemoteCachePackageId } from '../utilities/getRemoteCachePackageId.js';\nimport type { LoginMethod } from '@ms-cloudpack/remote-cache';\n\n/**\n * Bundle the current app and its dependencies, and upload them to the remote cache.\n */\nexport async function syncUpload(\n input: { login: LoginMethod },\n ctx: Omit<EnsurePackageBundledContext, 'bus' | 'watcher'>,\n): Promise<SyncResult> {\n const { login } = input;\n const { session, telemetryClient, taskRunner, remoteCacheClient: client } = ctx;\n const { config } = session;\n const { appPath } = config;\n const { remoteCache: remoteCacheConfig } = config;\n const syncInternalPackages = config?.features?.syncInternalPackages ?? false;\n\n ensureRemoteCacheEnabled(config);\n\n if (!client) {\n throw new Error('Remote cache client is required to sync upload');\n }\n\n if (!remoteCacheConfig) {\n throw new Error('Remote cache configuration is required to sync upload');\n }\n\n // Glob pattern for the files to upload.\n const globMatches = ['**/*', '!**/*-input.json', '!**/*-output.json'];\n\n return await telemetryClient.tracer.startActiveSpan(PerfMeasurementSyncUpload, async (span) => {\n const { name, version, description } = await ctx.packages.get(appPath);\n\n const { dependencies, result: bundleResult } = await ensurePackageBundled(\n { name, version, enqueueDependencies: true },\n ctx,\n );\n\n const bundledPackages = [bundleResult, ...(await dependencies)];\n const packagesToUpload = await Promise.all(\n bundledPackages\n .filter((p) => p.inputPath && (p.isExternal || syncInternalPackages))\n .map((p) =>\n createRemoteCacheClientOperationOptions(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- verified above that it's set\n { packagePath: p.inputPath! },\n ctx,\n ),\n ),\n );\n\n if (config.features?.enableCloudHosted) {\n const appBundleLocation = await getBundleLocation({ packagePath: appPath }, ctx);\n const appOutputPath = appBundleLocation.path;\n const destinationFolder = path.join(appOutputPath, '__cloudpack');\n const routesPath = path.join(destinationFolder, 'routes');\n for (const route of config.routes ?? []) {\n if (isStaticRoute(route)) {\n const staticPath = path.resolve(appPath, route.staticPath);\n const routeHash = objectHash(route);\n const folderPath = path.join(routesPath, routeHash);\n await cp(staticPath, path.join(folderPath, route.staticPath), { recursive: true });\n }\n }\n\n const { createAppRegistryClient } = await import('@ms-cloudpack/remote-cache');\n const appRegistryClient = await createAppRegistryClient({\n context: ctx,\n options: { cachePath: session.cachePath, loginMethod: login },\n });\n\n await appRegistryClient.registerApp({\n name,\n // Using the current date and time as the version, because most apps are not versioned.\n version: new Date().toISOString().slice(16).replace('T', ' '),\n resourceId: await getRemoteCachePackageId({ packagePath: appPath }, ctx),\n storageAccount: remoteCacheConfig.storageAccount,\n container: remoteCacheConfig.container,\n tenantId: remoteCacheConfig.tenantId,\n description,\n localBundleFolderName: appBundleLocation.folderName,\n });\n }\n\n const uploads = packagesToUpload.map((pkg) =>\n taskRunner.add(createUploadTask({ client, options: { ...pkg, globMatches } })),\n );\n\n // Do not reject if there is a failure. Failed uploads will be logged in the task reporter.\n const promiseResults = await Promise.allSettled(uploads);\n\n const result = getRemoteCachePromiseResultCounts(promiseResults);\n span.setAttributes(result);\n\n return result;\n });\n}\n\n// This function doesn't have an attached procedure because it's never called via the TRPC server.\n"]}
|
package/lib/apis/unlinkPath.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type LinkPathInput, type LinkPathOutput } from '../types/LinkPath.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Unlinks a path to the session.
|
|
5
5
|
*/
|
|
6
|
-
export declare function unlinkPath(params: ApiParams<LinkPathInput, '
|
|
6
|
+
export declare function unlinkPath(params: ApiParams<LinkPathInput, 'bus' | 'reporter' | 'telemetryClient', 'incrementSessionVersion' | 'linkedPaths' | 'projectName' | 'removeLinkedPath' | 'resolveMap' | 'sequence'>): Promise<LinkPathOutput>;
|
|
7
7
|
export declare namespace unlinkPath {
|
|
8
8
|
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
9
9
|
input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlinkPath.d.ts","sourceRoot":"","sources":["../../src/apis/unlinkPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAuC,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEpH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"unlinkPath.d.ts","sourceRoot":"","sources":["../../src/apis/unlinkPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAuC,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEpH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CACf,aAAa,EACb,KAAK,GAAG,UAAU,GAAG,iBAAiB,EACtC,yBAAyB,GAAG,aAAa,GAAG,aAAa,GAAG,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAC3G,GACA,OAAO,CAAC,cAAc,CAAC,CAmBzB;yBAzBqB,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlinkPath.js","sourceRoot":"","sources":["../../src/apis/unlinkPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,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AAM,YAAY,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,UAAU,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { publicProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { notifyReload } from '../utilities/notifyReload.js';\nimport { ZodLinkPathInput, ZodLinkPathOutput, type LinkPathInput, type LinkPathOutput } from '../types/LinkPath.js';\n\n/**\n * Unlinks a path to the session.\n */\nexport async function unlinkPath(\n params: ApiParams<\n LinkPathInput,\n 'bus' | 'reporter' | 'telemetryClient',\n 'incrementSessionVersion' | 'linkedPaths' | 'projectName' | 'removeLinkedPath' | 'resolveMap' | 'sequence'\n >,\n): Promise<LinkPathOutput> {\n const { input, ctx } = params;\n const { linkedPath } = input;\n const { session, reporter, bus, telemetryClient } = ctx;\n const task = reporter.addTask(`Unlinking paths in ${session.projectName}`);\n let result = { resolveMap: session.resolveMap, linkedPaths: session.linkedPaths };\n try {\n await telemetryClient.tracer.startActiveSpan('UNLINK_PATH', async () => {\n // Remove linked paths from session\n result = await session.removeLinkedPath(linkedPath);\n task.complete({ status: 'complete', message: `Unlinked paths`, forceShow: true });\n session.incrementSessionVersion();\n await notifyReload({ reason: 'unlink-path' }, { bus, session, telemetryClient });\n });\n } catch (e) {\n task.complete({ status: 'fail', message: `Failed to unlink paths`, forceShow: true });\n }\n\n return result;\n}\n\nunlinkPath.procedure = publicProcedure.input(ZodLinkPathInput).output(ZodLinkPathOutput).query(unlinkPath);\n"]}
|
|
@@ -4,7 +4,7 @@ export type ValidatePackageOverrideInput = Omit<OverrideOptions, 'version'>;
|
|
|
4
4
|
export interface ValidatePackageOverrideOutput {
|
|
5
5
|
fixable: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function validatePackageOverride(params: ApiParams<ValidatePackageOverrideInput, '
|
|
7
|
+
export declare function validatePackageOverride(params: ApiParams<ValidatePackageOverrideInput, 'bus' | 'packages', 'config' | 'resolveMap'>): Promise<ValidatePackageOverrideOutput>;
|
|
8
8
|
export declare namespace validatePackageOverride {
|
|
9
9
|
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
10
10
|
input: ValidatePackageOverrideInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validatePackageOverride.d.ts","sourceRoot":"","sources":["../../src/apis/validatePackageOverride.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAQ5E,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,CAAC,4BAA4B,EAAE,
|
|
1
|
+
{"version":3,"file":"validatePackageOverride.d.ts","sourceRoot":"","sources":["../../src/apis/validatePackageOverride.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AAQ5E,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,CAAC,4BAA4B,EAAE,KAAK,GAAG,UAAU,EAAE,QAAQ,GAAG,YAAY,CAAC,GAC3F,OAAO,CAAC,6BAA6B,CAAC,CAUxC;yBAZqB,uBAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validatePackageOverride.js","sourceRoot":"","sources":["../../src/apis/validatePackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAKtE,MAAM,+BAA+B,GAAG,iBAAiB,CAA+B;IACtF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAMH,MAAM,gCAAgC,GAAG,iBAAiB,CAAgC;IACxF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,
|
|
1
|
+
{"version":3,"file":"validatePackageOverride.js","sourceRoot":"","sources":["../../src/apis/validatePackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAKtE,MAAM,+BAA+B,GAAG,iBAAiB,CAA+B;IACtF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAMH,MAAM,gCAAgC,GAAG,iBAAiB,CAAgC;IACxF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAA4F;IAE5F,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;QACnD,4GAA4G;QAC5G,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,uBAAuB,CAAC,SAAS,GAAG,eAAe;KAChD,KAAK,CAAC,+BAA+B,CAAC;KACtC,MAAM,CAAC,gCAAgC,CAAC;KACxC,KAAK,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport { validateOverride } from '../utilities/validateOverride.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { errorEntrySource } from '../index.browser.js';\nimport { matchingZodObject } from '../utilities/matchingZodObject.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\n\nexport type ValidatePackageOverrideInput = Omit<OverrideOptions, 'version'>;\n\nconst ZodValidatePackageOverrideInput = matchingZodObject<ValidatePackageOverrideInput>({\n packageName: z.string(),\n importPath: z.string(),\n issuerUrl: z.string().optional(),\n});\n\nexport interface ValidatePackageOverrideOutput {\n fixable: boolean;\n}\n\nconst ZodValidatePackageOverrideOutput = matchingZodObject<ValidatePackageOverrideOutput>({\n fixable: z.boolean(),\n});\n\nexport async function validatePackageOverride(\n params: ApiParams<ValidatePackageOverrideInput, 'bus' | 'packages', 'config' | 'resolveMap'>,\n): Promise<ValidatePackageOverrideOutput> {\n const { input, ctx } = params;\n if (ctx.session.config.features?.autoUpdateEntries) {\n // We need to publish an empty string to the errorEntrySource as the error has been received on the overlay.\n ctx.bus.publish(errorEntrySource, '');\n }\n\n return {\n fixable: await validateOverride(input, ctx),\n };\n}\n\nvalidatePackageOverride.procedure = publicProcedure\n .input(ZodValidatePackageOverrideInput)\n .output(ZodValidatePackageOverrideOutput)\n .query(validatePackageOverride);\n"]}
|
|
@@ -22,8 +22,9 @@ export declare function createPartialApiContext(options: CreateApiContextOptions
|
|
|
22
22
|
*
|
|
23
23
|
* When finished with the context, call `dispose` to clean up resources.
|
|
24
24
|
*
|
|
25
|
-
* NOTE: This version initializes the data bus and the file watcher, which are only needed
|
|
26
|
-
* starting
|
|
25
|
+
* NOTE: This version initializes the data bus and the file watcher, which are only needed when
|
|
26
|
+
* starting a server (and add unnecessary overhead otherwise). For other commands, use
|
|
27
|
+
* `createPartialApiContext`.
|
|
27
28
|
*/
|
|
28
29
|
export declare function createApiContext(options: CreateApiContextOptions): Promise<Context>;
|
|
29
30
|
//# sourceMappingURL=createApiContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApiContext.d.ts","sourceRoot":"","sources":["../../src/common/createApiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,MAAM,WAAW,uBACf,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,iBAAiB,GAAG,YAAY,CAAC;IAC9D;;;OAGG;IACH,4BAA4B,CAAC,EAAE,WAAW,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"createApiContext.d.ts","sourceRoot":"","sources":["../../src/common/createApiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,MAAM,WAAW,uBACf,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,iBAAiB,GAAG,YAAY,CAAC;IAC9D;;;OAGG;IACH,4BAA4B,CAAC,EAAE,WAAW,CAAC;CAC5C;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,CA0BvD;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBzF"}
|
|
@@ -21,12 +21,7 @@ export function createPartialApiContext(options) {
|
|
|
21
21
|
});
|
|
22
22
|
let remoteCacheClient;
|
|
23
23
|
if (remoteCacheClientLoginMethod) {
|
|
24
|
-
remoteCacheClient = await createRemoteCacheClient({
|
|
25
|
-
input: {
|
|
26
|
-
loginMethod: remoteCacheClientLoginMethod,
|
|
27
|
-
},
|
|
28
|
-
ctx: { session, reporter, telemetryClient },
|
|
29
|
-
});
|
|
24
|
+
remoteCacheClient = await createRemoteCacheClient({ loginMethod: remoteCacheClientLoginMethod }, { session, reporter, telemetryClient });
|
|
30
25
|
}
|
|
31
26
|
return { reporter, taskRunner, telemetryClient, packageHashes, packages, session, remoteCacheClient };
|
|
32
27
|
});
|
|
@@ -37,8 +32,9 @@ export function createPartialApiContext(options) {
|
|
|
37
32
|
*
|
|
38
33
|
* When finished with the context, call `dispose` to clean up resources.
|
|
39
34
|
*
|
|
40
|
-
* NOTE: This version initializes the data bus and the file watcher, which are only needed
|
|
41
|
-
* starting
|
|
35
|
+
* NOTE: This version initializes the data bus and the file watcher, which are only needed when
|
|
36
|
+
* starting a server (and add unnecessary overhead otherwise). For other commands, use
|
|
37
|
+
* `createPartialApiContext`.
|
|
42
38
|
*/
|
|
43
39
|
export async function createApiContext(options) {
|
|
44
40
|
return options.telemetryClient.tracer.startActiveSpan('CREATE_API_CONTEXT', async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createApiContext.js","sourceRoot":"","sources":["../../src/common/createApiContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAYhE;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAgC;IAEhC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,4BAA4B,EAAE,GAAG,OAAO,CAAC;IAEhG,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QACrF,wDAAwD;QACxD,MAAM,QAAQ,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAEtD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM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AAG,CAAC,CAAC;QAErC,OAAO;YACL,GAAG,OAAO;YACV,GAAG;YACH,OAAO;YACP,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;SACjC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Context } from '../types/Context.js';\nimport type { CreateSessionOptions } from './createSession.js';\nimport type { LoginMethod } from '@ms-cloudpack/remote-cache';\nimport { createRemoteCacheClient } from '../utilities/createRemoteCacheClient.js';\nimport { createPackageDefinitions } from '@ms-cloudpack/config';\n\nexport interface CreateApiContextOptions\n extends CreateSessionOptions,\n Pick<Context, 'reporter' | 'telemetryClient' | 'taskRunner'> {\n /**\n * Login method for the remote cache.\n * If this isn't provided, `context.remoteCacheClient` will not be set.\n */\n remoteCacheClientLoginMethod?: LoginMethod;\n}\n\n/**\n * Asynchronously initialize a partial `Context`, encapsulating async importing of certain modules\n * to speed up boot time.\n *\n * This version skips some properties that are only needed for starting an app.\n * For a full context, use `createApiContext`.\n */\nexport function createPartialApiContext(\n options: CreateApiContextOptions,\n): Promise<Omit<Context, 'bus' | 'watcher' | 'dispose'>> {\n const { reporter, taskRunner, telemetryClient, config, remoteCacheClientLoginMethod } = options;\n\n return telemetryClient.tracer.startActiveSpan('CREATE_PARTIAL_API_CONTEXT', async () => {\n // Start by creating the properties that are always used\n const packages = createPackageDefinitions({ config });\n\n const { createSession } = await import('./createSession.js');\n const session = await createSession(options, { reporter, packages, telemetryClient });\n\n const { PackageHashes } = await import('@ms-cloudpack/package-hashes');\n const packageHashes = new PackageHashes({\n cwd: config.appPath,\n context: { config, packages, resolveMap: session.resolveMap },\n });\n\n let remoteCacheClient: Context['remoteCacheClient'] | undefined;\n if (remoteCacheClientLoginMethod) {\n remoteCacheClient = await createRemoteCacheClient(\n { loginMethod: remoteCacheClientLoginMethod },\n { session, reporter, telemetryClient },\n );\n }\n\n return { reporter, taskRunner, telemetryClient, packageHashes, packages, session, remoteCacheClient };\n });\n}\n\n/**\n * Asynchronously initialize a `Context`, encapsulating async importing of certain packages/modules\n * to speed up boot time.\n *\n * When finished with the context, call `dispose` to clean up resources.\n *\n * NOTE: This version initializes the data bus and the file watcher, which are only needed when\n * starting a server (and add unnecessary overhead otherwise). For other commands, use\n * `createPartialApiContext`.\n */\nexport async function createApiContext(options: CreateApiContextOptions): Promise<Context> {\n return options.telemetryClient.tracer.startActiveSpan('CREATE_API_CONTEXT', async () => {\n const context = await createPartialApiContext(options);\n\n const { createWatcher } = await import('@ms-cloudpack/file-watcher');\n const watcher = createWatcher({\n type: context.session.config.features?.enableWatcherInFork ? 'fork' : 'default',\n });\n\n const { createDataBus } = await import('@ms-cloudpack/data-bus');\n const bus = createDataBus();\n // Without this line, the overlay won't work.\n context.taskRunner.connectToBus(bus);\n\n return {\n ...context,\n bus,\n watcher,\n dispose: () => watcher.dispose(),\n };\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
2
2
|
import type { BundleRequest } from '../types/BundleRequest.js';
|
|
3
|
-
export declare const require:
|
|
3
|
+
export declare const require: NodeJS.Require;
|
|
4
4
|
interface TaskSchedulerOptions {
|
|
5
5
|
reporter: TaskReporter;
|
|
6
6
|
root: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskScheduler.d.ts","sourceRoot":"","sources":["../../src/task-scheduler/TaskScheduler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"TaskScheduler.d.ts","sourceRoot":"","sources":["../../src/task-scheduler/TaskScheduler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,eAAO,MAAM,OAAO,gBAAiC,CAAC;AAEtD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,aAAa;;gBAGZ,OAAO,EAAE,oBAAoB;IAMnC,YAAY,CAAC,CAAC,SAAS,aAAa,EACxC,aAAa,EAAE,CAAC,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GACA,OAAO,CAAC,IAAI,CAAC;CAajB"}
|
package/lib/types/ApiParams.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Session } from '@ms-cloudpack/common-types';
|
|
2
|
+
import type { Context, PartialContext } from './Context.js';
|
|
2
3
|
/**
|
|
3
|
-
* API function parameter object. These property names are defined by
|
|
4
|
+
* tRPC API function parameter object. These property names are defined by tRPC,
|
|
5
|
+
* and the type should only be used for tRPC APIs.
|
|
4
6
|
*
|
|
5
|
-
* If `input` is not needed, use `ApiParams<void, yourKeysHere>`.
|
|
6
|
-
* If `ctx` is not needed, use `ApiParams<yourInputHere
|
|
7
|
+
* - If `input` is not needed, use `ApiParams<void, yourKeysHere>`.
|
|
8
|
+
* - If `ctx` is not needed, use `ApiParams<yourInputHere>`.
|
|
9
|
+
* - `ctx.session` will always be defined, with the given subset of keys.
|
|
7
10
|
*/
|
|
8
|
-
export interface ApiParams<TInput, TContextKeys extends keyof Context> {
|
|
11
|
+
export interface ApiParams<TInput, TContextKeys extends keyof Context = never, TSessionKeys extends keyof Session = never> {
|
|
9
12
|
input: TInput;
|
|
10
|
-
ctx:
|
|
13
|
+
ctx: PartialContext<TContextKeys, TSessionKeys>;
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=ApiParams.d.ts.map
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"ApiParams.d.ts","sourceRoot":"","sources":["../../src/types/ApiParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS,CACxB,MAAM,EACN,YAAY,SAAS,MAAM,OAAO,GAAG,KAAK,EAC1C,YAAY,SAAS,MAAM,OAAO,GAAG,KAAK;IAE1C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;CACjD"}
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"file":"ApiParams.js","sourceRoot":"","sources":["../../src/types/ApiParams.ts"],"names":[],"mappings":"","sourcesContent":["import type { Session } from '@ms-cloudpack/common-types';\nimport type { Context, PartialContext } from './Context.js';\n\n/**\n * tRPC API function parameter object. These property names are defined by tRPC,\n * and the type should only be used for tRPC APIs.\n *\n * - If `input` is not needed, use `ApiParams<void, yourKeysHere>`.\n * - If `ctx` is not needed, use `ApiParams<yourInputHere>`.\n * - `ctx.session` will always be defined, with the given subset of keys.\n */\nexport interface ApiParams<\n TInput,\n TContextKeys extends keyof Context = never,\n TSessionKeys extends keyof Session = never,\n> {\n input: TInput;\n ctx: PartialContext<TContextKeys, TSessionKeys>;\n}\n"]}
|
package/lib/types/Context.d.ts
CHANGED
|
@@ -5,19 +5,23 @@ import type { TaskReporter } from '@ms-cloudpack/task-reporter';
|
|
|
5
5
|
import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
6
6
|
import type { TaskRunner } from '../utilities/TaskRunner.js';
|
|
7
7
|
import type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Context for Cloudpack API server procedures and other APIs.
|
|
10
|
+
*
|
|
11
|
+
* Use `PartialContext` if you only need a subset of properties.
|
|
12
|
+
*/
|
|
9
13
|
export interface Context {
|
|
10
14
|
session: Session;
|
|
11
|
-
/** Data bus for sending notifications to the client. */
|
|
12
|
-
bus: DataBus;
|
|
13
15
|
telemetryClient: TelemetryClient;
|
|
14
16
|
reporter: TaskReporter;
|
|
15
|
-
/** Only used by `ensurePackageBundled`. */
|
|
16
|
-
watcher?: Watcher;
|
|
17
17
|
packages: PackageDefinitionsCache;
|
|
18
18
|
taskRunner: TaskRunner;
|
|
19
19
|
packageHashes: PackageHashesCache;
|
|
20
20
|
remoteCacheClient?: RemoteCacheClient;
|
|
21
|
+
/** Data bus for sending notifications to the client. */
|
|
22
|
+
bus: DataBus;
|
|
23
|
+
/** Only used by `ensurePackageBundled`. */
|
|
24
|
+
watcher: Watcher;
|
|
21
25
|
/** Only set if `watcher` is initialized. */
|
|
22
26
|
dispose?: () => void | Promise<void>;
|
|
23
27
|
}
|
|
@@ -26,7 +30,7 @@ export interface Context {
|
|
|
26
30
|
* First param is context keys and second is session keys.
|
|
27
31
|
* (This can make it easier to tell which properties are actually used where.)
|
|
28
32
|
*/
|
|
29
|
-
export type PartialContext<TContextKeys extends keyof
|
|
33
|
+
export type PartialContext<TContextKeys extends keyof Context, TSessionKeys extends keyof Session = never> = Pick<Context, Exclude<TContextKeys, 'session'>> & {
|
|
30
34
|
session: Pick<Session, TSessionKeys>;
|
|
31
35
|
};
|
|
32
36
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvG,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,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACvG,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,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,kBAAkB,CAAC;IAClC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAKtC,wDAAwD;IACxD,GAAG,EAAE,OAAO,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,YAAY,SAAS,MAAM,OAAO,EAAE,YAAY,SAAS,MAAM,OAAO,GAAG,KAAK,IAAI,IAAI,CAC/G,OAAO,EACP,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,CACjC,GAAG;IACF,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;CACtC,CAAC"}
|
package/lib/types/Context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageDefinitionsCache, PackageHashesCache, Session } from '@ms-cloudpack/common-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 { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\n\n
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageDefinitionsCache, PackageHashesCache, Session } from '@ms-cloudpack/common-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 { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { RemoteCacheClient } from '@ms-cloudpack/remote-cache';\n\n/**\n * Context for Cloudpack API server procedures and other APIs.\n *\n * Use `PartialContext` if you only need a subset of properties.\n */\nexport interface Context {\n session: Session;\n telemetryClient: TelemetryClient;\n reporter: TaskReporter;\n packages: PackageDefinitionsCache;\n taskRunner: TaskRunner;\n packageHashes: PackageHashesCache;\n remoteCacheClient?: RemoteCacheClient;\n\n // The properties below here are only needed for Cloudpack server operations (any server type),\n // such as tRPC APIs or bundling and watching files.\n\n /** Data bus for sending notifications to the client. */\n bus: DataBus;\n /** Only used by `ensurePackageBundled`. */\n watcher: Watcher;\n /** Only set if `watcher` is initialized. */\n dispose?: () => void | Promise<void>;\n}\n\n/**\n * Helper for partial context and session objects.\n * First param is context keys and second is session keys.\n * (This can make it easier to tell which properties are actually used where.)\n */\nexport type PartialContext<TContextKeys extends keyof Context, TSessionKeys extends keyof Session = never> = Pick<\n Context,\n Exclude<TContextKeys, 'session'>\n> & {\n session: Pick<Session, TSessionKeys>;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolveMapEntry } from '@ms-cloudpack/common-types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PartialContext } from '../types/Context.js';
|
|
3
3
|
import type { OverrideOptions } from '../types/OverrideOptions.js';
|
|
4
4
|
type OverrideReturn = {
|
|
5
5
|
/** Whether the override was successfully added */
|
|
@@ -11,6 +11,6 @@ type OverrideReturn = {
|
|
|
11
11
|
* The addOverride method is triggered by a user action in the overlay, when we detect new usage of an import path
|
|
12
12
|
* that isn't recognized. When the user triggers this override, we write it to the cloudpack generated config.
|
|
13
13
|
*/
|
|
14
|
-
export declare function addOverride(options: OverrideOptions, context:
|
|
14
|
+
export declare function addOverride(options: OverrideOptions, context: PartialContext<'packages', 'config' | 'resolveMap'>): Promise<OverrideReturn>;
|
|
15
15
|
export {};
|
|
16
16
|
//# sourceMappingURL=addOverride.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAUlE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"addOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAUlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,KAAK,cAAc,GAAG;IACpB,kDAAkD;IAClD,aAAa,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,KAAK,EAAE,eAAe,GAAG,SAAS,CAAC;CACpC,CAAC;AAaF;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,cAAc,CAAC,UAAU,EAAE,QAAQ,GAAG,YAAY,CAAC,GAC3D,OAAO,CAAC,cAAc,CAAC,CA2GzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAWnF;;;;;GAKG;AACH,IAAI,iBAAiB,GAA4B,OAAO,CAAC,OAAO,CAAC;IAC/D,aAAa,EAAE,KAAK;IACpB,KAA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C;QACjE,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACvB,IAAI,iBAAiB,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CAAC,qCAAqC,IAAI,mCAAmC,CAAC,CAAC;gBAC1F,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACzB,OAAO,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;gBAC5E,CAAC;YACH,CAAC;iBAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBAChC,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iCAAiC,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;QAED,0EAA0E;QAC1E,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import type { ResolveMapEntry } from '@ms-cloudpack/common-types';\nimport { ensureGeneratedSettingsForPackage, readGeneratedConfig, writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { parseRequestInfo } from '@ms-cloudpack/import-map';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n} from '@ms-cloudpack/package-utilities';\nimport { makeUrl, normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport type { PartialContext } from '../types/Context.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\n\ntype OverrideReturn = {\n /** Whether the override was successfully added */\n addedOverride: boolean;\n /** The entry (if any) in the resolve map the override was added to */\n entry: ResolveMapEntry | undefined;\n};\n\n/**\n * Helper so that when addOverride is called multiple times in quick succession, we only process one at a time.\n * This is to avoid that multiple calls of addOverride first read the same version of the generated config,\n * then write the same version of the config with its corresponding update,\n * which would result in the last call overwriting the changes of the previous calls.\n */\nlet overrideInProcess: Promise<OverrideReturn> = Promise.resolve({\n addedOverride: false,\n entry: undefined,\n});\n\n/**\n * The addOverride method is triggered by a user action in the overlay, when we detect new usage of an import path\n * that isn't recognized. When the user triggers this override, we write it to the cloudpack generated config.\n */\nexport async function addOverride(\n options: OverrideOptions,\n context: PartialContext<'packages', 'config' | 'resolveMap'>,\n): Promise<OverrideReturn> {\n overrideInProcess = overrideInProcess.then(async () => {\n const { packageName, importPath, version, issuerUrl } = options;\n const { session, packages } = context;\n const { appPath } = session.config;\n let addedOverride = false;\n let deletedNullExport = false;\n let requiredBy = undefined;\n\n if (importPath.endsWith('/')) {\n console.error(`The import path \"${importPath}\" is invalid. Please remove the trailing slash and try again.`);\n return { addedOverride, entry: undefined };\n }\n\n if (issuerUrl) {\n const { packageName: issuerName, version: issuerVersion } = parseRequestInfo(makeUrl(issuerUrl).pathname);\n requiredBy = { name: issuerName, version: issuerVersion };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition: requiredBy,\n version,\n });\n\n if (!entry) {\n console.error(`Could not find entry of package \"${packageName}\" in resolve map`);\n return { addedOverride, entry };\n }\n\n const packagePath = entry.path;\n\n // Get current exports. We want to add an additional entry to what's there - not replace the default exports,\n // so we need the full map for the package.\n const exports = await getExportsMap({ packagePath }, { packages, config: session.config });\n const flattenedExports = flattenExportsMap(exports);\n const normalizedImportPath = normalizeRelativePath(importPath);\n\n // Return false if the import path already exists in the exports map.\n if (flattenedExports[normalizedImportPath]) {\n console.debug(`The import path \"${importPath}\" already exists in the exports map for \"${packageName}\".`);\n return { addedOverride, entry };\n }\n\n // Parse the generated config if it exists.\n const generatedConfig = await readGeneratedConfig(appPath);\n\n // Ensure packageSettings exists.\n const generatedPackageSettings = await ensureGeneratedSettingsForPackage(\n { packagePath },\n { config: { generated: generatedConfig }, packages },\n );\n\n if (generatedPackageSettings?.exports && generatedPackageSettings.exports[normalizedImportPath] === null) {\n delete generatedPackageSettings.exports[normalizedImportPath];\n deletedNullExport = true;\n\n if (Object.keys(generatedPackageSettings.exports).length === 0) {\n delete generatedPackageSettings.exports;\n }\n addedOverride = true;\n } else {\n const generatedExports = (generatedPackageSettings.exports ??= {});\n\n // Add the single new exports entry to the exports map.\n addedOverride = await addExportsMapEntry(\n {\n exports: generatedExports,\n packagePath,\n importPath,\n },\n { packages, config: session.config },\n );\n\n if (!addedOverride) {\n console.warn(\n `Unable to add override for package \"${packageName}\" to \"cloudpack.generated.json\".` +\n ` The file \"${normalizedImportPath}\" could not be found.` +\n ` Please check the import path and try again.`,\n );\n return { addedOverride, entry };\n }\n }\n\n // Write the updated generated config\n session.config.generated = generatedConfig;\n const result = await writeGeneratedConfig(generatedConfig, appPath);\n const desc = `\"${packageName}\" (path \"${normalizedImportPath}\")`;\n if (result !== 'no-op') {\n if (deletedNullExport) {\n console.log(`Removed generated null export for ${desc} from \"cloudpack.generated.json\".`);\n if (result === 'deleted') {\n console.log(`Deleted \"cloudpack.generated.json\" because it's now empty.`);\n }\n } else if (result === 'written') {\n console.log(`Added override for ${desc} to \"cloudpack.generated.json\".`);\n }\n }\n\n // Apply the generated exports again to ensure the exports are up to date.\n await packages.get(packagePath, { refresh: true });\n\n return { addedOverride, entry };\n });\n\n return overrideInProcess;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,GACxB,cAAc,CAAC,eAAe,EAAE,MAAM,iBAAiB,CAAC,SAAS,CAAC,GAAG,WAAW,GAAG,oBAAoB,GAAG,MAAM,CAAC,GAClH,IAAI,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"createBundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,GACxB,cAAc,CAAC,eAAe,EAAE,MAAM,iBAAiB,CAAC,SAAS,CAAC,GAAG,WAAW,GAAG,oBAAoB,GAAG,MAAM,CAAC,GAClH,IAAI,CAAC,aAAa,CAAC,CA0DrB"}
|
|
@@ -23,11 +23,9 @@ export function createBundleTask(options, context) {
|
|
|
23
23
|
try {
|
|
24
24
|
// Add a hash to the import map for this package.
|
|
25
25
|
// (Read the session properties here rather than above because they might not be set yet.)
|
|
26
|
-
|
|
27
|
-
const { bundleServer, appServer } = session.urls;
|
|
28
|
-
if (importMap && bundleServer && appServer) {
|
|
26
|
+
if (session.importMap && session.urls.bundleServer && session.urls.appServer) {
|
|
29
27
|
const importMapHash = sourceHash || hash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: !isExternal }));
|
|
30
|
-
addImportMapHash({ packageName, version, hash: importMapHash },
|
|
28
|
+
addImportMapHash({ packageName, version, hash: importMapHash }, context);
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
31
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAkD,MAAM,iBAAiB,CAAC;AAG7F;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAA0B,EAC1B,OACmH;IAEnH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IAC5E,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACrC,MAAM,IAAI,GAAG,UAAU,WAAW,IAAI,OAAO,EAAE,CAAC;IAEhD,OAAO;QACL,gCAAgC;QAChC,IAAI;QACJ,EAAE;QACF,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;QACvC,KAAK,EAAE,CAAC,UAAU;QAClB,KAAK,CAAC,OAAO;YACX,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEnC,IAAI,CAAC;gBACH,iDAAiD;gBACjD,0FAA0F;gBAC1F,
|
|
1
|
+
{"version":3,"file":"createBundleTask.js","sourceRoot":"","sources":["../../src/utilities/createBundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAkD,MAAM,iBAAiB,CAAC;AAG7F;;;GAGG;AACH,MAAM,UAAU,gB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QACD,KAAK,EAAE,GAAG,EAAE;YACV,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;gBACtC,OAAO;YACT,CAAC;YAED,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YAEjC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAE7E,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC;QACnC,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;QACpC,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM;QAC7C,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC;YAC1B,EAAE;YACF,kCAAkC;YAClC,IAAI;YACJ,SAAS,EAAE,WAAW,IAAI,EAAE;SAC7B,CAAC;QACF,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAClC,EAAE;YACF,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;YAClC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ;YACtC,UAAU,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE;SACnD,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import { addImportMapHash } from '@ms-cloudpack/import-map';\nimport fs from 'fs';\nimport path from 'path';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { Task } from '../types/Task.js';\nimport { bundleTask, type BundleTaskContext, type BundleTaskOptions } from './bundleTask.js';\nimport type { PartialContext } from '../types/Context.js';\n\n/**\n * Create a bundle task (internally calls `bundleTask()`) that can be executed by the server's TaskRunner.\n * This allows active tasks to be tracked remotely (e.g. in the browser) and allows the user to cancel tasks.\n */\nexport function createBundleTask(\n options: BundleTaskOptions,\n context: BundleTaskContext &\n PartialContext<'packageHashes', keyof BundleTaskContext['session'] | 'importMap' | 'packageImportPaths' | 'urls'>,\n): Task<BundleRequest> {\n const { bundleRequest } = options;\n const { id, packageName, version, packagePath, isExternal } = bundleRequest;\n const { packageHashes, session } = context;\n const { hash, sourceHash } = options;\n const name = `Bundle ${packageName}@${version}`;\n\n return {\n // Name for task runner logging.\n name,\n id,\n dir: `${path.join(packagePath, 'src')}`,\n watch: !isExternal,\n async execute(): Promise<BundleRequest> {\n await bundleTask(options, context);\n\n try {\n // Add a hash to the import map for this package.\n // (Read the session properties here rather than above because they might not be set yet.)\n if (session.importMap && session.urls.bundleServer && session.urls.appServer) {\n const importMapHash =\n sourceHash || hash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: !isExternal }));\n addImportMapHash({ packageName, version, hash: importMapHash }, context);\n }\n } catch (e) {\n console.error(`Error adding hash to import map for ${bundleRequest.packagePath}:`, (e as Error).stack || e);\n }\n\n return bundleRequest;\n },\n clear: () => {\n if (!bundleRequest.result?.outputPath) {\n return;\n }\n\n bundleRequest.result.dispose?.();\n\n fs.rmSync(bundleRequest.result.outputPath, { recursive: true, force: true });\n\n bundleRequest.result = undefined;\n },\n onDispose: () => {\n bundleRequest.result?.dispose?.();\n },\n getErrors: () => bundleRequest.result?.errors,\n getStartDescription: () => ({\n id,\n // Name to display in the overlay.\n name,\n inputPath: packagePath || '',\n }),\n getEndDescription: (taskResult) => ({\n id,\n errors: taskResult?.result?.errors,\n warnings: taskResult?.result?.warnings,\n outputPath: bundleRequest.result?.outputPath || '',\n }),\n };\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { LoginMethod, RemoteCacheClient } from '@ms-cloudpack/remote-cache';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PartialContext } from '../types/Context.js';
|
|
3
3
|
/**
|
|
4
4
|
* Lazy loads the remote cache client and returns it.
|
|
5
5
|
* @returns - The remote cache client if it is configured, otherwise undefined.
|
|
6
6
|
*/
|
|
7
|
-
export declare function createRemoteCacheClient(
|
|
7
|
+
export declare function createRemoteCacheClient(options: {
|
|
8
8
|
loginMethod: LoginMethod;
|
|
9
|
-
}, '
|
|
9
|
+
}, context: PartialContext<'reporter' | 'telemetryClient', 'cachePath' | 'config'>): Promise<RemoteCacheClient | undefined>;
|
|
10
10
|
//# sourceMappingURL=createRemoteCacheClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRemoteCacheClient.d.ts","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"createRemoteCacheClient.d.ts","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE;IACP,WAAW,EAAE,WAAW,CAAC;CAC1B,EACD,OAAO,EAAE,cAAc,CAAC,UAAU,GAAG,iBAAiB,EAAE,WAAW,GAAG,QAAQ,CAAC,GAC9E,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAoBxC"}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Lazy loads the remote cache client and returns it.
|
|
3
3
|
* @returns - The remote cache client if it is configured, otherwise undefined.
|
|
4
4
|
*/
|
|
5
|
-
export async function createRemoteCacheClient(
|
|
6
|
-
const {
|
|
7
|
-
const {
|
|
8
|
-
const { session, reporter, telemetryClient } = ctx;
|
|
5
|
+
export async function createRemoteCacheClient(options, context) {
|
|
6
|
+
const { loginMethod } = options;
|
|
7
|
+
const { session, reporter, telemetryClient } = context;
|
|
9
8
|
if (!session.config.remoteCache) {
|
|
10
9
|
// Remote cache is not configured, return undefined.
|
|
11
10
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,
|
|
1
|
+
{"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAEC,EACD,OAA+E;IAE/E,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAChC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEvD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAChC,oDAAoD;QACpD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;IAE3E,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QACrF,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;QAErE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,uBAAuB,CAAC;YAC7D,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE;YACtC,OAAO,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE;SAC5F,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { LoginMethod, RemoteCacheClient } from '@ms-cloudpack/remote-cache';\nimport type { PartialContext } from '../types/Context.js';\n\n/**\n * Lazy loads the remote cache client and returns it.\n * @returns - The remote cache client if it is configured, otherwise undefined.\n */\nexport async function createRemoteCacheClient(\n options: {\n loginMethod: LoginMethod;\n },\n context: PartialContext<'reporter' | 'telemetryClient', 'cachePath' | 'config'>,\n): Promise<RemoteCacheClient | undefined> {\n const { loginMethod } = options;\n const { session, reporter, telemetryClient } = context;\n\n if (!session.config.remoteCache) {\n // Remote cache is not configured, return undefined.\n return undefined;\n }\n const { container, storageAccount, tenantId } = session.config.remoteCache;\n\n return telemetryClient.tracer.startActiveSpan('CREATE_REMOTE_CACHE_CLIENT', async () => {\n const remoteCacheModule = await import('@ms-cloudpack/remote-cache');\n\n const client = await remoteCacheModule.createRemoteCacheClient({\n context: { reporter, telemetryClient },\n options: { container, loginMethod, storageAccount, cachePath: session.cachePath, tenantId },\n });\n\n return client;\n });\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PartialContext } from '../types/Context.js';
|
|
2
2
|
/**
|
|
3
3
|
* Notifies clients that a reload is needed by incrementing the session version.
|
|
4
4
|
*/
|
|
5
5
|
export declare function notifyReload(options: {
|
|
6
6
|
reason: string;
|
|
7
|
-
}, context:
|
|
7
|
+
}, context: PartialContext<'bus' | 'telemetryClient', 'sequence'>): Promise<void>;
|
|
8
8
|
//# sourceMappingURL=notifyReload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyReload.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"notifyReload.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAC3B,OAAO,EAAE,cAAc,CAAC,KAAK,GAAG,iBAAiB,EAAE,UAAU,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyReload.js","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA2B,EAC3B,
|
|
1
|
+
{"version":3,"file":"notifyReload.js","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA2B,EAC3B,OAA8D;IAE9D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAElD,MAAM,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;QACrE,OAAO,CAAC,QAAQ,EAAE,CAAC;QAEnB,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAE3D,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { reloadCountSource } from '../data/busSources.js';\nimport type { PartialContext } from '../types/Context.js';\n\n/**\n * Notifies clients that a reload is needed by incrementing the session version.\n */\nexport async function notifyReload(\n options: { reason: string },\n context: PartialContext<'bus' | 'telemetryClient', 'sequence'>,\n): Promise<void> {\n const { reason } = options;\n const { bus, session, telemetryClient } = context;\n\n await telemetryClient.tracer.startActiveSpan('NOTIFY_RELOAD', (span) => {\n session.sequence++;\n\n span.setAttributes({ sequence: session.sequence, reason });\n\n bus.publish(reloadCountSource, session.sequence);\n });\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PartialContext } from '../types/Context.js';
|
|
2
2
|
import type { OverrideOptions } from '../types/OverrideOptions.js';
|
|
3
3
|
/**
|
|
4
4
|
* Given a package name, import path, and optional issuerUrl, returns a boolean indicating if the given
|
|
5
5
|
* override is valid.
|
|
6
6
|
*/
|
|
7
|
-
export declare function validateOverride(options: OverrideOptions, context:
|
|
7
|
+
export declare function validateOverride(options: Omit<OverrideOptions, 'version'>, context: PartialContext<'packages', 'config' | 'resolveMap'>): Promise<boolean>;
|
|
8
8
|
//# sourceMappingURL=validateOverride.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"validateOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,EACzC,OAAO,EAAE,cAAc,CAAC,UAAU,EAAE,QAAQ,GAAG,YAAY,CAAC,GAC3D,OAAO,CAAC,OAAO,CAAC,CAqDlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOverride.js","sourceRoot":"","sources":["../../src/utilities/validateOverride.ts"],"names":[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gB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;QACrF,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC;IAED,MAAM,KAAK,GAAG,mBAAmB,CAAC;QAChC,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,UAAU;KACvB,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,iBAAiB,CAC1C;QACE,WAAW,EAAE,KAAK,CAAC,IAAI;QACvB,QAAQ,EAAE,UAAU;KACrB,EACD,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CACrC,CAAC;IAEF,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2CAA2C;IAC3C,MAAM,eAAe,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE3D,iCAAiC;IACjC,MAAM,wBAAwB,GAAG,MAAM,iCAAiC,CACtE,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,EAC3B,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,CACrD,CAAC;IAEF,OAAO,CACL,CAAC,CAAC,wBAAwB,EAAE,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,CACpH,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/common-types';\nimport { parseRequestInfo } from '@ms-cloudpack/import-map';\nimport { findFileInPackage, findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { makeUrl, normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport type { PartialContext } from '../types/Context.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\nimport { ensureGeneratedSettingsForPackage, readGeneratedConfig } from '@ms-cloudpack/config';\n\n/**\n * Given a package name, import path, and optional issuerUrl, returns a boolean indicating if the given\n * override is valid.\n */\nexport async function validateOverride(\n options: Omit<OverrideOptions, 'version'>,\n context: PartialContext<'packages', 'config' | 'resolveMap'>,\n): Promise<boolean> {\n const { packageName, importPath, issuerUrl } = options;\n const { session, packages } = context;\n const { config } = session;\n const { appPath } = config;\n\n let requiredBy: PackageJson | undefined = undefined;\n\n // Import paths with trailing slashes are not supported by import maps\n // in browser as they interpret the trailing slash as a wildcard partial match.\n if (importPath.endsWith('/')) {\n return false;\n }\n\n if (issuerUrl) {\n const { packageName: name, version } = parseRequestInfo(makeUrl(issuerUrl).pathname);\n requiredBy = { name, version };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition: requiredBy,\n });\n\n if (!entry) {\n return false;\n }\n\n const { filePath } = await findFileInPackage(\n {\n packagePath: entry.path,\n filePath: importPath,\n },\n { packages, config: session.config },\n );\n\n if (filePath) {\n return true;\n }\n\n // Parse the generated config if it exists.\n const generatedConfig = await readGeneratedConfig(appPath);\n\n // Ensure packageSettings exists.\n const generatedPackageSettings = await ensureGeneratedSettingsForPackage(\n { packagePath: entry.path },\n { config: { generated: generatedConfig }, packages },\n );\n\n return (\n !!generatedPackageSettings?.exports && generatedPackageSettings.exports[normalizeRelativePath(importPath)] === null\n );\n}\n"]}
|