@ms-cloudpack/api-server 0.61.28 → 0.61.29
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.map +1 -1
- package/lib/apis/addPackageOverride.js +6 -5
- package/lib/apis/addPackageOverride.js.map +1 -1
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +2 -2
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/getLinkConfig.d.ts +17 -0
- package/lib/apis/getLinkConfig.d.ts.map +1 -0
- package/lib/apis/getLinkConfig.js +19 -0
- package/lib/apis/getLinkConfig.js.map +1 -0
- package/lib/apis/index.d.ts +3 -0
- package/lib/apis/index.d.ts.map +1 -1
- package/lib/apis/index.js +3 -0
- package/lib/apis/index.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 +5 -1
- package/lib/apis/linkPath.js.map +1 -1
- package/lib/apis/notifyLinkChange.d.ts +24 -0
- package/lib/apis/notifyLinkChange.d.ts.map +1 -0
- package/lib/apis/notifyLinkChange.js +28 -0
- package/lib/apis/notifyLinkChange.js.map +1 -0
- package/lib/apis/publishData.d.ts +28 -0
- package/lib/apis/publishData.d.ts.map +1 -0
- package/lib/apis/publishData.js +16 -0
- package/lib/apis/publishData.js.map +1 -0
- package/lib/data/busSources.d.ts +36 -0
- package/lib/data/busSources.d.ts.map +1 -1
- package/lib/data/busSources.js +8 -0
- package/lib/data/busSources.js.map +1 -1
- package/lib/index.browser.d.ts +1 -1
- package/lib/index.browser.d.ts.map +1 -1
- package/lib/index.browser.js +1 -1
- package/lib/index.browser.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +3 -0
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.js +5 -1
- package/lib/trpc/createCloudpackServer.js.map +1 -1
- package/lib/types/ZodNotifyLinkChangeInput.d.ts +35 -0
- package/lib/types/ZodNotifyLinkChangeInput.d.ts.map +1 -0
- package/lib/types/ZodNotifyLinkChangeInput.js +8 -0
- package/lib/types/ZodNotifyLinkChangeInput.js.map +1 -0
- package/lib/utilities/notifyHost.d.ts +9 -0
- package/lib/utilities/notifyHost.d.ts.map +1 -0
- package/lib/utilities/notifyHost.js +12 -0
- package/lib/utilities/notifyHost.js.map +1 -0
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addPackageOverride.d.ts","sourceRoot":"","sources":["../../src/apis/addPackageOverride.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addPackageOverride.d.ts","sourceRoot":"","sources":["../../src/apis/addPackageOverride.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAgBvD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,CACf,eAAe,EACf,KAAK,GAAG,eAAe,GAAG,UAAU,GAAG,YAAY,GAAG,iBAAiB,EACvE,QAAQ,GAAG,wBAAwB,GAAG,YAAY,GAAG,UAAU,CAChE,GACA,OAAO,CAAC,OAAO,CAAC,CAkClB;yBAxCqB,kBAAkB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { publicProcedure } from '../trpc/common.js';
|
|
3
3
|
import { addOverride } from '../utilities/addOverride.js';
|
|
4
|
-
import { notifyReload } from '../utilities/notifyReload.js';
|
|
5
4
|
import { errorEntrySource } from '../data/busSources.js';
|
|
6
5
|
import { matchingZodObject } from '../utilities/matchingZodObject.js';
|
|
6
|
+
import { notifyHost } from '../utilities/notifyHost.js';
|
|
7
7
|
const ZodAddPackageOverrideInput = matchingZodObject({
|
|
8
8
|
packageName: z.string(),
|
|
9
9
|
importPath: z.string(),
|
|
@@ -23,21 +23,22 @@ export async function addPackageOverride(params) {
|
|
|
23
23
|
return telemetryClient.tracer.startActiveSpan('ADD_PACKAGE_OVERRIDE', { attributes: { packageName, initiatedBy } }, async () => {
|
|
24
24
|
const { addedOverride, entry } = await addOverride(input, { session, packages });
|
|
25
25
|
if (entry && addedOverride) {
|
|
26
|
+
const packagePath = entry.path;
|
|
26
27
|
// The import map hash needs to be recalculated to ensure that the client is up to date.
|
|
27
28
|
await packageHashes.get({
|
|
28
|
-
packagePath
|
|
29
|
+
packagePath,
|
|
29
30
|
isSourceHashingEnabled: false,
|
|
30
31
|
shouldRecalculate: true,
|
|
31
32
|
targetEnvironment,
|
|
32
33
|
});
|
|
33
|
-
taskRunner.remove(
|
|
34
|
+
taskRunner.remove(packagePath);
|
|
34
35
|
// Incrementing the target version will cause the import map to be recalculated.
|
|
35
|
-
session.incrementTargetVersion(
|
|
36
|
+
session.incrementTargetVersion(packagePath);
|
|
36
37
|
if (session.config.features?.autoUpdateEntries) {
|
|
37
38
|
// We can clear the error message now that the override has been added.
|
|
38
39
|
bus.publish(errorEntrySource, '');
|
|
39
40
|
}
|
|
40
|
-
await
|
|
41
|
+
await notifyHost({ reason: 'add-package-override', packagePath, definition: await packages.get(packagePath) }, { bus, session, telemetryClient });
|
|
41
42
|
}
|
|
42
43
|
return addedOverride;
|
|
43
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addPackageOverride.js","sourceRoot":"","sources":["../../src/apis/addPackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"addPack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AAE,EAAE,EAC5C,KAAK,IAAI,EAAE;QACT,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,MAAM,WAAW,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjF,IAAI,KAAK,IAAI,aAAa,EAAE,CAAC;YAC3B,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC;YAC/B,wFAAwF;YACxF,MAAM,aAAa,CAAC,GAAG,CAAC;gBACtB,WAAW;gBACX,sBAAsB,EAAE,KAAK;gBAC7B,iBAAiB,EAAE,IAAI;gBACvB,iBAAiB;aAClB,CAAC,CAAC;YACH,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAC/B,gFAAgF;YAChF,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;YAC5C,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;gBAC/C,uEAAuE;gBACvE,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;YACpC,CAAC;YACD,MAAM,UAAU,CACd,EAAE,MAAM,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,EAC5F,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,CAClC,CAAC;QACJ,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC,CACF,CAAC;AACJ,CAAC;AAED,kBAAkB,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport { addOverride } from '../utilities/addOverride.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { errorEntrySource } from '../data/busSources.js';\nimport { matchingZodObject } from '../utilities/matchingZodObject.js';\nimport { notifyHost } from '../utilities/notifyHost.js';\n\nconst ZodAddPackageOverrideInput = matchingZodObject<OverrideOptions>({\n packageName: z.string(),\n importPath: z.string(),\n version: z.string().optional(),\n issuerUrl: z.string().optional(),\n initiatedBy: z.union([z.literal('autoUpdateEntries'), z.literal('user')]),\n});\n\n// TODO: consider whether this should be hardcoded or not\nconst targetEnvironment = 'browser';\n\n/**\n * Adds an override to the Cloudpack config.\n */\nexport async function addPackageOverride(\n params: ApiParams<\n OverrideOptions,\n 'bus' | 'packageHashes' | 'packages' | 'taskRunner' | 'telemetryClient',\n 'config' | 'incrementTargetVersion' | 'resolveMap' | 'sequence'\n >,\n): Promise<boolean> {\n const { input, ctx } = params;\n const { session, bus, packages, taskRunner, packageHashes, telemetryClient } = ctx;\n const { packageName, initiatedBy } = input;\n\n return telemetryClient.tracer.startActiveSpan(\n 'ADD_PACKAGE_OVERRIDE',\n { attributes: { packageName, initiatedBy } },\n async () => {\n const { addedOverride, entry } = await addOverride(input, { session, packages });\n if (entry && addedOverride) {\n const packagePath = entry.path;\n // The import map hash needs to be recalculated to ensure that the client is up to date.\n await packageHashes.get({\n packagePath,\n isSourceHashingEnabled: false,\n shouldRecalculate: true,\n targetEnvironment,\n });\n taskRunner.remove(packagePath);\n // Incrementing the target version will cause the import map to be recalculated.\n session.incrementTargetVersion(packagePath);\n if (session.config.features?.autoUpdateEntries) {\n // We can clear the error message now that the override has been added.\n bus.publish(errorEntrySource, '');\n }\n await notifyHost(\n { reason: 'add-package-override', packagePath, definition: await packages.get(packagePath) },\n { bus, session, telemetryClient },\n );\n }\n return addedOverride;\n },\n );\n}\n\naddPackageOverride.procedure = publicProcedure.input(ZodAddPackageOverrideInput).mutation(addPackageOverride);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensurePackageBundled.d.ts","sourceRoot":"","sources":["../../src/apis/ensurePackageBundled.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":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E,OAAO,CAAC;IACrB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,sCAAsC;IACtC,MAAM,EAAE,0BAA0B,CAAC;IACnC,uCAAuC;IACvC,YAAY,EAAE,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;AAEnF;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,EAChC,GAAG,EAAE,2BAA2B,GAC/B,OAAO,CAAC,0BAA0B,CAAC,CAoDrC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import { notifyReload } from '../utilities/notifyReload.js';
|
|
3
2
|
import { createBundleTask } from '../utilities/createBundleTask.js';
|
|
4
3
|
import { getConsumedDependencies } from '../utilities/getConsumedDependencies.js';
|
|
4
|
+
import { notifyHost } from '../utilities/notifyHost.js';
|
|
5
5
|
/**
|
|
6
6
|
* Checks if the package is bundled or needs bundling, and returns the result.
|
|
7
7
|
* For internal packages, we also notify the watcher to monitor for code changes.
|
|
@@ -126,7 +126,7 @@ async function ensurePackageBundledInternal(params, ctx) {
|
|
|
126
126
|
const watchedResult = await taskRunner.add(task, { rerun: true });
|
|
127
127
|
// If the result was successful, notify potential clients for reload.
|
|
128
128
|
if (watchedResult.result?.errors?.length === 0) {
|
|
129
|
-
await
|
|
129
|
+
await notifyHost({ reason: 'on-package-change', packagePath: packageEntry.path, hash: watchedResult.result.hash }, { bus, session, telemetryClient });
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
watcher.watch(watchOptions, () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensurePackageBundled.js","sourceRoot":"","sources":["../../src/apis/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,kGAAkG","sourcesContent":["import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport { notifyReload } from '../utilities/notifyReload.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport { createBundleTask } from '../utilities/createBundleTask.js';\nimport type { Context } from '../types/Context.js';\nimport type { WatchOptions } from '@ms-cloudpack/file-watcher';\nimport { getConsumedDependencies } from '../utilities/getConsumedDependencies.js';\nimport type { TargetEnvironment, WithOptional } from '@ms-cloudpack/common-types';\n\n/**\n * Input for `ensurePackageBundled`.\n */\nexport interface EnsurePackageBundledInput\n extends Pick<BundleRequest, 'outputPath' | 'version' | 'disableSourceMaps' | 'shouldGetBundleInfo'> {\n /** Package name */\n name: string;\n /**\n * Target environment for the bundle.\n * @default 'browser'\n */\n targetEnvironment?: TargetEnvironment;\n /** Whether to also ensure dependencies are bundled */\n enqueueDependencies?: boolean;\n /** Whether to re-run the bundle task */\n shouldRerun?: boolean;\n /**\n * Whether to watch for changes (internal packages only).\n * NOTE: requires `ctx.bus` and `ctx.watcher` to be set.\n */\n shouldWatch?: boolean;\n /** Whether to force re-bundling */\n shouldForce?: boolean;\n /** Whether to disable caching. */\n disableCache?: boolean;\n /** Whether to support incremental rebuilds. Defaults to true for internal libraries. */\n isIncremental?: boolean;\n /**\n * Whether to use a hash as the bundle id instead of the path.\n * Reduces performance when used with shouldForce as it hashes twice,\n * but eliminates task cache artifacts when handling many apps.\n */\n useHashAsId?: boolean;\n /** Priority for bundling. Greater priority will be scheduled first (defaults to 0). */\n priority?: number;\n}\n\n/**\n * Result of ensuring a single package is bundled.\n */\nexport interface EnsurePackageBundledResult\n extends Omit<NonNullable<BundleRequest['result']>, 'rebuild' | 'dispose' | 'bundlerName' | 'inputPath'> {\n /** Package name */\n name: string;\n /** Package version */\n version: string;\n /** Package dependency names (prod and peer) */\n dependencies?: string[];\n /** Whether the package is external (not defined in this repo). Unset if it's not found. */\n isExternal?: boolean;\n /** Absolute path of the package. Will be unset if the package couldn't be found. */\n inputPath?: string;\n}\n\n/**\n * Complete output for `ensurePackageBundled`.\n */\nexport interface EnsurePackageBundledOutput {\n /** Result of bundling this package */\n result: EnsurePackageBundledResult;\n /** Results of bundling dependencies */\n dependencies: Promise<EnsurePackageBundledResult[]>;\n}\n\n/**\n * Context for `ensurePackageBundled`. `bus` and `watcher` are only needed if `shouldWatch` is true.\n */\nexport type EnsurePackageBundledContext = WithOptional<Context, 'bus' | 'watcher'>;\n\n/**\n * Checks if the package is bundled or needs bundling, and returns the result.\n * For internal packages, we also notify the watcher to monitor for code changes.\n */\nexport async function ensurePackageBundled(\n input: EnsurePackageBundledInput,\n ctx: EnsurePackageBundledContext,\n): Promise<EnsurePackageBundledOutput> {\n const results: EnsurePackageBundledResult[] = [];\n const visited = new Set<`${string}@${string}`>();\n\n // Bundle the package itself\n let result: EnsurePackageBundledResult;\n let mainDependencies: EnsurePackageBundledInput[];\n try {\n ({ result, dependencyInputs: mainDependencies } = await ensurePackageBundledInternal({ ...input, visited }, ctx));\n } catch (err) {\n return {\n result: getErrorResult(input, err),\n dependencies: Promise.resolve([]),\n };\n }\n\n // Enqueue main dependencies\n // TODO: should processing this queue have a rate limit? right now if enqueueDependencies is enabled,\n // `await dependencies` will fire off all deps at once.\n let pending = 0;\n const dependencies = new Promise<EnsurePackageBundledResult[]>((resolve) => {\n const enqueue = (dependencyInputs: EnsurePackageBundledInput[]) => {\n for (const dependencyInput of dependencyInputs) {\n pending++;\n\n void ensurePackageBundledInternal({ ...dependencyInput, visited }, ctx)\n .then((dependencyBundleResult) => {\n // Save result and enqueue this dep's deps\n results.push(dependencyBundleResult.result);\n enqueue(dependencyBundleResult.dependencyInputs);\n })\n .catch((err) => {\n // If there's an error (most likely that the dependency wasn't found in the resolve map),\n // save it in a result instead of throwing. This generally gives better logging.\n results.push(getErrorResult(dependencyInput, err));\n })\n .then(() => {\n pending--;\n if (!pending) {\n resolve(results);\n }\n });\n }\n };\n\n enqueue(mainDependencies);\n });\n\n return {\n result,\n dependencies,\n };\n}\n\nasync function ensurePackageBundledInternal(\n params: EnsurePackageBundledInput & {\n visited: Set<`${string}@${string}`>;\n },\n ctx: EnsurePackageBundledContext,\n): Promise<{ result: EnsurePackageBundledResult; dependencyInputs: EnsurePackageBundledInput[] }> {\n const { taskRunner, session, watcher, packageHashes, bus, telemetryClient } = ctx;\n const { resolveMap, config } = session;\n const {\n name,\n version,\n shouldWatch,\n disableSourceMaps = config.features?.disableSourceMaps,\n enqueueDependencies = config.features?.enqueueDependencies,\n outputPath,\n shouldGetBundleInfo,\n shouldRerun,\n shouldForce,\n disableCache,\n isIncremental,\n useHashAsId,\n priority,\n targetEnvironment = 'browser',\n visited,\n } = params;\n\n const dependencyInputs: EnsurePackageBundledInput[] = [];\n\n visited.add(`${name}@${version}`);\n\n // First, we find the resolve map entry. This helps us resolve the physical location of the package\n // according to the resolveMap used in the session. (This can change based on linking.)\n const packageEntry = findResolveMapEntry({ packageName: name, version, resolveMap });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${name} in the resolve map.`);\n }\n\n const isExternal = !!packageEntry.isExternal;\n\n let hash: string | undefined;\n let sourceHash: string | undefined;\n\n if (useHashAsId) {\n // If we are using the hash as the task id, we need to calculate it once and pass it to the task\n // to prevent a race condition in which we get a different hash than the one used in the task id.\n hash = await packageHashes.get({\n packagePath: packageEntry.path,\n isSourceHashingEnabled: false,\n shouldRecalculate: true,\n targetEnvironment,\n });\n\n if (!packageEntry.isExternal) {\n // We only need the source hash for internal packages for cache validation.\n sourceHash = await packageHashes.get({\n packagePath: packageEntry.path,\n isSourceHashingEnabled: true,\n shouldRecalculate: true,\n targetEnvironment,\n });\n }\n }\n\n const bundleRequest: BundleRequest = {\n id: hash ?? `${packageEntry.path}--env:${targetEnvironment}`,\n packagePath: packageEntry.path,\n packageName: name,\n targetEnvironment,\n isExternal,\n isIncremental,\n outputPath,\n version,\n disableSourceMaps,\n shouldGetBundleInfo: shouldGetBundleInfo || enqueueDependencies,\n disableCache,\n mode: config.mode,\n };\n\n // Make priority negative to have retry count set to positive values.\n const retryCount = priority ? -1 * priority : undefined;\n\n const task = createBundleTask({ bundleRequest, force: shouldForce, hash, sourceHash, retryCount }, ctx);\n\n // TODO: Add lage scheduling back.\n const { result } = await taskRunner.add<BundleRequest>(task, { rerun: shouldRerun, priority });\n\n if (!result) {\n throw new Error('Bundle failed, no result');\n }\n\n // For internal packages, make sure we're watching the source to re-trigger bundling.\n if (shouldWatch && !isExternal) {\n if (!bus || !watcher) {\n throw new Error('bus and watcher must be provided in context if shouldWatch is true (this is a bug).');\n }\n\n const definition = await ctx.packages.get(packageEntry.path);\n const watchOptions: WatchOptions = {\n id: bundleRequest.id,\n path: packageEntry.path,\n watchPaths: definition.cloudpack?.inputPaths,\n };\n\n const onPackageChange = async () => {\n const watchedResult = await taskRunner.add<BundleRequest>(task, { rerun: true });\n\n // If the result was successful, notify potential clients for reload.\n if (watchedResult.result?.errors?.length === 0) {\n await notifyReload({ reason: 'on-package-change' }, { bus, session, telemetryClient });\n }\n };\n watcher.watch(watchOptions, () => {\n void onPackageChange();\n });\n }\n\n // If enabled, enqueue dependencies.\n if (enqueueDependencies && result.info) {\n for (const dependencyName of getConsumedDependencies(result.info)) {\n const dependencyVersion = packageEntry.dependencies[dependencyName];\n\n // If we've already visited this package from another package, skip it.\n if (visited.has(`${dependencyName}@${dependencyVersion}`)) {\n continue;\n }\n\n dependencyInputs.push({\n name: dependencyName,\n version: dependencyVersion,\n shouldWatch,\n enqueueDependencies,\n });\n }\n }\n\n return {\n result: {\n version,\n name,\n isExternal,\n ...result,\n },\n dependencyInputs,\n };\n}\n\nfunction getErrorResult(input: EnsurePackageBundledInput, error: unknown): EnsurePackageBundledResult {\n const text = `Error thrown while bundling: ${error instanceof Error ? error.stack || error.message : error}`;\n return {\n name: input.name,\n version: input.version,\n errors: [{ text, source: 'ensurePackageBundled' }],\n };\n}\n\n// This function doesn't have an attached procedure because it's never called via the TRPC server.\n"]}
|
|
1
|
+
{"version":3,"file":"ensureP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K,CAAC,OAAO;QACtB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,kGAAkG","sourcesContent":["import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport { createBundleTask } from '../utilities/createBundleTask.js';\nimport type { Context } from '../types/Context.js';\nimport type { WatchOptions } from '@ms-cloudpack/file-watcher';\nimport { getConsumedDependencies } from '../utilities/getConsumedDependencies.js';\nimport type { TargetEnvironment, WithOptional } from '@ms-cloudpack/common-types';\nimport { notifyHost } from '../utilities/notifyHost.js';\n\n/**\n * Input for `ensurePackageBundled`.\n */\nexport interface EnsurePackageBundledInput\n extends Pick<BundleRequest, 'outputPath' | 'version' | 'disableSourceMaps' | 'shouldGetBundleInfo'> {\n /** Package name */\n name: string;\n /**\n * Target environment for the bundle.\n * @default 'browser'\n */\n targetEnvironment?: TargetEnvironment;\n /** Whether to also ensure dependencies are bundled */\n enqueueDependencies?: boolean;\n /** Whether to re-run the bundle task */\n shouldRerun?: boolean;\n /**\n * Whether to watch for changes (internal packages only).\n * NOTE: requires `ctx.bus` and `ctx.watcher` to be set.\n */\n shouldWatch?: boolean;\n /** Whether to force re-bundling */\n shouldForce?: boolean;\n /** Whether to disable caching. */\n disableCache?: boolean;\n /** Whether to support incremental rebuilds. Defaults to true for internal libraries. */\n isIncremental?: boolean;\n /**\n * Whether to use a hash as the bundle id instead of the path.\n * Reduces performance when used with shouldForce as it hashes twice,\n * but eliminates task cache artifacts when handling many apps.\n */\n useHashAsId?: boolean;\n /** Priority for bundling. Greater priority will be scheduled first (defaults to 0). */\n priority?: number;\n}\n\n/**\n * Result of ensuring a single package is bundled.\n */\nexport interface EnsurePackageBundledResult\n extends Omit<NonNullable<BundleRequest['result']>, 'rebuild' | 'dispose' | 'bundlerName' | 'inputPath'> {\n /** Package name */\n name: string;\n /** Package version */\n version: string;\n /** Package dependency names (prod and peer) */\n dependencies?: string[];\n /** Whether the package is external (not defined in this repo). Unset if it's not found. */\n isExternal?: boolean;\n /** Absolute path of the package. Will be unset if the package couldn't be found. */\n inputPath?: string;\n}\n\n/**\n * Complete output for `ensurePackageBundled`.\n */\nexport interface EnsurePackageBundledOutput {\n /** Result of bundling this package */\n result: EnsurePackageBundledResult;\n /** Results of bundling dependencies */\n dependencies: Promise<EnsurePackageBundledResult[]>;\n}\n\n/**\n * Context for `ensurePackageBundled`. `bus` and `watcher` are only needed if `shouldWatch` is true.\n */\nexport type EnsurePackageBundledContext = WithOptional<Context, 'bus' | 'watcher'>;\n\n/**\n * Checks if the package is bundled or needs bundling, and returns the result.\n * For internal packages, we also notify the watcher to monitor for code changes.\n */\nexport async function ensurePackageBundled(\n input: EnsurePackageBundledInput,\n ctx: EnsurePackageBundledContext,\n): Promise<EnsurePackageBundledOutput> {\n const results: EnsurePackageBundledResult[] = [];\n const visited = new Set<`${string}@${string}`>();\n\n // Bundle the package itself\n let result: EnsurePackageBundledResult;\n let mainDependencies: EnsurePackageBundledInput[];\n try {\n ({ result, dependencyInputs: mainDependencies } = await ensurePackageBundledInternal({ ...input, visited }, ctx));\n } catch (err) {\n return {\n result: getErrorResult(input, err),\n dependencies: Promise.resolve([]),\n };\n }\n\n // Enqueue main dependencies\n // TODO: should processing this queue have a rate limit? right now if enqueueDependencies is enabled,\n // `await dependencies` will fire off all deps at once.\n let pending = 0;\n const dependencies = new Promise<EnsurePackageBundledResult[]>((resolve) => {\n const enqueue = (dependencyInputs: EnsurePackageBundledInput[]) => {\n for (const dependencyInput of dependencyInputs) {\n pending++;\n\n void ensurePackageBundledInternal({ ...dependencyInput, visited }, ctx)\n .then((dependencyBundleResult) => {\n // Save result and enqueue this dep's deps\n results.push(dependencyBundleResult.result);\n enqueue(dependencyBundleResult.dependencyInputs);\n })\n .catch((err) => {\n // If there's an error (most likely that the dependency wasn't found in the resolve map),\n // save it in a result instead of throwing. This generally gives better logging.\n results.push(getErrorResult(dependencyInput, err));\n })\n .then(() => {\n pending--;\n if (!pending) {\n resolve(results);\n }\n });\n }\n };\n\n enqueue(mainDependencies);\n });\n\n return {\n result,\n dependencies,\n };\n}\n\nasync function ensurePackageBundledInternal(\n params: EnsurePackageBundledInput & {\n visited: Set<`${string}@${string}`>;\n },\n ctx: EnsurePackageBundledContext,\n): Promise<{ result: EnsurePackageBundledResult; dependencyInputs: EnsurePackageBundledInput[] }> {\n const { taskRunner, session, watcher, packageHashes, bus, telemetryClient } = ctx;\n const { resolveMap, config } = session;\n const {\n name,\n version,\n shouldWatch,\n disableSourceMaps = config.features?.disableSourceMaps,\n enqueueDependencies = config.features?.enqueueDependencies,\n outputPath,\n shouldGetBundleInfo,\n shouldRerun,\n shouldForce,\n disableCache,\n isIncremental,\n useHashAsId,\n priority,\n targetEnvironment = 'browser',\n visited,\n } = params;\n\n const dependencyInputs: EnsurePackageBundledInput[] = [];\n\n visited.add(`${name}@${version}`);\n\n // First, we find the resolve map entry. This helps us resolve the physical location of the package\n // according to the resolveMap used in the session. (This can change based on linking.)\n const packageEntry = findResolveMapEntry({ packageName: name, version, resolveMap });\n\n if (!packageEntry) {\n throw new Error(`Could not find package ${name} in the resolve map.`);\n }\n\n const isExternal = !!packageEntry.isExternal;\n\n let hash: string | undefined;\n let sourceHash: string | undefined;\n\n if (useHashAsId) {\n // If we are using the hash as the task id, we need to calculate it once and pass it to the task\n // to prevent a race condition in which we get a different hash than the one used in the task id.\n hash = await packageHashes.get({\n packagePath: packageEntry.path,\n isSourceHashingEnabled: false,\n shouldRecalculate: true,\n targetEnvironment,\n });\n\n if (!packageEntry.isExternal) {\n // We only need the source hash for internal packages for cache validation.\n sourceHash = await packageHashes.get({\n packagePath: packageEntry.path,\n isSourceHashingEnabled: true,\n shouldRecalculate: true,\n targetEnvironment,\n });\n }\n }\n\n const bundleRequest: BundleRequest = {\n id: hash ?? `${packageEntry.path}--env:${targetEnvironment}`,\n packagePath: packageEntry.path,\n packageName: name,\n targetEnvironment,\n isExternal,\n isIncremental,\n outputPath,\n version,\n disableSourceMaps,\n shouldGetBundleInfo: shouldGetBundleInfo || enqueueDependencies,\n disableCache,\n mode: config.mode,\n };\n\n // Make priority negative to have retry count set to positive values.\n const retryCount = priority ? -1 * priority : undefined;\n\n const task = createBundleTask({ bundleRequest, force: shouldForce, hash, sourceHash, retryCount }, ctx);\n\n // TODO: Add lage scheduling back.\n const { result } = await taskRunner.add<BundleRequest>(task, { rerun: shouldRerun, priority });\n\n if (!result) {\n throw new Error('Bundle failed, no result');\n }\n\n // For internal packages, make sure we're watching the source to re-trigger bundling.\n if (shouldWatch && !isExternal) {\n if (!bus || !watcher) {\n throw new Error('bus and watcher must be provided in context if shouldWatch is true (this is a bug).');\n }\n\n const definition = await ctx.packages.get(packageEntry.path);\n const watchOptions: WatchOptions = {\n id: bundleRequest.id,\n path: packageEntry.path,\n watchPaths: definition.cloudpack?.inputPaths,\n };\n\n const onPackageChange = async () => {\n const watchedResult = await taskRunner.add<BundleRequest>(task, { rerun: true });\n\n // If the result was successful, notify potential clients for reload.\n if (watchedResult.result?.errors?.length === 0) {\n await notifyHost(\n { reason: 'on-package-change', packagePath: packageEntry.path, hash: watchedResult.result.hash },\n { bus, session, telemetryClient },\n );\n }\n };\n watcher.watch(watchOptions, () => {\n void onPackageChange();\n });\n }\n\n // If enabled, enqueue dependencies.\n if (enqueueDependencies && result.info) {\n for (const dependencyName of getConsumedDependencies(result.info)) {\n const dependencyVersion = packageEntry.dependencies[dependencyName];\n\n // If we've already visited this package from another package, skip it.\n if (visited.has(`${dependencyName}@${dependencyVersion}`)) {\n continue;\n }\n\n dependencyInputs.push({\n name: dependencyName,\n version: dependencyVersion,\n shouldWatch,\n enqueueDependencies,\n });\n }\n }\n\n return {\n result: {\n version,\n name,\n isExternal,\n ...result,\n },\n dependencyInputs,\n };\n}\n\nfunction getErrorResult(input: EnsurePackageBundledInput, error: unknown): EnsurePackageBundledResult {\n const text = `Error thrown while bundling: ${error instanceof Error ? error.stack || error.message : error}`;\n return {\n name: input.name,\n version: input.version,\n errors: [{ text, source: 'ensurePackageBundled' }],\n };\n}\n\n// This function doesn't have an attached procedure because it's never called via the TRPC server.\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z, type ZodSchema } from 'zod';
|
|
2
|
+
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
+
import type { CloudpackLinkConfig } from '@ms-cloudpack/common-types';
|
|
4
|
+
declare const ZodGetLinkConfigOutput: ZodSchema<CloudpackLinkConfig>;
|
|
5
|
+
export type GetLinkConfigOutput = z.infer<typeof ZodGetLinkConfigOutput>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the host's config required for linking.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLinkConfig(params: ApiParams<void, 'session', 'config'>): GetLinkConfigOutput;
|
|
10
|
+
export declare namespace getLinkConfig {
|
|
11
|
+
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
12
|
+
input: void;
|
|
13
|
+
output: CloudpackLinkConfig;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=getLinkConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLinkConfig.d.ts","sourceRoot":"","sources":["../../src/apis/getLinkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOtE,QAAA,MAAM,sBAAsB,EAAE,SAAS,CAAC,mBAAmB,CAG3C,CAAC;AAEjB,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,GAAG,mBAAmB,CAE/F;yBAFe,aAAa"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { publicProcedure } from '../trpc/common.js';
|
|
3
|
+
import { matchingZodObject } from '../utilities/matchingZodObject.js';
|
|
4
|
+
const ZodMatch = z.union([z.string(), z.object({ name: z.string(), version: z.string() })]);
|
|
5
|
+
// Minimum acceptable match object for a low maintenance burden.
|
|
6
|
+
const zodPackageSettings = z.array(z.object({ match: ZodMatch }).passthrough());
|
|
7
|
+
const ZodGetLinkConfigOutput = matchingZodObject({
|
|
8
|
+
packageSettings: zodPackageSettings,
|
|
9
|
+
generated: z.object({ packageSettings: zodPackageSettings }),
|
|
10
|
+
}).passthrough();
|
|
11
|
+
/**
|
|
12
|
+
* Returns the host's config required for linking.
|
|
13
|
+
*/
|
|
14
|
+
export function getLinkConfig(params) {
|
|
15
|
+
return params.ctx.session.config;
|
|
16
|
+
}
|
|
17
|
+
// Attach a trpc procedure to the function.
|
|
18
|
+
getLinkConfig.procedure = publicProcedure.output(ZodGetLinkConfigOutput).query(getLinkConfig);
|
|
19
|
+
//# sourceMappingURL=getLinkConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLinkConfig.js","sourceRoot":"","sources":["../../src/apis/getLinkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAkB,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5F,gEAAgE;AAChE,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAEhF,MAAM,sBAAsB,GAAmC,iBAAiB,CAAsB;IACpG,eAAe,EAAE,kBAAkB;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;CAC7D,CAAC,CAAC,WAAW,EAAE,CAAC;AAIjB;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAA4C;IACxE,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;AACnC,CAAC;AAED,2CAA2C;AAC3C,aAAa,CAAC,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC","sourcesContent":["import { z, type ZodSchema } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport type { CloudpackLinkConfig } from '@ms-cloudpack/common-types';\nimport { matchingZodObject } from '../utilities/matchingZodObject.js';\n\nconst ZodMatch = z.union([z.string(), z.object({ name: z.string(), version: z.string() })]);\n// Minimum acceptable match object for a low maintenance burden.\nconst zodPackageSettings = z.array(z.object({ match: ZodMatch }).passthrough());\n\nconst ZodGetLinkConfigOutput: ZodSchema<CloudpackLinkConfig> = matchingZodObject<CloudpackLinkConfig>({\n packageSettings: zodPackageSettings,\n generated: z.object({ packageSettings: zodPackageSettings }),\n}).passthrough();\n\nexport type GetLinkConfigOutput = z.infer<typeof ZodGetLinkConfigOutput>;\n\n/**\n * Returns the host's config required for linking.\n */\nexport function getLinkConfig(params: ApiParams<void, 'session', 'config'>): GetLinkConfigOutput {\n return params.ctx.session.config;\n}\n\n// Attach a trpc procedure to the function.\ngetLinkConfig.procedure = publicProcedure.output(ZodGetLinkConfigOutput).query(getLinkConfig);\n"]}
|
package/lib/apis/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { addPackageOverride } from './addPackageOverride.js';
|
|
2
2
|
export { getData } from './getData.js';
|
|
3
|
+
export { getLinkConfig } from './getLinkConfig.js';
|
|
3
4
|
export { getSessionId } from './getSessionId.js';
|
|
4
5
|
export { linkPath } from './linkPath.js';
|
|
6
|
+
export { notifyLinkChange } from './notifyLinkChange.js';
|
|
5
7
|
export { onDataChanged } from './onDataChanged.js';
|
|
6
8
|
export { openCodeEditor } from './openCodeEditor.js';
|
|
7
9
|
export { openConfigEditor } from './openConfigEditor.js';
|
|
8
10
|
export { openFilePath } from './openFilePath.js';
|
|
11
|
+
export { publishData } from './publishData.js';
|
|
9
12
|
export { reportSpan } from './reportSpan.js';
|
|
10
13
|
export { restartAllTasks } from './restartAllTasks.js';
|
|
11
14
|
export { restartTask } from './restartTask.js';
|
package/lib/apis/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
|
package/lib/apis/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// This only needs to include APIs used by the TRPC server.
|
|
2
2
|
export { addPackageOverride } from './addPackageOverride.js';
|
|
3
3
|
export { getData } from './getData.js';
|
|
4
|
+
export { getLinkConfig } from './getLinkConfig.js';
|
|
4
5
|
export { getSessionId } from './getSessionId.js';
|
|
5
6
|
export { linkPath } from './linkPath.js';
|
|
7
|
+
export { notifyLinkChange } from './notifyLinkChange.js';
|
|
6
8
|
export { onDataChanged } from './onDataChanged.js';
|
|
7
9
|
export { openCodeEditor } from './openCodeEditor.js';
|
|
8
10
|
export { openConfigEditor } from './openConfigEditor.js';
|
|
9
11
|
export { openFilePath } from './openFilePath.js';
|
|
12
|
+
export { publishData } from './publishData.js';
|
|
10
13
|
export { reportSpan } from './reportSpan.js';
|
|
11
14
|
export { restartAllTasks } from './restartAllTasks.js';
|
|
12
15
|
export { restartTask } from './restartTask.js';
|
package/lib/apis/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["// This only needs to include APIs used by the TRPC server.\nexport { addPackageOverride } from './addPackageOverride.js';\nexport { getData } from './getData.js';\nexport { getSessionId } from './getSessionId.js';\nexport { linkPath } from './linkPath.js';\nexport { onDataChanged } from './onDataChanged.js';\nexport { openCodeEditor } from './openCodeEditor.js';\nexport { openConfigEditor } from './openConfigEditor.js';\nexport { openFilePath } from './openFilePath.js';\nexport { reportSpan } from './reportSpan.js';\nexport { restartAllTasks } from './restartAllTasks.js';\nexport { restartTask } from './restartTask.js';\nexport { unlinkPath } from './unlinkPath.js';\nexport { validatePackageOverride } from './validatePackageOverride.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["// This only needs to include APIs used by the TRPC server.\nexport { addPackageOverride } from './addPackageOverride.js';\nexport { getData } from './getData.js';\nexport { getLinkConfig } from './getLinkConfig.js';\nexport { getSessionId } from './getSessionId.js';\nexport { linkPath } from './linkPath.js';\nexport { notifyLinkChange } from './notifyLinkChange.js';\nexport { onDataChanged } from './onDataChanged.js';\nexport { openCodeEditor } from './openCodeEditor.js';\nexport { openConfigEditor } from './openConfigEditor.js';\nexport { openFilePath } from './openFilePath.js';\nexport { publishData } from './publishData.js';\nexport { reportSpan } from './reportSpan.js';\nexport { restartAllTasks } from './restartAllTasks.js';\nexport { restartTask } from './restartTask.js';\nexport { unlinkPath } from './unlinkPath.js';\nexport { validatePackageOverride } from './validatePackageOverride.js';\n"]}
|
package/lib/apis/linkPath.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type LinkPathInput, type LinkPathOutput } from '../types/LinkPath.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Links a path to the session.
|
|
5
5
|
*/
|
|
6
|
-
export declare function linkPath(params: ApiParams<LinkPathInput, 'bus' | 'reporter' | 'telemetryClient', 'addLinkedPath' | 'incrementSessionVersion' | 'linkedPaths' | 'projectName' | 'resolveMap' | 'sequence'>): Promise<LinkPathOutput>;
|
|
6
|
+
export declare function linkPath(params: ApiParams<LinkPathInput, 'bus' | 'reporter' | 'telemetryClient' | 'packages' | 'packageHashes', 'addLinkedPath' | 'incrementSessionVersion' | 'linkedPaths' | 'projectName' | 'resolveMap' | 'sequence'>): Promise<LinkPathOutput>;
|
|
7
7
|
export declare namespace linkPath {
|
|
8
8
|
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
9
9
|
input: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkPath.d.ts","sourceRoot":"","sources":["../../src/apis/linkPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAuC,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGpH;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,SAAS,CACf,aAAa,EACb,KAAK,GAAG,UAAU,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"linkPath.d.ts","sourceRoot":"","sources":["../../src/apis/linkPath.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAuC,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGpH;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,SAAS,CACf,aAAa,EACb,KAAK,GAAG,UAAU,GAAG,iBAAiB,GAAG,UAAU,GAAG,eAAe,EACrE,eAAe,GAAG,yBAAyB,GAAG,aAAa,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,CACxG,GACA,OAAO,CAAC,cAAc,CAAC,CAwBzB;yBA9BqB,QAAQ"}
|
package/lib/apis/linkPath.js
CHANGED
|
@@ -7,11 +7,15 @@ import { notifyReload } from '../utilities/notifyReload.js';
|
|
|
7
7
|
export async function linkPath(params) {
|
|
8
8
|
const { input, ctx } = params;
|
|
9
9
|
const { linkedPath } = input;
|
|
10
|
-
const { session, reporter, bus, telemetryClient } = ctx;
|
|
10
|
+
const { session, reporter, bus, telemetryClient, packages, packageHashes } = ctx;
|
|
11
11
|
let result = { resolveMap: session.resolveMap, linkedPaths: session.linkedPaths };
|
|
12
12
|
const task = reporter.addTask(`Linking paths in ${session.projectName}`);
|
|
13
13
|
try {
|
|
14
14
|
await telemetryClient.tracer.startActiveSpan('LINK_PATH', async () => {
|
|
15
|
+
if (linkedPath.remote) {
|
|
16
|
+
packageHashes.extend(linkedPath.remote.packageHashes);
|
|
17
|
+
packages.extend(linkedPath.remote.packages);
|
|
18
|
+
}
|
|
15
19
|
// Add linked paths to session
|
|
16
20
|
result = await session.addLinkedPath(linkedPath);
|
|
17
21
|
task.complete({ status: 'complete', message: `Linked paths`, forceShow: true });
|
package/lib/apis/linkPath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkPath.js","sourceRoot":"","sources":["../../src/apis/linkPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAA2C,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAIC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"linkPath.js","sourceRoot":"","sources":["../../src/apis/linkPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAA2C,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAIC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,GAAG,CAA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","sourcesContent":["import { publicProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { ZodLinkPathInput, ZodLinkPathOutput, type LinkPathInput, type LinkPathOutput } from '../types/LinkPath.js';\nimport { notifyReload } from '../utilities/notifyReload.js';\n\n/**\n * Links a path to the session.\n */\nexport async function linkPath(\n params: ApiParams<\n LinkPathInput,\n 'bus' | 'reporter' | 'telemetryClient' | 'packages' | 'packageHashes',\n 'addLinkedPath' | 'incrementSessionVersion' | 'linkedPaths' | 'projectName' | 'resolveMap' | 'sequence'\n >,\n): Promise<LinkPathOutput> {\n const { input, ctx } = params;\n const { linkedPath } = input;\n const { session, reporter, bus, telemetryClient, packages, packageHashes } = ctx;\n\n let result = { resolveMap: session.resolveMap, linkedPaths: session.linkedPaths };\n const task = reporter.addTask(`Linking paths in ${session.projectName}`);\n try {\n await telemetryClient.tracer.startActiveSpan('LINK_PATH', async () => {\n if (linkedPath.remote) {\n packageHashes.extend(linkedPath.remote.packageHashes);\n packages.extend(linkedPath.remote.packages);\n }\n\n // Add linked paths to session\n result = await session.addLinkedPath(linkedPath);\n task.complete({ status: 'complete', message: `Linked paths`, forceShow: true });\n session.incrementSessionVersion();\n await notifyReload({ reason: 'link-path' }, { bus, session, telemetryClient });\n });\n } catch (e) {\n task.complete({ status: 'fail', message: `Failed to link paths`, forceShow: true });\n }\n return result;\n}\n\nlinkPath.procedure = publicProcedure.input(ZodLinkPathInput).output(ZodLinkPathOutput).query(linkPath);\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
+
import { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';
|
|
4
|
+
export type NotifyHost = (input: NotifyLinkChangeInput) => void;
|
|
5
|
+
export type NotifyLinkChangeInput = z.infer<typeof ZodNotifyLinkChangeInput>;
|
|
6
|
+
/**
|
|
7
|
+
* Notifies clients that a reload is needed by incrementing the session version.
|
|
8
|
+
*/
|
|
9
|
+
export declare function notifyLinkChange(params: ApiParams<NotifyLinkChangeInput, 'bus' | 'telemetryClient' | 'packageHashes' | 'packages', 'sequence' | 'config' | 'importMap' | 'packageImportPaths' | 'resolveMap' | 'urls' | 'incrementTargetVersion'>): Promise<void>;
|
|
10
|
+
export declare namespace notifyLinkChange {
|
|
11
|
+
var procedure: import("@trpc/server").TRPCMutationProcedure<{
|
|
12
|
+
input: {
|
|
13
|
+
packagePath: string;
|
|
14
|
+
hash?: string | undefined;
|
|
15
|
+
definition?: {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
exports?: any;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
21
|
+
output: void;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=notifyLinkChange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifyLinkChange.d.ts","sourceRoot":"","sources":["../../src/apis/notifyLinkChange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAOhF,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE7E;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,CACf,qBAAqB,EACrB,KAAK,GAAG,iBAAiB,GAAG,eAAe,GAAG,UAAU,EACxD,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,oBAAoB,GAAG,YAAY,GAAG,MAAM,GAAG,wBAAwB,CAC9G,GACA,OAAO,CAAC,IAAI,CAAC,CAiBf;yBAvBqB,gBAAgB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { publicProcedure } from '../trpc/common.js';
|
|
2
|
+
import { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';
|
|
3
|
+
import { notifyReload } from '../utilities/notifyReload.js';
|
|
4
|
+
import { addImportMapHash } from '@ms-cloudpack/import-map';
|
|
5
|
+
// TODO: consider whether this should be hardcoded or not
|
|
6
|
+
const targetEnvironment = 'browser';
|
|
7
|
+
/**
|
|
8
|
+
* Notifies clients that a reload is needed by incrementing the session version.
|
|
9
|
+
*/
|
|
10
|
+
export async function notifyLinkChange(params) {
|
|
11
|
+
const { input, ctx } = params;
|
|
12
|
+
const { packagePath, definition } = input;
|
|
13
|
+
const hash = input.hash || 'pending';
|
|
14
|
+
ctx.packageHashes.set({ packagePath, isSourceHashingEnabled: true, targetEnvironment }, hash);
|
|
15
|
+
if (definition) {
|
|
16
|
+
ctx.packages.set(packagePath, definition);
|
|
17
|
+
ctx.session.incrementTargetVersion(packagePath);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const { name, version } = await ctx.packages.get(packagePath);
|
|
21
|
+
// Add linked to package version as it will always be an internal linked package.
|
|
22
|
+
addImportMapHash({ packageName: name, version: `${version}-linked`, hash }, ctx);
|
|
23
|
+
}
|
|
24
|
+
await notifyReload({ reason: 'on-package-change-linked' }, ctx);
|
|
25
|
+
}
|
|
26
|
+
// Attach a trpc procedure to the function.
|
|
27
|
+
notifyLinkChange.procedure = publicProcedure.input(ZodNotifyLinkChangeInput).mutation(notifyLinkChange);
|
|
28
|
+
//# sourceMappingURL=notifyLinkChange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifyLinkChange.js","sourceRoot":"","sources":["../../src/apis/notifyLinkChange.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,wBAAw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":["import type { z } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';\nimport { notifyReload } from '../utilities/notifyReload.js';\nimport { addImportMapHash } from '@ms-cloudpack/import-map';\n\n// TODO: consider whether this should be hardcoded or not\nconst targetEnvironment = 'browser';\n\nexport type NotifyHost = (input: NotifyLinkChangeInput) => void;\n\nexport type NotifyLinkChangeInput = z.infer<typeof ZodNotifyLinkChangeInput>;\n\n/**\n * Notifies clients that a reload is needed by incrementing the session version.\n */\nexport async function notifyLinkChange(\n params: ApiParams<\n NotifyLinkChangeInput,\n 'bus' | 'telemetryClient' | 'packageHashes' | 'packages',\n 'sequence' | 'config' | 'importMap' | 'packageImportPaths' | 'resolveMap' | 'urls' | 'incrementTargetVersion'\n >,\n): Promise<void> {\n const { input, ctx } = params;\n const { packagePath, definition } = input;\n const hash = input.hash || 'pending';\n\n ctx.packageHashes.set({ packagePath, isSourceHashingEnabled: true, targetEnvironment }, hash);\n\n if (definition) {\n ctx.packages.set(packagePath, definition);\n ctx.session.incrementTargetVersion(packagePath);\n } else {\n const { name, version } = await ctx.packages.get(packagePath);\n // Add linked to package version as it will always be an internal linked package.\n addImportMapHash({ packageName: name, version: `${version}-linked`, hash }, ctx);\n }\n\n await notifyReload({ reason: 'on-package-change-linked' }, ctx);\n}\n\n// Attach a trpc procedure to the function.\nnotifyLinkChange.procedure = publicProcedure.input(ZodNotifyLinkChangeInput).mutation(notifyLinkChange);\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
+
declare const ZodPublishDataInput: z.ZodObject<{
|
|
4
|
+
path: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
data: z.ZodUnknown;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
path: string[];
|
|
8
|
+
data?: unknown;
|
|
9
|
+
}, {
|
|
10
|
+
path: string[];
|
|
11
|
+
data?: unknown;
|
|
12
|
+
}>;
|
|
13
|
+
type PublishDataInput = z.infer<typeof ZodPublishDataInput>;
|
|
14
|
+
/**
|
|
15
|
+
* Allows clients to publish data to the bus
|
|
16
|
+
*/
|
|
17
|
+
export declare function publishData(params: ApiParams<PublishDataInput, 'bus'>): void;
|
|
18
|
+
export declare namespace publishData {
|
|
19
|
+
var procedure: import("@trpc/server").TRPCMutationProcedure<{
|
|
20
|
+
input: {
|
|
21
|
+
path: string[];
|
|
22
|
+
data?: unknown;
|
|
23
|
+
};
|
|
24
|
+
output: void;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=publishData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishData.d.ts","sourceRoot":"","sources":["../../src/apis/publishData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAA,MAAM,mBAAmB;;;;;;;;;EAGvB,CAAC;AACH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE5D;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,IAAI,CAO5E;yBAPe,WAAW"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { publicProcedure } from '../trpc/common.js';
|
|
3
|
+
const ZodPublishDataInput = z.object({
|
|
4
|
+
path: z.array(z.string()),
|
|
5
|
+
data: z.unknown(),
|
|
6
|
+
});
|
|
7
|
+
/**
|
|
8
|
+
* Allows clients to publish data to the bus
|
|
9
|
+
*/
|
|
10
|
+
export function publishData(params) {
|
|
11
|
+
const { input: { path, data }, ctx: { bus }, } = params;
|
|
12
|
+
bus.publish(path, data);
|
|
13
|
+
}
|
|
14
|
+
// Attach a trpc procedure to the function.
|
|
15
|
+
publishData.procedure = publicProcedure.input(ZodPublishDataInput).mutation(publishData);
|
|
16
|
+
//# sourceMappingURL=publishData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishData.js","sourceRoot":"","sources":["../../src/apis/publishData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACzB,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;CAClB,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAA0C;IACpE,MAAM,EACJ,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EACrB,GAAG,EAAE,EAAE,GAAG,EAAE,GACb,GAAG,MAAM,CAAC;IAEX,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,2CAA2C;AAC3C,WAAW,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nconst ZodPublishDataInput = z.object({\n path: z.array(z.string()),\n data: z.unknown(),\n});\ntype PublishDataInput = z.infer<typeof ZodPublishDataInput>;\n\n/**\n * Allows clients to publish data to the bus\n */\nexport function publishData(params: ApiParams<PublishDataInput, 'bus'>): void {\n const {\n input: { path, data },\n ctx: { bus },\n } = params;\n\n bus.publish(path, data);\n}\n\n// Attach a trpc procedure to the function.\npublishData.procedure = publicProcedure.input(ZodPublishDataInput).mutation(publishData);\n"]}
|
package/lib/data/busSources.d.ts
CHANGED
|
@@ -147,4 +147,40 @@ export declare const taskListSource: DataBusPath<z.ZodObject<{
|
|
|
147
147
|
* This is used to display errors in the UI and to notify the user of the error when autoUpdateEntries is enabled.
|
|
148
148
|
*/
|
|
149
149
|
export declare const errorEntrySource: DataBusPath<z.ZodString>;
|
|
150
|
+
/**
|
|
151
|
+
* Used for tracking link updates.
|
|
152
|
+
*/
|
|
153
|
+
export declare const linkUpdateSource: DataBusPath<z.ZodObject<{
|
|
154
|
+
packagePath: z.ZodString;
|
|
155
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
156
|
+
definition: z.ZodOptional<z.ZodObject<{
|
|
157
|
+
name: z.ZodString;
|
|
158
|
+
version: z.ZodString;
|
|
159
|
+
exports: z.ZodAny;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
name: string;
|
|
162
|
+
version: string;
|
|
163
|
+
exports?: any;
|
|
164
|
+
}, {
|
|
165
|
+
name: string;
|
|
166
|
+
version: string;
|
|
167
|
+
exports?: any;
|
|
168
|
+
}>>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
packagePath: string;
|
|
171
|
+
hash?: string | undefined;
|
|
172
|
+
definition?: {
|
|
173
|
+
name: string;
|
|
174
|
+
version: string;
|
|
175
|
+
exports?: any;
|
|
176
|
+
} | undefined;
|
|
177
|
+
}, {
|
|
178
|
+
packagePath: string;
|
|
179
|
+
hash?: string | undefined;
|
|
180
|
+
definition?: {
|
|
181
|
+
name: string;
|
|
182
|
+
version: string;
|
|
183
|
+
exports?: any;
|
|
184
|
+
} | undefined;
|
|
185
|
+
}>>;
|
|
150
186
|
//# sourceMappingURL=busSources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"busSources.d.ts","sourceRoot":"","sources":["../../src/data/busSources.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"busSources.d.ts","sourceRoot":"","sources":["../../src/data/busSources.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1E;;GAEG;AACH,eAAO,MAAM,iBAAiB,0BAG5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;GAG1B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGzB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAGpD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAG3B,CAAC"}
|
package/lib/data/busSources.js
CHANGED
|
@@ -2,6 +2,7 @@ import z from 'zod';
|
|
|
2
2
|
import { ZodTaskStats } from '../types/TaskStats.js';
|
|
3
3
|
import { ZodTaskList } from '../types/TaskList.js';
|
|
4
4
|
import { createDataPath } from '@ms-cloudpack/data-bus';
|
|
5
|
+
import { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';
|
|
5
6
|
/**
|
|
6
7
|
* Used for tracking the reload count.
|
|
7
8
|
*/
|
|
@@ -31,4 +32,11 @@ export const errorEntrySource = createDataPath({
|
|
|
31
32
|
path: ['error', 'entry'],
|
|
32
33
|
type: z.string(),
|
|
33
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* Used for tracking link updates.
|
|
37
|
+
*/
|
|
38
|
+
export const linkUpdateSource = createDataPath({
|
|
39
|
+
path: ['link', 'update'],
|
|
40
|
+
type: ZodNotifyLinkChangeInput,
|
|
41
|
+
});
|
|
34
42
|
//# sourceMappingURL=busSources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"busSources.js","sourceRoot":"","sources":["../../src/data/busSources.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"busSources.js","sourceRoot":"","sources":["../../src/data/busSources.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;IAC9C,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC5C,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,YAAY;CACnB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,WAAW;CAClB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6B,cAAc,CAAC;IACvE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;IAC7C,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IACxB,IAAI,EAAE,wBAAwB;CAC/B,CAAC,CAAC","sourcesContent":["import z from 'zod';\nimport { ZodTaskStats } from '../types/TaskStats.js';\nimport { ZodTaskList } from '../types/TaskList.js';\nimport { createDataPath, type DataBusPath } from '@ms-cloudpack/data-bus';\nimport { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';\n\n/**\n * Used for tracking the reload count.\n */\nexport const reloadCountSource = createDataPath({\n path: ['session', 'version'],\n type: z.number(),\n});\n\n/**\n * Used for tracking the task stats displayed in the badge.\n */\nexport const taskStatsSource = createDataPath({\n path: ['task', 'stats'],\n type: ZodTaskStats,\n});\n\n/**\n * Used for tracking the list of tasks.\n */\nexport const taskListSource = createDataPath({\n path: ['task', 'list'],\n type: ZodTaskList,\n});\n\n/**\n * Used for tracking entry errors: `Failed to resolve module specifier \"${packageName}@${version}${filePath}\".`\n * This is used to display errors in the UI and to notify the user of the error when autoUpdateEntries is enabled.\n */\nexport const errorEntrySource: DataBusPath<z.ZodString> = createDataPath({\n path: ['error', 'entry'],\n type: z.string(),\n});\n\n/**\n * Used for tracking link updates.\n */\nexport const linkUpdateSource = createDataPath({\n path: ['link', 'update'],\n type: ZodNotifyLinkChangeInput,\n});\n"]}
|
package/lib/index.browser.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export type { TaskDescription } from './types/TaskDescription.js';
|
|
|
3
3
|
export type { TaskMessage } from './types/TaskMessage.js';
|
|
4
4
|
export type { TaskList } from './types/TaskList.js';
|
|
5
5
|
export { createCloudpackClient, type CloudpackClient } from './trpc/createCloudpackClient.js';
|
|
6
|
-
export { taskListSource, taskStatsSource, reloadCountSource, errorEntrySource } from './data/busSources.js';
|
|
6
|
+
export { taskListSource, taskStatsSource, reloadCountSource, errorEntrySource, linkUpdateSource, } from './data/busSources.js';
|
|
7
7
|
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE9F,OAAO,
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAE9F,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC"}
|
package/lib/index.browser.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createCloudpackClient } from './trpc/createCloudpackClient.js';
|
|
2
|
-
export { taskListSource, taskStatsSource, reloadCountSource, errorEntrySource } from './data/busSources.js';
|
|
2
|
+
export { taskListSource, taskStatsSource, reloadCountSource, errorEntrySource, linkUpdateSource, } from './data/busSources.js';
|
|
3
3
|
//# sourceMappingURL=index.browser.js.map
|
package/lib/index.browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAwB,MAAM,iCAAiC,CAAC;AAE9F,OAAO,
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAwB,MAAM,iCAAiC,CAAC;AAE9F,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC","sourcesContent":["export type { TaskStats } from './types/TaskStats.js';\nexport type { TaskDescription } from './types/TaskDescription.js';\nexport type { TaskMessage } from './types/TaskMessage.js';\nexport type { TaskList } from './types/TaskList.js';\n\nexport { createCloudpackClient, type CloudpackClient } from './trpc/createCloudpackClient.js';\n\nexport {\n taskListSource,\n taskStatsSource,\n reloadCountSource,\n errorEntrySource,\n linkUpdateSource,\n} from './data/busSources.js';\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ export type { TaskMessage } from './types/TaskMessage.js';
|
|
|
9
9
|
export type { TaskStartDescription } from './types/TaskStartDescription.js';
|
|
10
10
|
export type { EnsurePackageBundledContext, EnsurePackageBundledResult } from './apis/ensurePackageBundled.js';
|
|
11
11
|
export type { CloudAppContext } from './types/CloudAppContext.js';
|
|
12
|
+
export type { LinkPathInput, LinkPathOutput } from './types/LinkPath.js';
|
|
12
13
|
export { TaskRunner } from './utilities/TaskRunner.js';
|
|
13
14
|
export { taskListSource, taskStatsSource, errorEntrySource } from './data/busSources.js';
|
|
14
15
|
export { createCloudpackClient, type CloudpackClient } from './trpc/createCloudpackClient.js';
|
|
15
|
-
export { createCloudpackServer, type CloudpackServer } from './trpc/createCloudpackServer.js';
|
|
16
|
+
export { createCloudpackServer, type CloudpackServer, apiServerPort } from './trpc/createCloudpackServer.js';
|
|
16
17
|
export { getActiveSessionsPath } from './utilities/getActiveSessionsPath.js';
|
|
17
18
|
export { getConsumedDependencies } from './utilities/getConsumedDependencies.js';
|
|
18
19
|
export { getConsumedPaths } from './utilities/getConsumedPaths.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC9F,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,YAAY,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC9G,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,mBAA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+BAA+B,CAAC;AAGzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { TaskRunner } from './utilities/TaskRunner.js';
|
|
2
2
|
export { taskListSource, taskStatsSource, errorEntrySource } from './data/busSources.js';
|
|
3
3
|
export { createCloudpackClient } from './trpc/createCloudpackClient.js';
|
|
4
|
-
export { createCloudpackServer } from './trpc/createCloudpackServer.js';
|
|
4
|
+
export { createCloudpackServer, apiServerPort } from './trpc/createCloudpackServer.js';
|
|
5
5
|
export { getActiveSessionsPath } from './utilities/getActiveSessionsPath.js';
|
|
6
6
|
export { getConsumedDependencies } from './utilities/getConsumedDependencies.js';
|
|
7
7
|
export { getConsumedPaths } from './utilities/getConsumedPaths.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAwB,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAwB,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC7G,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAgC,MAAM,8BAA8B,CAAC;AACvH,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEzF,iDAAiD;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["export type { Context, PartialContext } from './types/Context.js';\nexport type { BundleInfo, BundleEntryInfo, BundleEntryConsumes } from './types/BundleInfo.js';\nexport type { TaskStats } from './types/TaskStats.js';\nexport type { Task } from './types/Task.js';\nexport type { TaskDescription } from './types/TaskDescription.js';\nexport type { TaskEndDescription } from './types/TaskEndDescription.js';\nexport type { TaskList } from './types/TaskList.js';\nexport type { TaskMessage } from './types/TaskMessage.js';\nexport type { TaskStartDescription } from './types/TaskStartDescription.js';\nexport type { EnsurePackageBundledContext, EnsurePackageBundledResult } from './apis/ensurePackageBundled.js';\nexport type { CloudAppContext } from './types/CloudAppContext.js';\nexport type { LinkPathInput, LinkPathOutput } from './types/LinkPath.js';\n\nexport { TaskRunner } from './utilities/TaskRunner.js';\nexport { taskListSource, taskStatsSource, errorEntrySource } from './data/busSources.js';\nexport { createCloudpackClient, type CloudpackClient } from './trpc/createCloudpackClient.js';\nexport { createCloudpackServer, type CloudpackServer, apiServerPort } from './trpc/createCloudpackServer.js';\nexport { getActiveSessionsPath } from './utilities/getActiveSessionsPath.js';\nexport { getConsumedDependencies } from './utilities/getConsumedDependencies.js';\nexport { getConsumedPaths } from './utilities/getConsumedPaths.js';\n\n// Utilities\nexport { createApiContext, createPartialApiContext, type CreateApiContextOptions } from './common/createApiContext.js';\nexport { createMockContext, createPartialMockContext } from './common/createMockContext.js';\nexport { createMockSession, createMockSessionNoFS } from './common/createMockSession.js';\n\n// API methods directly used outside this package\nexport { addPackageOverride } from './apis/addPackageOverride.js';\nexport { ensurePackageBundled } from './apis/ensurePackageBundled.js';\nexport { syncDownload } from './apis/syncDownload.js';\nexport { syncUpload } from './apis/syncUpload.js';\nexport type { SyncResult } from './types/SyncResult.js';\n"]}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { WebSocketServer } from 'ws';
|
|
1
2
|
import type { Context } from '../types/Context.js';
|
|
2
3
|
export interface CloudpackServer {
|
|
3
4
|
url: string;
|
|
4
5
|
close: () => Promise<void>;
|
|
6
|
+
clients: WebSocketServer['clients'];
|
|
5
7
|
}
|
|
8
|
+
export declare const apiServerPort: number[];
|
|
6
9
|
/**
|
|
7
10
|
* Creates a cloudpack server that can be used to communicate with the cloudpack client using trpc.
|
|
8
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAIrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACrC;AAED,eAAO,MAAM,aAAa,UAA2B,CAAC;AAEtD;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE;IACP,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC1B,EACD,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,eAAe,CAAC,CAmD1B"}
|
|
@@ -6,12 +6,13 @@ import cors from 'cors';
|
|
|
6
6
|
import { getDomain } from '@ms-cloudpack/create-express-app';
|
|
7
7
|
import * as apis from '../apis/index.js';
|
|
8
8
|
import { createRouter } from './common.js';
|
|
9
|
+
export const apiServerPort = [9890, 9891, 9892, 9893];
|
|
9
10
|
/**
|
|
10
11
|
* Creates a cloudpack server that can be used to communicate with the cloudpack client using trpc.
|
|
11
12
|
*/
|
|
12
13
|
export async function createCloudpackServer(options, context) {
|
|
13
14
|
const portArg = Array.isArray(options.port) ? options.port : options.port ? [options.port] : undefined;
|
|
14
|
-
const port = await getPort({ port: portArg ||
|
|
15
|
+
const port = await getPort({ port: portArg || apiServerPort });
|
|
15
16
|
if (portArg && !portArg.includes(port)) {
|
|
16
17
|
throw new Error(`No ports from range ${JSON.stringify(portArg)} are available`);
|
|
17
18
|
}
|
|
@@ -48,6 +49,9 @@ export async function createCloudpackServer(options, context) {
|
|
|
48
49
|
server.close();
|
|
49
50
|
});
|
|
50
51
|
},
|
|
52
|
+
get clients() {
|
|
53
|
+
return wss.clients;
|
|
54
|
+
},
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
57
|
//# sourceMappingURL=createCloudpackServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCloudpackServer.js","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,MA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O,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IAErC,OAAO;QACL,GAAG;QACH,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAC1C,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;gBACpD,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;gBACpD,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,OAAO;YACT,OAAO,GAAG,CAAC,OAAO,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { applyWSSHandler } from '@trpc/server/adapters/ws';\nimport getPort from 'get-port';\nimport { WebSocketServer } from 'ws';\nimport { createHTTPServer } from './httpAdapter.js';\nimport cors from 'cors';\nimport { getDomain } from '@ms-cloudpack/create-express-app';\nimport type { Context } from '../types/Context.js';\nimport * as apis from '../apis/index.js';\nimport { createRouter } from './common.js';\nimport type { AppRouter } from '../types/AppRouter.js';\n\nexport interface CloudpackServer {\n url: string;\n close: () => Promise<void>;\n clients: WebSocketServer['clients'];\n}\n\nexport const apiServerPort = [9890, 9891, 9892, 9893];\n\n/**\n * Creates a cloudpack server that can be used to communicate with the cloudpack client using trpc.\n */\nexport async function createCloudpackServer(\n options: {\n /** Custom port(s) to try for the API server. */\n port?: number | number[];\n },\n context: Context,\n): Promise<CloudpackServer> {\n const portArg = Array.isArray(options.port) ? options.port : options.port ? [options.port] : undefined;\n const port = await getPort({ port: portArg || apiServerPort });\n if (portArg && !portArg.includes(port)) {\n throw new Error(`No ports from range ${JSON.stringify(portArg)} are available`);\n }\n\n const createContext = () => Promise.resolve(context);\n const hostname = getDomain(context.session.config?.server?.domain);\n const https = context.session.config?.server?.https;\n\n const procedures = Object.fromEntries(Object.entries(apis).map(([name, api]) => [name, api.procedure]));\n // AppRouter is the correct type, but doesn't get inferred correctly after Object.entries\n const router = createRouter(procedures) as unknown as AppRouter;\n\n const { server, listen } = await createHTTPServer({\n domain: hostname,\n middleware: cors(),\n router,\n createContext,\n https,\n cwd: context.session.config.appPath,\n });\n\n await listen(port, hostname);\n\n const wss = new WebSocketServer({ server });\n\n applyWSSHandler<AppRouter>({\n wss,\n router,\n createContext,\n });\n\n const webSocketProtocol = https ? 'wss' : 'ws';\n const url = `${webSocketProtocol}://${hostname}:${port}`;\n context.session.urls.apiServer = url;\n\n return {\n url,\n close: async () => {\n await new Promise<void>((resolve, reject) => {\n wss.clients.forEach((socket) => socket.terminate());\n wss.close((err) => (err ? reject(err) : resolve()));\n server.close();\n });\n },\n get clients() {\n return wss.clients;\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ZodNotifyLinkChangeInput: z.ZodObject<{
|
|
3
|
+
packagePath: z.ZodString;
|
|
4
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
5
|
+
definition: z.ZodOptional<z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
version: z.ZodString;
|
|
8
|
+
exports: z.ZodAny;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
name: string;
|
|
11
|
+
version: string;
|
|
12
|
+
exports?: any;
|
|
13
|
+
}, {
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
exports?: any;
|
|
17
|
+
}>>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
packagePath: string;
|
|
20
|
+
hash?: string | undefined;
|
|
21
|
+
definition?: {
|
|
22
|
+
name: string;
|
|
23
|
+
version: string;
|
|
24
|
+
exports?: any;
|
|
25
|
+
} | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
packagePath: string;
|
|
28
|
+
hash?: string | undefined;
|
|
29
|
+
definition?: {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
exports?: any;
|
|
33
|
+
} | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=ZodNotifyLinkChangeInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodNotifyLinkChangeInput.d.ts","sourceRoot":"","sources":["../../src/types/ZodNotifyLinkChangeInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAInC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZodLinkPackageDefinition } from '../types/LinkPath.js';
|
|
3
|
+
export const ZodNotifyLinkChangeInput = z.object({
|
|
4
|
+
packagePath: z.string(),
|
|
5
|
+
hash: z.string().optional(),
|
|
6
|
+
definition: ZodLinkPackageDefinition.optional(),
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=ZodNotifyLinkChangeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodNotifyLinkChangeInput.js","sourceRoot":"","sources":["../../src/types/ZodNotifyLinkChangeInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,UAAU,EAAE,wBAAwB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { ZodLinkPackageDefinition } from '../types/LinkPath.js';\n\nexport const ZodNotifyLinkChangeInput = z.object({\n packagePath: z.string(),\n hash: z.string().optional(),\n definition: ZodLinkPackageDefinition.optional(),\n});\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NotifyLinkChangeInput } from '../apis/notifyLinkChange.js';
|
|
2
|
+
import type { PartialContext } from '../types/Context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Notifies clients that a reload is needed and notifies the host of link changes.
|
|
5
|
+
*/
|
|
6
|
+
export declare function notifyHost(options: NotifyLinkChangeInput & {
|
|
7
|
+
reason: string;
|
|
8
|
+
}, context: PartialContext<'bus' | 'telemetryClient', 'sequence'>): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=notifyHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifyHost.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,qBAAqB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EACnD,OAAO,EAAE,cAAc,CAAC,KAAK,GAAG,iBAAiB,EAAE,UAAU,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { linkUpdateSource } from '../data/busSources.js';
|
|
2
|
+
import { notifyReload } from './notifyReload.js';
|
|
3
|
+
/**
|
|
4
|
+
* Notifies clients that a reload is needed and notifies the host of link changes.
|
|
5
|
+
*/
|
|
6
|
+
export async function notifyHost(options, context) {
|
|
7
|
+
const { reason, ...input } = options;
|
|
8
|
+
const { bus } = context;
|
|
9
|
+
bus.publish(linkUpdateSource, input);
|
|
10
|
+
await notifyReload(options, context);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=notifyHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifyHost.js","sourceRoot":"","sources":["../../src/utilities/notifyHost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAmD,EACnD,OAA8D;IAE9D,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IACrC,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACxB,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import type { NotifyLinkChangeInput } from '../apis/notifyLinkChange.js';\nimport { linkUpdateSource } from '../data/busSources.js';\nimport type { PartialContext } from '../types/Context.js';\nimport { notifyReload } from './notifyReload.js';\n\n/**\n * Notifies clients that a reload is needed and notifies the host of link changes.\n */\nexport async function notifyHost(\n options: NotifyLinkChangeInput & { reason: string },\n context: PartialContext<'bus' | 'telemetryClient', 'sequence'>,\n): Promise<void> {\n const { reason, ...input } = options;\n const { bus } = context;\n bus.publish(linkUpdateSource, input);\n await notifyReload(options, context);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/api-server",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.29",
|
|
4
4
|
"description": "An implementation of the API server that does interacts with a task scheduler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@ms-cloudpack/bundler": "^0.24.
|
|
27
|
-
"@ms-cloudpack/common-types": "^0.24.
|
|
28
|
-
"@ms-cloudpack/config": "^0.33.
|
|
29
|
-
"@ms-cloudpack/create-express-app": "^1.10.
|
|
26
|
+
"@ms-cloudpack/bundler": "^0.24.24",
|
|
27
|
+
"@ms-cloudpack/common-types": "^0.24.16",
|
|
28
|
+
"@ms-cloudpack/config": "^0.33.32",
|
|
29
|
+
"@ms-cloudpack/create-express-app": "^1.10.28",
|
|
30
30
|
"@ms-cloudpack/data-bus": "^0.4.3",
|
|
31
31
|
"@ms-cloudpack/environment": "^0.1.1",
|
|
32
|
-
"@ms-cloudpack/esm-stub-utilities": "^0.14.
|
|
32
|
+
"@ms-cloudpack/esm-stub-utilities": "^0.14.22",
|
|
33
33
|
"@ms-cloudpack/file-watcher": "^0.2.0",
|
|
34
|
-
"@ms-cloudpack/import-map": "^0.10.
|
|
34
|
+
"@ms-cloudpack/import-map": "^0.10.14",
|
|
35
35
|
"@ms-cloudpack/json-utilities": "^0.1.10",
|
|
36
|
-
"@ms-cloudpack/package-hashes": "^0.7.
|
|
37
|
-
"@ms-cloudpack/package-utilities": "^12.2.
|
|
36
|
+
"@ms-cloudpack/package-hashes": "^0.7.44",
|
|
37
|
+
"@ms-cloudpack/package-utilities": "^12.2.4",
|
|
38
38
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
39
|
-
"@ms-cloudpack/path-utilities": "^3.0.
|
|
40
|
-
"@ms-cloudpack/remote-cache": "^0.11.
|
|
39
|
+
"@ms-cloudpack/path-utilities": "^3.0.13",
|
|
40
|
+
"@ms-cloudpack/remote-cache": "^0.11.7",
|
|
41
41
|
"@ms-cloudpack/task-reporter": "^0.16.1",
|
|
42
|
-
"@ms-cloudpack/telemetry": "^0.11.
|
|
42
|
+
"@ms-cloudpack/telemetry": "^0.11.11",
|
|
43
43
|
"@trpc/client": "^11.1.1",
|
|
44
44
|
"@trpc/server": "^11.1.1",
|
|
45
45
|
"cors": "^2.8.5",
|