@ms-cloudpack/api-server 0.63.10 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/addPackageOverride.d.ts +1 -1
- package/lib/apis/addPackageOverride.js +7 -7
- package/lib/apis/addPackageOverride.js.map +1 -1
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/getData.d.ts +7 -13
- package/lib/apis/getData.d.ts.map +1 -1
- package/lib/apis/getData.js +3 -4
- package/lib/apis/getData.js.map +1 -1
- package/lib/apis/getLinkConfig.d.ts +2 -2
- package/lib/apis/getLinkConfig.d.ts.map +1 -1
- package/lib/apis/getLinkConfig.js +3 -2
- package/lib/apis/getLinkConfig.js.map +1 -1
- package/lib/apis/getSessionId.d.ts +2 -6
- package/lib/apis/getSessionId.d.ts.map +1 -1
- package/lib/apis/getSessionId.js +3 -4
- package/lib/apis/getSessionId.js.map +1 -1
- package/lib/apis/linkPath.d.ts +29 -3
- package/lib/apis/linkPath.js +2 -2
- package/lib/apis/linkPath.js.map +1 -1
- package/lib/apis/notifyLinkChange.d.ts +2 -2
- package/lib/apis/notifyLinkChange.d.ts.map +1 -1
- package/lib/apis/notifyLinkChange.js +3 -2
- package/lib/apis/notifyLinkChange.js.map +1 -1
- package/lib/apis/onDataChanged.d.ts +7 -13
- package/lib/apis/onDataChanged.d.ts.map +1 -1
- package/lib/apis/onDataChanged.js +3 -7
- package/lib/apis/onDataChanged.js.map +1 -1
- package/lib/apis/openCodeEditor.d.ts +9 -19
- package/lib/apis/openCodeEditor.d.ts.map +1 -1
- package/lib/apis/openCodeEditor.js +6 -6
- package/lib/apis/openCodeEditor.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 +3 -2
- package/lib/apis/openConfigEditor.js.map +1 -1
- package/lib/apis/openFilePath.d.ts +6 -12
- package/lib/apis/openFilePath.d.ts.map +1 -1
- package/lib/apis/openFilePath.js +4 -4
- package/lib/apis/openFilePath.js.map +1 -1
- package/lib/apis/publishData.d.ts +7 -13
- package/lib/apis/publishData.d.ts.map +1 -1
- package/lib/apis/publishData.js +3 -3
- package/lib/apis/publishData.js.map +1 -1
- package/lib/apis/reportSpan.d.ts +10 -20
- package/lib/apis/reportSpan.d.ts.map +1 -1
- package/lib/apis/reportSpan.js +5 -5
- 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 +14 -7
- package/lib/apis/restartAllTasks.js.map +1 -1
- package/lib/apis/restartTask.d.ts +4 -18
- package/lib/apis/restartTask.d.ts.map +1 -1
- package/lib/apis/restartTask.js +6 -5
- package/lib/apis/restartTask.js.map +1 -1
- package/lib/apis/unlinkPath.d.ts +29 -3
- package/lib/apis/unlinkPath.js +2 -2
- package/lib/apis/unlinkPath.js.map +1 -1
- package/lib/apis/validatePackageOverride.d.ts +1 -1
- package/lib/apis/validatePackageOverride.js +5 -8
- package/lib/apis/validatePackageOverride.js.map +1 -1
- package/lib/common/createApiContext.d.ts.map +1 -1
- package/lib/common/createApiContext.js +4 -1
- package/lib/common/createApiContext.js.map +1 -1
- package/lib/common/createMockContext.d.ts +16 -9
- package/lib/common/createMockContext.d.ts.map +1 -1
- package/lib/common/createMockContext.js +21 -16
- package/lib/common/createMockContext.js.map +1 -1
- package/lib/common/createMockSession.d.ts +1 -1
- package/lib/common/createMockSession.d.ts.map +1 -1
- package/lib/common/createMockSession.js.map +1 -1
- package/lib/common/createSession.d.ts +5 -1
- package/lib/common/createSession.d.ts.map +1 -1
- package/lib/common/createSession.js +1 -1
- package/lib/common/createSession.js.map +1 -1
- package/lib/data/busSources.d.ts +27 -240
- package/lib/data/busSources.d.ts.map +1 -1
- package/lib/data/busSources.js +2 -2
- package/lib/data/busSources.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/trpc/common.d.ts +41 -2
- package/lib/trpc/common.d.ts.map +1 -1
- package/lib/trpc/common.js +44 -3
- package/lib/trpc/common.js.map +1 -1
- package/lib/types/BundleInfo.d.ts +1 -1
- package/lib/types/BundleInfo.d.ts.map +1 -1
- package/lib/types/BundleInfo.js.map +1 -1
- package/lib/types/LinkPath.d.ts +16 -92
- package/lib/types/LinkPath.d.ts.map +1 -1
- package/lib/types/LinkPath.js +21 -17
- package/lib/types/LinkPath.js.map +1 -1
- package/lib/types/Task.d.ts +20 -12
- package/lib/types/Task.d.ts.map +1 -1
- package/lib/types/Task.js.map +1 -1
- package/lib/types/TaskDescription.d.ts +19 -73
- package/lib/types/TaskDescription.d.ts.map +1 -1
- package/lib/types/TaskDescription.js +15 -12
- package/lib/types/TaskDescription.js.map +1 -1
- package/lib/types/TaskList.d.ts +6 -115
- package/lib/types/TaskList.d.ts.map +1 -1
- package/lib/types/TaskList.js +3 -2
- package/lib/types/TaskList.js.map +1 -1
- package/lib/types/TaskMessage.d.ts +3 -11
- package/lib/types/TaskMessage.d.ts.map +1 -1
- package/lib/types/TaskMessage.js +4 -4
- package/lib/types/TaskMessage.js.map +1 -1
- package/lib/types/TaskMessageLocation.d.ts +2 -6
- package/lib/types/TaskMessageLocation.d.ts.map +1 -1
- package/lib/types/TaskMessageLocation.js +3 -3
- package/lib/types/TaskMessageLocation.js.map +1 -1
- package/lib/types/TaskStats.d.ts +26 -17
- package/lib/types/TaskStats.d.ts.map +1 -1
- package/lib/types/TaskStats.js +4 -3
- package/lib/types/TaskStats.js.map +1 -1
- package/lib/types/Timing.d.ts +8 -18
- package/lib/types/Timing.d.ts.map +1 -1
- package/lib/types/Timing.js +5 -8
- package/lib/types/Timing.js.map +1 -1
- package/lib/types/ZodGetLinkConfigOutput.d.ts +2 -2
- package/lib/types/ZodGetLinkConfigOutput.d.ts.map +1 -1
- package/lib/types/ZodGetLinkConfigOutput.js +12 -10
- package/lib/types/ZodGetLinkConfigOutput.js.map +1 -1
- package/lib/types/ZodNotifyLinkChangeInput.d.ts +12 -44
- package/lib/types/ZodNotifyLinkChangeInput.d.ts.map +1 -1
- package/lib/types/ZodNotifyLinkChangeInput.js +7 -3
- package/lib/types/ZodNotifyLinkChangeInput.js.map +1 -1
- package/lib/types/ZodResolveMap.d.ts +2 -2
- package/lib/types/ZodResolveMap.d.ts.map +1 -1
- package/lib/types/ZodResolveMap.js +6 -6
- package/lib/types/ZodResolveMap.js.map +1 -1
- package/lib/utilities/TaskRunner.d.ts +56 -18
- package/lib/utilities/TaskRunner.d.ts.map +1 -1
- package/lib/utilities/TaskRunner.js +176 -98
- package/lib/utilities/TaskRunner.js.map +1 -1
- package/lib/utilities/createBundleTask.d.ts.map +1 -1
- package/lib/utilities/createBundleTask.js +9 -15
- package/lib/utilities/createBundleTask.js.map +1 -1
- package/lib/utilities/getConsumedDependencies.d.ts.map +1 -1
- package/lib/utilities/getConsumedDependencies.js +3 -0
- package/lib/utilities/getConsumedDependencies.js.map +1 -1
- package/lib/utilities/getConsumedPaths.d.ts.map +1 -1
- package/lib/utilities/getConsumedPaths.js +3 -0
- package/lib/utilities/getConsumedPaths.js.map +1 -1
- package/lib/utilities/matchingZodObject.d.ts +15 -9
- package/lib/utilities/matchingZodObject.d.ts.map +1 -1
- package/lib/utilities/matchingZodObject.js +16 -6
- package/lib/utilities/matchingZodObject.js.map +1 -1
- package/lib/utilities/notifyReload.d.ts.map +1 -1
- package/lib/utilities/notifyReload.js +2 -1
- package/lib/utilities/notifyReload.js.map +1 -1
- package/lib/utilities/waitForBusData.d.ts +2 -2
- package/lib/utilities/waitForBusData.d.ts.map +1 -1
- package/lib/utilities/waitForBusData.js.map +1 -1
- package/package.json +16 -16
- package/lib/types/TaskEndDescription.d.ts +0 -26
- package/lib/types/TaskEndDescription.d.ts.map +0 -1
- package/lib/types/TaskEndDescription.js +0 -8
- package/lib/types/TaskEndDescription.js.map +0 -1
- package/lib/types/TaskStartDescription.d.ts +0 -19
- package/lib/types/TaskStartDescription.d.ts.map +0 -1
- package/lib/types/TaskStartDescription.js +0 -8
- package/lib/types/TaskStartDescription.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { mutationProcedure } from '../trpc/common.js';
|
|
3
3
|
import { addOverride } from '../utilities/addOverride.js';
|
|
4
4
|
import { errorEntrySource } from '../data/busSources.js';
|
|
5
5
|
import { matchingZodObject } from '../utilities/matchingZodObject.js';
|
|
@@ -7,9 +7,9 @@ import { notifyHost } from '../utilities/notifyHost.js';
|
|
|
7
7
|
const ZodAddPackageOverrideInput = matchingZodObject({
|
|
8
8
|
packageName: z.string(),
|
|
9
9
|
importPath: z.string(),
|
|
10
|
-
version: z.
|
|
11
|
-
issuerUrl: z.
|
|
12
|
-
initiatedBy: z.
|
|
10
|
+
version: z.optional(z.string()),
|
|
11
|
+
issuerUrl: z.optional(z.string()),
|
|
12
|
+
initiatedBy: z.literal(['autoUpdateEntries', 'user']),
|
|
13
13
|
});
|
|
14
14
|
// TODO: consider whether this should be hardcoded or not
|
|
15
15
|
const targetEnvironment = 'browser';
|
|
@@ -31,7 +31,7 @@ export async function addPackageOverride(params) {
|
|
|
31
31
|
shouldRecalculate: true,
|
|
32
32
|
targetEnvironment,
|
|
33
33
|
});
|
|
34
|
-
taskRunner.
|
|
34
|
+
await taskRunner.clearResult(packagePath);
|
|
35
35
|
// Incrementing the target version will cause the import map to be recalculated.
|
|
36
36
|
session.incrementTargetVersion(packagePath);
|
|
37
37
|
if (session.config.features?.autoUpdateEntries) {
|
|
@@ -43,5 +43,5 @@ export async function addPackageOverride(params) {
|
|
|
43
43
|
return addedOverride;
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
addPackageOverride.procedure =
|
|
46
|
+
addPackageOverride.procedure = mutationProcedure(addPackageOverride, ZodAddPackageOverrideInput, z.boolean());
|
|
47
47
|
//# sourceMappingURL=addPackageOverride.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addPackageOverride.js","sourceRoot":"","sources":["../../src/apis/addPackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"addPackageOverride.js","sourceRoot":"","sources":["../../src/apis/addPackageOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,MAAM,0BAA0B,GAAG,iBAAiB,CAAkB;IACpE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;CACtD,CAAC,CAAC;AAEH,yDAAyD;AACzD,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAIC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,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AAC,OAAO,EAAE,CACZ,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport { mutationProcedure } 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.optional(z.string()),\n issuerUrl: z.optional(z.string()),\n initiatedBy: z.literal(['autoUpdateEntries', '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 await taskRunner.clearResult(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 = mutationProcedure<OverrideOptions, boolean>(\n addPackageOverride,\n ZodAddPackageOverrideInput,\n z.boolean(),\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensurePackageBundled.js","sourceRoot":"","sources":["../../src/apis/ensurePackageBundled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAuExD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAgC,EAChC,GAAgC;IAEhC,MAAM,OAAO,GAAiC,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEjD,4BAA4B;IAC5B,IAAI,MAAkC,CAAC;IACvC,IAAI,gBAA6C,CAAC;IAClD,IAAI,CAAC;QACH,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,MAAM,4BAA4B,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IACpH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC;YAClC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;SAClC,CAAC;IACJ,CAAC;IAED,4BAA4B;IAC5B,qGAAqG;IACrG,uDAAuD;IACvD,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,YAAY,GAAG,IAAI,OAAO,CAA+B,CAAC,OAAO,EAAE,EAAE;QACzE,MAAM,OAAO,GAAG,CAAC,gBAA6C,EAAE,EAAE;YAChE,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AAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAC7G,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,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"]}
|
|
1
|
+
{"version":3,"file":"ensurePackageBundled.js","sourceRoot":"","sources":["../../src/apis/ensurePackageBundled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAGpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAuExD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAgC,EAChC,GAAgC;IAEhC,MAAM,OAAO,GAAiC,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;IAEjD,4BAA4B;IAC5B,IAAI,MAAkC,CAAC;IACvC,IAAI,gBAA6C,CAAC;IAClD,IAAI,CAAC;QACH,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,MAAM,4BAA4B,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IACpH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC;YAClC,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;SAClC,CAAC;IACJ,CAAC;IAED,4BAA4B;IAC5B,qGAAqG;IACrG,uDAAuD;IACvD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ACV,GAAG,MAAM;SACV;QACD,gBAAgB;KACjB,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAgC,EAAE,KAAc;IACtE,MAAM,IAAI,GAAG,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IAC7G,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,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(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(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"]}
|
package/lib/apis/getData.d.ts
CHANGED
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
-
declare const ZodGetDataInput: z.
|
|
4
|
-
path: z.
|
|
5
|
-
},
|
|
6
|
-
path: string[];
|
|
7
|
-
}, {
|
|
8
|
-
path: string[];
|
|
9
|
-
}>;
|
|
3
|
+
declare const ZodGetDataInput: z.ZodMiniObject<{
|
|
4
|
+
path: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
5
|
+
}, z.core.$strip>;
|
|
10
6
|
type GetDataInput = z.infer<typeof ZodGetDataInput>;
|
|
11
|
-
declare
|
|
12
|
-
type GetDataOutput = z.infer<typeof ZodGetDataOutput>;
|
|
13
|
-
export declare function getData(params: ApiParams<GetDataInput, 'bus'>): GetDataOutput;
|
|
7
|
+
export declare function getData(params: ApiParams<GetDataInput, 'bus'>): unknown;
|
|
14
8
|
export declare namespace getData {
|
|
15
9
|
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
16
10
|
input: {
|
|
17
11
|
path: string[];
|
|
18
12
|
};
|
|
19
|
-
output:
|
|
20
|
-
meta:
|
|
13
|
+
output: unknown;
|
|
14
|
+
meta: never;
|
|
21
15
|
}>;
|
|
22
16
|
}
|
|
23
17
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../../src/apis/getData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../../src/apis/getData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAA,MAAM,eAAe;;iBAEnB,CAAC;AACH,KAAK,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEpD,wBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,OAAO,CAOvE;yBAPe,OAAO"}
|
package/lib/apis/getData.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { queryProcedure } from '../trpc/common.js';
|
|
3
3
|
const ZodGetDataInput = z.object({
|
|
4
4
|
path: z.array(z.string()),
|
|
5
5
|
});
|
|
6
|
-
const ZodGetDataOutput = z.any();
|
|
7
6
|
export function getData(params) {
|
|
8
7
|
const { input: { path }, ctx: { bus }, } = params;
|
|
9
8
|
return bus.getData(path);
|
|
10
9
|
}
|
|
11
10
|
// Attach a trpc procedure to the function.
|
|
12
|
-
getData.procedure =
|
|
11
|
+
getData.procedure = queryProcedure(getData, ZodGetDataInput, z.unknown());
|
|
13
12
|
//# sourceMappingURL=getData.js.map
|
package/lib/apis/getData.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getData.js","sourceRoot":"","sources":["../../src/apis/getData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getData.js","sourceRoot":"","sources":["../../src/apis/getData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC1B,CAAC,CAAC;AAGH,MAAM,UAAU,OAAO,CAAC,MAAsC;IAC5D,MAAM,EACJ,KAAK,EAAE,EAAE,IAAI,EAAE,EACf,GAAG,EAAE,EAAE,GAAG,EAAE,GACb,GAAG,MAAM,CAAC;IAEX,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,2CAA2C;AAC3C,OAAO,CAAC,SAAS,GAAG,cAAc,CAAwB,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport { queryProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nconst ZodGetDataInput = z.object({\n path: z.array(z.string()),\n});\ntype GetDataInput = z.infer<typeof ZodGetDataInput>;\n\nexport function getData(params: ApiParams<GetDataInput, 'bus'>): unknown {\n const {\n input: { path },\n ctx: { bus },\n } = params;\n\n return bus.getData(path);\n}\n\n// Attach a trpc procedure to the function.\ngetData.procedure = queryProcedure<GetDataInput, unknown>(getData, ZodGetDataInput, z.unknown());\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
3
|
import { ZodGetLinkConfigOutput } from '../types/ZodGetLinkConfigOutput.js';
|
|
4
4
|
export type GetLinkConfigOutput = z.infer<typeof ZodGetLinkConfigOutput>;
|
|
@@ -10,7 +10,7 @@ export declare namespace getLinkConfig {
|
|
|
10
10
|
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
11
11
|
input: void;
|
|
12
12
|
output: import("@ms-cloudpack/common-types").CloudpackLinkConfig;
|
|
13
|
-
meta:
|
|
13
|
+
meta: never;
|
|
14
14
|
}>;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=getLinkConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkConfig.d.ts","sourceRoot":"","sources":["../../src/apis/getLinkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"getLinkConfig.d.ts","sourceRoot":"","sources":["../../src/apis/getLinkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { queryProcedure } from '../trpc/common.js';
|
|
2
3
|
import { ZodGetLinkConfigOutput } from '../types/ZodGetLinkConfigOutput.js';
|
|
3
4
|
/**
|
|
4
5
|
* Returns the host's config required for linking.
|
|
@@ -7,5 +8,5 @@ export function getLinkConfig(params) {
|
|
|
7
8
|
return params.ctx.session.config;
|
|
8
9
|
}
|
|
9
10
|
// Attach a trpc procedure to the function.
|
|
10
|
-
getLinkConfig.procedure =
|
|
11
|
+
getLinkConfig.procedure = queryProcedure(getLinkConfig, z.void(), ZodGetLinkConfigOutput);
|
|
11
12
|
//# sourceMappingURL=getLinkConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkConfig.js","sourceRoot":"","sources":["../../src/apis/getLinkConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getLinkConfig.js","sourceRoot":"","sources":["../../src/apis/getLinkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAI5E;;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,cAAc,CAA4B,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport { queryProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { ZodGetLinkConfigOutput } from '../types/ZodGetLinkConfigOutput.js';\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 = queryProcedure<void, GetLinkConfigOutput>(getLinkConfig, z.void(), ZodGetLinkConfigOutput);\n"]}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
-
declare
|
|
4
|
-
type GetSessionIdOutput = z.infer<typeof ZodGetSessionIdOutput>;
|
|
5
|
-
export declare function getSessionId(params: ApiParams<void, 'session', 'id'>): GetSessionIdOutput;
|
|
2
|
+
export declare function getSessionId(params: ApiParams<void, 'session', 'id'>): string | undefined;
|
|
6
3
|
export declare namespace getSessionId {
|
|
7
4
|
var procedure: import("@trpc/server").TRPCQueryProcedure<{
|
|
8
5
|
input: void;
|
|
9
6
|
output: string | undefined;
|
|
10
|
-
meta:
|
|
7
|
+
meta: never;
|
|
11
8
|
}>;
|
|
12
9
|
}
|
|
13
|
-
export {};
|
|
14
10
|
//# sourceMappingURL=getSessionId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSessionId.d.ts","sourceRoot":"","sources":["../../src/apis/getSessionId.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getSessionId.d.ts","sourceRoot":"","sources":["../../src/apis/getSessionId.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,MAAM,GAAG,SAAS,CAEzF;yBAFe,YAAY"}
|
package/lib/apis/getSessionId.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
const ZodGetSessionIdOutput = z.string().or(z.undefined());
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { queryProcedure } from '../trpc/common.js';
|
|
4
3
|
export function getSessionId(params) {
|
|
5
4
|
return params.ctx.session?.id;
|
|
6
5
|
}
|
|
7
6
|
// Attach a trpc procedure to the function.
|
|
8
|
-
getSessionId.procedure =
|
|
7
|
+
getSessionId.procedure = queryProcedure(getSessionId, z.void(), z.union([z.string(), z.undefined()]));
|
|
9
8
|
//# sourceMappingURL=getSessionId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSessionId.js","sourceRoot":"","sources":["../../src/apis/getSessionId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getSessionId.js","sourceRoot":"","sources":["../../src/apis/getSessionId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,MAAM,UAAU,YAAY,CAAC,MAAwC;IACnE,OAAO,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,2CAA2C;AAC3C,YAAY,CAAC,SAAS,GAAG,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport { queryProcedure } from '../trpc/common.js';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nexport function getSessionId(params: ApiParams<void, 'session', 'id'>): string | undefined {\n return params.ctx.session?.id;\n}\n\n// Attach a trpc procedure to the function.\ngetSessionId.procedure = queryProcedure(getSessionId, z.void(), z.union([z.string(), z.undefined()]));\n"]}
|
package/lib/apis/linkPath.d.ts
CHANGED
|
@@ -7,13 +7,39 @@ export declare function linkPath(params: ApiParams<LinkPathInput, 'bus' | 'repor
|
|
|
7
7
|
export declare namespace linkPath {
|
|
8
8
|
var procedure: import("@trpc/server").TRPCMutationProcedure<{
|
|
9
9
|
input: {
|
|
10
|
-
linkedPath:
|
|
10
|
+
linkedPath: {
|
|
11
|
+
path: string;
|
|
12
|
+
rootPath?: string | undefined;
|
|
13
|
+
includeAll?: boolean | undefined;
|
|
14
|
+
ignoredPackages?: string[] | undefined;
|
|
15
|
+
ignoreResolutions?: boolean | undefined;
|
|
16
|
+
resolveStrategy?: "dedupe" | "duplicate" | undefined;
|
|
17
|
+
remote?: {
|
|
18
|
+
resolveMap: import("@ms-cloudpack/common-types").ResolveMap;
|
|
19
|
+
hostUrl: string;
|
|
20
|
+
packages: import("@ms-cloudpack/common-types").SerializablePackageDefinitionsCache;
|
|
21
|
+
packageHashes: import("@ms-cloudpack/common-types").SerializablePackageHashesCache;
|
|
22
|
+
} | undefined;
|
|
23
|
+
};
|
|
11
24
|
};
|
|
12
25
|
output: {
|
|
13
26
|
resolveMap: import("@ms-cloudpack/common-types").ResolveMap;
|
|
14
|
-
linkedPaths:
|
|
27
|
+
linkedPaths: {
|
|
28
|
+
path: string;
|
|
29
|
+
rootPath?: string | undefined;
|
|
30
|
+
includeAll?: boolean | undefined;
|
|
31
|
+
ignoredPackages?: string[] | undefined;
|
|
32
|
+
ignoreResolutions?: boolean | undefined;
|
|
33
|
+
resolveStrategy?: "dedupe" | "duplicate" | undefined;
|
|
34
|
+
remote?: {
|
|
35
|
+
resolveMap: import("@ms-cloudpack/common-types").ResolveMap;
|
|
36
|
+
hostUrl: string;
|
|
37
|
+
packages: import("@ms-cloudpack/common-types").SerializablePackageDefinitionsCache;
|
|
38
|
+
packageHashes: import("@ms-cloudpack/common-types").SerializablePackageHashesCache;
|
|
39
|
+
} | undefined;
|
|
40
|
+
}[];
|
|
15
41
|
};
|
|
16
|
-
meta:
|
|
42
|
+
meta: never;
|
|
17
43
|
}>;
|
|
18
44
|
}
|
|
19
45
|
//# sourceMappingURL=linkPath.d.ts.map
|
package/lib/apis/linkPath.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mutationProcedure } from '../trpc/common.js';
|
|
2
2
|
import { ZodLinkPathInput, ZodLinkPathOutput } from '../types/LinkPath.js';
|
|
3
3
|
import { notifyReload } from '../utilities/notifyReload.js';
|
|
4
4
|
/**
|
|
@@ -28,5 +28,5 @@ export async function linkPath(params) {
|
|
|
28
28
|
}
|
|
29
29
|
return result;
|
|
30
30
|
}
|
|
31
|
-
linkPath.procedure =
|
|
31
|
+
linkPath.procedure = mutationProcedure(linkPath, ZodLinkPathInput, ZodLinkPathOutput);
|
|
32
32
|
//# sourceMappingURL=linkPath.js.map
|
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,
|
|
1
|
+
{"version":3,"file":"linkPath.js","sourceRoot":"","sources":["../../src/apis/linkPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,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,CAAC;IAEjF,IAAI,MAAM,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;IAClF,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,oBAAoB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,IAAI,CAAC;QACH,MAAM,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;YACnE,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;gBACtB,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;gBACtD,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9C,CAAC;YAED,8BAA8B;YAC9B,MAAM,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAChF,OAAO,CAAC,uBAAuB,EAAE,CAAC;YAClC,MAAM,YAAY,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;QACjF,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,QAAQ,CAAC,SAAS,GAAG,iBAAiB,CAAgC,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { mutationProcedure } 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 = mutationProcedure<LinkPathInput, LinkPathOutput>(linkPath, ZodLinkPathInput, ZodLinkPathOutput);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
3
|
import { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';
|
|
4
4
|
export type NotifyHost = (input: NotifyLinkChangeInput) => void;
|
|
@@ -21,7 +21,7 @@ export declare namespace notifyLinkChange {
|
|
|
21
21
|
} | undefined;
|
|
22
22
|
};
|
|
23
23
|
output: void;
|
|
24
|
-
meta:
|
|
24
|
+
meta: never;
|
|
25
25
|
}>;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=notifyLinkChange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyLinkChange.d.ts","sourceRoot":"","sources":["../../src/apis/notifyLinkChange.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"notifyLinkChange.d.ts","sourceRoot":"","sources":["../../src/apis/notifyLinkChange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { mutationProcedure } from '../trpc/common.js';
|
|
2
3
|
import { ZodNotifyLinkChangeInput } from '../types/ZodNotifyLinkChangeInput.js';
|
|
3
4
|
import { notifyReload } from '../utilities/notifyReload.js';
|
|
4
5
|
import { addImportMapHash } from '@ms-cloudpack/import-map';
|
|
@@ -24,5 +25,5 @@ export async function notifyLinkChange(params) {
|
|
|
24
25
|
await notifyReload({ reason: 'on-package-change-linked' }, ctx);
|
|
25
26
|
}
|
|
26
27
|
// Attach a trpc procedure to the function.
|
|
27
|
-
notifyLinkChange.procedure =
|
|
28
|
+
notifyLinkChange.procedure = mutationProcedure(notifyLinkChange, ZodNotifyLinkChangeInput, z.void());
|
|
28
29
|
//# sourceMappingURL=notifyLinkChange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyLinkChange.js","sourceRoot":"","sources":["../../src/apis/notifyLinkChange.ts"],"names":[],"mappings":"
|
|
1
|
+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AAC,EAAE,MAAM,EAAE,0BAA0B,EAAE,EAAE,GAAG,CAAC,CAAC;AAClE,CAAC;AAED,2CAA2C;AAC3C,gBAAgB,CAAC,SAAS,GAAG,iBAAiB,CAC5C,gBAAgB,EAChB,wBAAwB,EACxB,CAAC,CAAC,IAAI,EAAE,CACT,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport { mutationProcedure } 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 = mutationProcedure<NotifyLinkChangeInput, void>(\n notifyLinkChange,\n ZodNotifyLinkChangeInput,\n z.void(),\n);\n"]}
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
-
declare const ZodOnDataChangedInput: z.
|
|
4
|
-
path: z.
|
|
5
|
-
},
|
|
6
|
-
path: string[];
|
|
7
|
-
}, {
|
|
8
|
-
path: string[];
|
|
9
|
-
}>;
|
|
3
|
+
declare const ZodOnDataChangedInput: z.ZodMiniObject<{
|
|
4
|
+
path: z.ZodMiniArray<z.ZodMiniString<string>>;
|
|
5
|
+
}, z.core.$strip>;
|
|
10
6
|
type OnDataChangedInput = z.infer<typeof ZodOnDataChangedInput>;
|
|
11
|
-
declare const ZodOnDataChangedOutput: z.ZodAny;
|
|
12
|
-
type OnDataChangedOutput = z.infer<typeof ZodOnDataChangedOutput>;
|
|
13
7
|
/**
|
|
14
8
|
* Provides a way to subscribe to any data changes in the data bus.
|
|
15
9
|
*/
|
|
16
|
-
export declare function onDataChanged(params: ApiParams<OnDataChangedInput, 'bus'>):
|
|
10
|
+
export declare function onDataChanged(params: ApiParams<OnDataChangedInput, 'bus'>): unknown;
|
|
17
11
|
export declare namespace onDataChanged {
|
|
18
12
|
var procedure: import("@trpc/server").TRPCSubscriptionProcedure<{
|
|
19
13
|
input: {
|
|
20
14
|
path: string[];
|
|
21
15
|
};
|
|
22
|
-
output:
|
|
23
|
-
meta:
|
|
16
|
+
output: unknown;
|
|
17
|
+
meta: never;
|
|
24
18
|
}>;
|
|
25
19
|
}
|
|
26
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onDataChanged.d.ts","sourceRoot":"","sources":["../../src/apis/onDataChanged.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"onDataChanged.d.ts","sourceRoot":"","sources":["../../src/apis/onDataChanged.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAA,MAAM,qBAAqB;;iBAEzB,CAAC;AACH,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEhE;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,kBAAkB,EAAE,KAAK,CAAC,GAAG,OAAO,CAWnF;yBAXe,aAAa"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { subscriptionProcedure } from '../trpc/common.js';
|
|
3
3
|
import { observable } from '@trpc/server/observable';
|
|
4
4
|
const ZodOnDataChangedInput = z.object({
|
|
5
5
|
path: z.array(z.string()),
|
|
6
6
|
});
|
|
7
|
-
const ZodOnDataChangedOutput = z.any();
|
|
8
7
|
/**
|
|
9
8
|
* Provides a way to subscribe to any data changes in the data bus.
|
|
10
9
|
*/
|
|
@@ -15,8 +14,5 @@ export function onDataChanged(params) {
|
|
|
15
14
|
}));
|
|
16
15
|
}
|
|
17
16
|
// Attach a trpc procedure to the function.
|
|
18
|
-
onDataChanged.procedure =
|
|
19
|
-
.input(ZodOnDataChangedInput)
|
|
20
|
-
.output(ZodOnDataChangedOutput)
|
|
21
|
-
.subscription(onDataChanged);
|
|
17
|
+
onDataChanged.procedure = subscriptionProcedure(onDataChanged, ZodOnDataChangedInput, z.unknown());
|
|
22
18
|
//# sourceMappingURL=onDataChanged.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onDataChanged.js","sourceRoot":"","sources":["../../src/apis/onDataChanged.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"onDataChanged.js","sourceRoot":"","sources":["../../src/apis/onDataChanged.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC1B,CAAC,CAAC;AAGH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAA4C;IACxE,MAAM,EACJ,KAAK,EAAE,EAAE,IAAI,EAAE,EACf,GAAG,EAAE,EAAE,GAAG,EAAE,GACb,GAAG,MAAM,CAAC;IAEX,OAAO,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CACzB,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,2CAA2C;AAC3C,aAAa,CAAC,SAAS,GAAG,qBAAqB,CAC7C,aAAa,EACb,qBAAqB,EACrB,CAAC,CAAC,OAAO,EAAE,CACZ,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport { subscriptionProcedure } from '../trpc/common.js';\nimport { observable } from '@trpc/server/observable';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nconst ZodOnDataChangedInput = z.object({\n path: z.array(z.string()),\n});\ntype OnDataChangedInput = z.infer<typeof ZodOnDataChangedInput>;\n\n/**\n * Provides a way to subscribe to any data changes in the data bus.\n */\nexport function onDataChanged(params: ApiParams<OnDataChangedInput, 'bus'>): unknown {\n const {\n input: { path },\n ctx: { bus },\n } = params;\n\n return observable((emit) =>\n bus.subscribe(path, (value) => {\n emit.next(value);\n }),\n );\n}\n\n// Attach a trpc procedure to the function.\nonDataChanged.procedure = subscriptionProcedure<OnDataChangedInput, unknown>(\n onDataChanged,\n ZodOnDataChangedInput,\n z.unknown(),\n);\n"]}
|
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
-
declare const ZodOpenCodeEditorInput: z.
|
|
4
|
-
rootPath: z.
|
|
5
|
-
relativePath: z.
|
|
6
|
-
line: z.
|
|
7
|
-
column: z.
|
|
8
|
-
},
|
|
9
|
-
rootPath: string;
|
|
10
|
-
line?: number | undefined;
|
|
11
|
-
column?: number | undefined;
|
|
12
|
-
relativePath?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
rootPath: string;
|
|
15
|
-
line?: number | undefined;
|
|
16
|
-
column?: number | undefined;
|
|
17
|
-
relativePath?: string | undefined;
|
|
18
|
-
}>;
|
|
3
|
+
declare const ZodOpenCodeEditorInput: z.ZodMiniObject<{
|
|
4
|
+
rootPath: z.ZodMiniString<string>;
|
|
5
|
+
relativePath: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
6
|
+
line: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
7
|
+
column: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
19
9
|
export type OpenCodeEditorInput = z.infer<typeof ZodOpenCodeEditorInput>;
|
|
20
10
|
export declare function openCodeEditor(params: ApiParams<OpenCodeEditorInput, never>): void;
|
|
21
11
|
export declare namespace openCodeEditor {
|
|
22
12
|
var procedure: import("@trpc/server").TRPCMutationProcedure<{
|
|
23
13
|
input: {
|
|
24
14
|
rootPath: string;
|
|
15
|
+
relativePath?: string | undefined;
|
|
25
16
|
line?: number | undefined;
|
|
26
17
|
column?: number | undefined;
|
|
27
|
-
relativePath?: string | undefined;
|
|
28
18
|
};
|
|
29
19
|
output: void;
|
|
30
|
-
meta:
|
|
20
|
+
meta: never;
|
|
31
21
|
}>;
|
|
32
22
|
}
|
|
33
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openCodeEditor.d.ts","sourceRoot":"","sources":["../../src/apis/openCodeEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"openCodeEditor.d.ts","sourceRoot":"","sources":["../../src/apis/openCodeEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvD,QAAA,MAAM,sBAAsB;;;;;iBAK1B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEzE,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,mBAAmB,EAAE,KAAK,CAAC,GAAG,IAAI,CASlF;yBATe,cAAc"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z } from 'zod';
|
|
1
|
+
import { mutationProcedure } from '../trpc/common.js';
|
|
2
|
+
import { z } from 'zod/v4-mini';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import { formatLocation } from '@ms-cloudpack/path-utilities';
|
|
6
6
|
const ZodOpenCodeEditorInput = z.object({
|
|
7
7
|
rootPath: z.string(),
|
|
8
|
-
relativePath: z.
|
|
9
|
-
line: z.
|
|
10
|
-
column: z.
|
|
8
|
+
relativePath: z.optional(z.string()),
|
|
9
|
+
line: z.optional(z.number()),
|
|
10
|
+
column: z.optional(z.number()),
|
|
11
11
|
});
|
|
12
12
|
export function openCodeEditor(params) {
|
|
13
13
|
const { input: { rootPath, relativePath, line, column }, } = params;
|
|
@@ -16,5 +16,5 @@ export function openCodeEditor(params) {
|
|
|
16
16
|
spawnSync('code', ['--goto', fullPath], { cwd: rootPath, stdio: 'inherit' });
|
|
17
17
|
}
|
|
18
18
|
// Attach a trpc procedure to the function.
|
|
19
|
-
openCodeEditor.procedure =
|
|
19
|
+
openCodeEditor.procedure = mutationProcedure(openCodeEditor, ZodOpenCodeEditorInput, z.void());
|
|
20
20
|
//# sourceMappingURL=openCodeEditor.js.map
|