@ms-cloudpack/api-server 0.64.0 → 0.64.2
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/getData.d.ts +6 -8
- package/lib/apis/getData.d.ts.map +1 -1
- package/lib/apis/getData.js +2 -1
- package/lib/apis/getData.js.map +1 -1
- package/lib/apis/getLinkConfig.d.ts +1 -3
- package/lib/apis/getLinkConfig.d.ts.map +1 -1
- package/lib/apis/getLinkConfig.js +1 -1
- package/lib/apis/getLinkConfig.js.map +1 -1
- package/lib/apis/linkPath.d.ts +2 -33
- package/lib/apis/linkPath.js +1 -1
- package/lib/apis/linkPath.js.map +1 -1
- package/lib/apis/notifyLinkChange.d.ts +2 -15
- package/lib/apis/notifyLinkChange.d.ts.map +1 -1
- package/lib/apis/notifyLinkChange.js +2 -2
- package/lib/apis/notifyLinkChange.js.map +1 -1
- package/lib/apis/onDataChanged.d.ts +3 -10
- package/lib/apis/onDataChanged.d.ts.map +1 -1
- package/lib/apis/onDataChanged.js +2 -4
- package/lib/apis/onDataChanged.js.map +1 -1
- package/lib/apis/openCodeEditor.d.ts +9 -15
- package/lib/apis/openCodeEditor.d.ts.map +1 -1
- package/lib/apis/openCodeEditor.js +5 -1
- package/lib/apis/openCodeEditor.js.map +1 -1
- package/lib/apis/openConfigEditor.d.ts +3 -0
- package/lib/apis/openConfigEditor.d.ts.map +1 -1
- package/lib/apis/openConfigEditor.js +3 -0
- package/lib/apis/openConfigEditor.js.map +1 -1
- package/lib/apis/openFilePath.d.ts +10 -11
- package/lib/apis/openFilePath.d.ts.map +1 -1
- package/lib/apis/openFilePath.js +5 -1
- package/lib/apis/openFilePath.js.map +1 -1
- package/lib/apis/publishData.d.ts +6 -10
- package/lib/apis/publishData.d.ts.map +1 -1
- package/lib/apis/publishData.js +2 -1
- package/lib/apis/publishData.js.map +1 -1
- package/lib/apis/reportSpan.d.ts +7 -15
- package/lib/apis/reportSpan.d.ts.map +1 -1
- package/lib/apis/reportSpan.js +2 -1
- package/lib/apis/reportSpan.js.map +1 -1
- package/lib/apis/unlinkPath.d.ts +2 -33
- package/lib/apis/unlinkPath.js +1 -1
- package/lib/apis/unlinkPath.js.map +1 -1
- package/lib/common/prepareOutputPath.js +1 -1
- package/lib/common/prepareOutputPath.js.map +1 -1
- package/lib/data/busSources.d.ts +6 -21
- 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.browser.d.ts +2 -2
- package/lib/index.browser.d.ts.map +1 -1
- package/lib/index.browser.js.map +1 -1
- package/lib/trpc/common.d.ts +33 -2
- package/lib/trpc/common.d.ts.map +1 -1
- package/lib/trpc/common.js +25 -6
- package/lib/trpc/common.js.map +1 -1
- package/lib/trpc/createCloudpackClient.d.ts +2 -0
- package/lib/trpc/createCloudpackClient.d.ts.map +1 -1
- package/lib/trpc/createCloudpackClient.js +27 -8
- package/lib/trpc/createCloudpackClient.js.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +3 -2
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.js +14 -0
- package/lib/trpc/createCloudpackServer.js.map +1 -1
- package/lib/trpc/getTestPort.d.ts +2 -0
- package/lib/trpc/getTestPort.d.ts.map +1 -0
- package/lib/trpc/getTestPort.js +15 -0
- package/lib/trpc/getTestPort.js.map +1 -0
- package/lib/types/GetLinkConfigOutput.d.ts +5 -0
- package/lib/types/GetLinkConfigOutput.d.ts.map +1 -0
- package/lib/types/{ZodGetLinkConfigOutput.js → GetLinkConfigOutput.js} +7 -4
- package/lib/types/GetLinkConfigOutput.js.map +1 -0
- package/lib/types/LinkPath.d.ts +10 -18
- package/lib/types/LinkPath.d.ts.map +1 -1
- package/lib/types/LinkPath.js +14 -24
- package/lib/types/LinkPath.js.map +1 -1
- package/lib/types/NotifyLinkChangeInput.d.ts +9 -0
- package/lib/types/NotifyLinkChangeInput.d.ts.map +1 -0
- package/lib/types/NotifyLinkChangeInput.js +16 -0
- package/lib/types/NotifyLinkChangeInput.js.map +1 -0
- package/lib/types/TaskDescription.d.ts +1 -1
- package/lib/types/TaskDescription.d.ts.map +1 -1
- package/lib/types/TaskList.d.ts +1 -1
- package/lib/types/TaskList.d.ts.map +1 -1
- package/lib/types/TaskMessage.d.ts +2 -2
- package/lib/types/TaskMessage.d.ts.map +1 -1
- package/lib/types/TaskMessageLocation.d.ts +1 -1
- package/lib/types/TaskMessageLocation.d.ts.map +1 -1
- package/lib/types/TaskStats.d.ts +1 -1
- package/lib/types/TaskStats.d.ts.map +1 -1
- package/lib/types/Timing.d.ts +1 -1
- package/lib/types/Timing.d.ts.map +1 -1
- package/lib/utilities/TaskRunner.d.ts.map +1 -1
- package/lib/utilities/TaskRunner.js +1 -0
- package/lib/utilities/TaskRunner.js.map +1 -1
- package/lib/utilities/matchingZodObject.d.ts +5 -3
- package/lib/utilities/matchingZodObject.d.ts.map +1 -1
- package/lib/utilities/matchingZodObject.js +8 -3
- package/lib/utilities/matchingZodObject.js.map +1 -1
- package/lib/utilities/notifyHost.d.ts +3 -4
- package/lib/utilities/notifyHost.d.ts.map +1 -1
- package/lib/utilities/notifyHost.js.map +1 -1
- package/lib/utilities/notifyReload.d.ts +4 -3
- package/lib/utilities/notifyReload.d.ts.map +1 -1
- package/lib/utilities/notifyReload.js.map +1 -1
- package/package.json +17 -15
- package/lib/trpc/connectBusToClient.d.ts +0 -8
- package/lib/trpc/connectBusToClient.d.ts.map +0 -1
- package/lib/trpc/connectBusToClient.js +0 -26
- package/lib/trpc/connectBusToClient.js.map +0 -1
- package/lib/types/ZodGetLinkConfigOutput.d.ts +0 -4
- package/lib/types/ZodGetLinkConfigOutput.d.ts.map +0 -1
- package/lib/types/ZodGetLinkConfigOutput.js.map +0 -1
- package/lib/types/ZodNotifyLinkChangeInput.d.ts +0 -13
- package/lib/types/ZodNotifyLinkChangeInput.d.ts.map +0 -1
- package/lib/types/ZodNotifyLinkChangeInput.js +0 -12
- package/lib/types/ZodNotifyLinkChangeInput.js.map +0 -1
- package/lib/types/ZodResolveMap.d.ts +0 -4
- package/lib/types/ZodResolveMap.d.ts.map +0 -1
- package/lib/types/ZodResolveMap.js +0 -14
- package/lib/types/ZodResolveMap.js.map +0 -1
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
// in the browser, so it must only import zod types.
|
|
4
4
|
//
|
|
5
5
|
import { z } from 'zod/v4-mini';
|
|
6
|
-
import { matchingZodObjectLoose } from '../utilities/matchingZodObject.js';
|
|
6
|
+
import { matchingZodObject, matchingZodObjectLoose } from '../utilities/matchingZodObject.js';
|
|
7
7
|
// Minimum acceptable match object for a low maintenance burden.
|
|
8
|
-
const ZodPackageSettingsMatchObject =
|
|
9
|
-
|
|
8
|
+
const ZodPackageSettingsMatchObject = matchingZodObject({
|
|
9
|
+
name: z.string(),
|
|
10
|
+
version: z.optional(z.string()),
|
|
11
|
+
});
|
|
12
|
+
const ZodPackageSettingsMatch = z.union([z.string(), z.looseObject({ ...ZodPackageSettingsMatchObject.shape })]);
|
|
10
13
|
const ZodGeneratedPackageSettingsMatch = z.union([z.string(), z.required(ZodPackageSettingsMatchObject)]);
|
|
11
14
|
export const ZodGetLinkConfigOutput = matchingZodObjectLoose({
|
|
12
15
|
packageSettings: z.optional(z.array(z.looseObject({ match: z.union([ZodPackageSettingsMatch, z.array(ZodPackageSettingsMatch)]) }))),
|
|
13
16
|
generated: z.looseObject({ packageSettings: z.array(z.looseObject({ match: ZodGeneratedPackageSettingsMatch })) }),
|
|
14
17
|
});
|
|
15
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=GetLinkConfigOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetLinkConfigOutput.js","sourceRoot":"","sources":["../../src/types/GetLinkConfigOutput.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,6FAA6F;AAC7F,oDAAoD;AACpD,EAAE;AACF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE9F,gEAAgE;AAChE,MAAM,6BAA6B,GAAG,iBAAiB,CAA6B;IAClF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAChC,CAAC,CAAC;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,GAAG,6BAA6B,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACjH,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;AAI1G,MAAM,CAAC,MAAM,sBAAsB,GAAG,sBAAsB,CAAsB;IAChF,eAAe,EAAE,CAAC,CAAC,QAAQ,CACzB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CACxG;IACD,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC,CAAC,EAAE,CAAC;CACnH,CAAC,CAAC","sourcesContent":["//\n// This must be in a separate file because it's imported by busSources.ts, which is also used\n// in the browser, so it must only import zod types.\n//\nimport { z } from 'zod/v4-mini';\nimport type { CloudpackLinkConfig, PackageSettingsMatchObject } from '@ms-cloudpack/common-types';\nimport { matchingZodObject, matchingZodObjectLoose } from '../utilities/matchingZodObject.js';\n\n// Minimum acceptable match object for a low maintenance burden.\nconst ZodPackageSettingsMatchObject = matchingZodObject<PackageSettingsMatchObject>({\n name: z.string(),\n version: z.optional(z.string()),\n});\nconst ZodPackageSettingsMatch = z.union([z.string(), z.looseObject({ ...ZodPackageSettingsMatchObject.shape })]);\nconst ZodGeneratedPackageSettingsMatch = z.union([z.string(), z.required(ZodPackageSettingsMatchObject)]);\n\nexport type GetLinkConfigOutput = CloudpackLinkConfig;\n\nexport const ZodGetLinkConfigOutput = matchingZodObjectLoose<GetLinkConfigOutput>({\n packageSettings: z.optional(\n z.array(z.looseObject({ match: z.union([ZodPackageSettingsMatch, z.array(ZodPackageSettingsMatch)]) })),\n ),\n generated: z.looseObject({ packageSettings: z.array(z.looseObject({ match: ZodGeneratedPackageSettingsMatch })) }),\n});\n"]}
|
package/lib/types/LinkPath.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod/v4-mini';
|
|
2
|
-
import type { LinkedPath } from '@ms-cloudpack/common-types';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export declare const
|
|
12
|
-
linkedPath: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<LinkedPath>, z.core.$strict>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
export type LinkPathInput = z.infer<typeof ZodLinkPathInput>;
|
|
15
|
-
export declare const ZodLinkPathOutput: z.ZodMiniObject<{
|
|
16
|
-
resolveMap: z.ZodMiniType<import("@ms-cloudpack/common-types").ResolveMap, import("@ms-cloudpack/common-types").ResolveMap, z.core.$ZodTypeInternals<import("@ms-cloudpack/common-types").ResolveMap, import("@ms-cloudpack/common-types").ResolveMap>>;
|
|
17
|
-
linkedPaths: z.ZodMiniArray<z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<LinkedPath>, z.core.$strict>>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
export type LinkPathOutput = z.infer<typeof ZodLinkPathOutput>;
|
|
2
|
+
import type { LinkedPath, ResolveMap } from '@ms-cloudpack/common-types';
|
|
3
|
+
export interface LinkPathInput {
|
|
4
|
+
linkedPath: LinkedPath;
|
|
5
|
+
}
|
|
6
|
+
export declare const ZodLinkPathInput: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<LinkPathInput>, z.core.$strip>;
|
|
7
|
+
export interface LinkPathOutput {
|
|
8
|
+
resolveMap: ResolveMap;
|
|
9
|
+
linkedPaths: LinkedPath[];
|
|
10
|
+
}
|
|
11
|
+
export declare const ZodLinkPathOutput: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<LinkPathOutput>, z.core.$strip>;
|
|
20
12
|
//# sourceMappingURL=LinkPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkPath.d.ts","sourceRoot":"","sources":["../../src/types/LinkPath.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"LinkPath.d.ts","sourceRoot":"","sources":["../../src/types/LinkPath.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAmCzE,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,6GAAkE,CAAC;AAEhG,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,8GAI5B,CAAC"}
|
package/lib/types/LinkPath.js
CHANGED
|
@@ -5,39 +5,28 @@
|
|
|
5
5
|
//
|
|
6
6
|
import { z } from 'zod/v4-mini';
|
|
7
7
|
import { matchingZodObject } from '../utilities/matchingZodObject.js';
|
|
8
|
-
import { ZodResolveMap } from '../types/ZodResolveMap.js';
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
-
const ZodPackageRecord = (ZodPackageJson) => z.record(z.string(), z.union([ZodPackageJson, z.undefined()]));
|
|
11
8
|
const ZodPackageHashesEntry = z.object({
|
|
12
9
|
browser: z.record(z.string(), z.string()),
|
|
13
10
|
node: z.record(z.string(), z.string()),
|
|
14
11
|
});
|
|
15
|
-
const
|
|
16
|
-
export const ZodLinkPackageDefinition = z.object({
|
|
17
|
-
// Name and version are required for the import map.
|
|
18
|
-
name: z.string(),
|
|
19
|
-
version: z.string(),
|
|
20
|
-
// The exports are also required for the import map.
|
|
21
|
-
exports: z.optional(z.any()),
|
|
22
|
-
// Dependencies are required for the resolve map.
|
|
23
|
-
dependencies: z.optional(ZodDependency),
|
|
24
|
-
peerDependencies: z.optional(ZodDependency),
|
|
25
|
-
});
|
|
26
|
-
export const ZodLinkedPath = matchingZodObject({
|
|
12
|
+
const ZodLinkedPath = matchingZodObject({
|
|
27
13
|
path: z.string(),
|
|
28
14
|
rootPath: z.optional(z.string()),
|
|
29
15
|
includeAll: z.optional(z.boolean()),
|
|
30
16
|
ignoredPackages: z.optional(z.array(z.string())),
|
|
31
17
|
ignoreResolutions: z.optional(z.boolean()),
|
|
32
18
|
resolveStrategy: z.optional(z.literal(['dedupe', 'duplicate'])),
|
|
33
|
-
remote: z.optional(
|
|
34
|
-
resolveMap: ZodResolveMap,
|
|
19
|
+
remote: z.optional(matchingZodObject({
|
|
35
20
|
hostUrl: z.string(),
|
|
21
|
+
// Skip schema validation of the resolve map since it's likely very large, and the various
|
|
22
|
+
// zod and procedure type helpers ensure the type is correct in the API.
|
|
23
|
+
resolveMap: z.record(z.string(), z.any()),
|
|
24
|
+
// Same with the serializable package definitions.
|
|
25
|
+
// If we need to enforce usage/sharing of a minimal subset of properties, that should be done
|
|
26
|
+
// with smaller subset/pick type (non-zod) which is used in all relevant locations.
|
|
36
27
|
packages: z.object({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// For linked packages, we need name and version across Cloudpack, and the exports for the import map.
|
|
40
|
-
transformedDefinitions: ZodPackageRecord(ZodLinkPackageDefinition),
|
|
28
|
+
definitions: z.record(z.string(), z.any()),
|
|
29
|
+
transformedDefinitions: z.record(z.string(), z.any()),
|
|
41
30
|
}),
|
|
42
31
|
packageHashes: z.object({
|
|
43
32
|
hashesWithSource: ZodPackageHashesEntry,
|
|
@@ -45,9 +34,10 @@ export const ZodLinkedPath = matchingZodObject({
|
|
|
45
34
|
}),
|
|
46
35
|
})),
|
|
47
36
|
});
|
|
48
|
-
export const ZodLinkPathInput =
|
|
49
|
-
export const ZodLinkPathOutput =
|
|
50
|
-
|
|
37
|
+
export const ZodLinkPathInput = matchingZodObject({ linkedPath: ZodLinkedPath });
|
|
38
|
+
export const ZodLinkPathOutput = matchingZodObject({
|
|
39
|
+
// Don't check the schema of the resolve map as it can be very large.
|
|
40
|
+
resolveMap: z.record(z.string(), z.any()),
|
|
51
41
|
linkedPaths: z.array(ZodLinkedPath),
|
|
52
42
|
});
|
|
53
43
|
//# sourceMappingURL=LinkPath.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkPath.js","sourceRoot":"","sources":["../../src/types/LinkPath.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,6FAA6F;AAC7F,oDAAoD;AACpD,oEAAoE;AACpE,EAAE;AACF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"LinkPath.js","sourceRoot":"","sources":["../../src/types/LinkPath.ts"],"names":[],"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AC7F,mFAAmF;QACnF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;YAC1C,sBAAsB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;SACtD,CAAC;QACF,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC;YACtB,gBAAgB,EAAE,qBAAqB;YACvC,kBAAkB,EAAE,qBAAqB;SAC1C,CAAC;KACH,CAAC,CACH;CACF,CAAC,CAAC;AAMH,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC;AAOhG,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAiB;IACjE,qEAAqE;IACrE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CACpC,CAAC,CAAC","sourcesContent":["//\n// This must be in a separate file because it's imported by busSources.ts, which is also used\n// in the browser, so it must only import zod types.\n// (Also, these types are used by both `linkPath` and `unlinkPath`.)\n//\nimport { z } from 'zod/v4-mini';\nimport { matchingZodObject } from '../utilities/matchingZodObject.js';\nimport type { LinkedPath, ResolveMap } from '@ms-cloudpack/common-types';\n\nconst ZodPackageHashesEntry = z.object({\n browser: z.record(z.string(), z.string()),\n node: z.record(z.string(), z.string()),\n});\n\nconst ZodLinkedPath = matchingZodObject<LinkedPath>({\n path: z.string(),\n rootPath: z.optional(z.string()),\n includeAll: z.optional(z.boolean()),\n ignoredPackages: z.optional(z.array(z.string())),\n ignoreResolutions: z.optional(z.boolean()),\n resolveStrategy: z.optional(z.literal(['dedupe', 'duplicate'])),\n remote: z.optional(\n matchingZodObject<NonNullable<LinkedPath['remote']>>({\n hostUrl: z.string(),\n // Skip schema validation of the resolve map since it's likely very large, and the various\n // zod and procedure type helpers ensure the type is correct in the API.\n resolveMap: z.record(z.string(), z.any()),\n // Same with the serializable package definitions.\n // If we need to enforce usage/sharing of a minimal subset of properties, that should be done\n // with smaller subset/pick type (non-zod) which is used in all relevant locations.\n packages: z.object({\n definitions: z.record(z.string(), z.any()),\n transformedDefinitions: z.record(z.string(), z.any()),\n }),\n packageHashes: z.object({\n hashesWithSource: ZodPackageHashesEntry,\n hashesWithNoSource: ZodPackageHashesEntry,\n }),\n }),\n ),\n});\n\nexport interface LinkPathInput {\n linkedPath: LinkedPath;\n}\n\nexport const ZodLinkPathInput = matchingZodObject<LinkPathInput>({ linkedPath: ZodLinkedPath });\n\nexport interface LinkPathOutput {\n resolveMap: ResolveMap;\n linkedPaths: LinkedPath[];\n}\n\nexport const ZodLinkPathOutput = matchingZodObject<LinkPathOutput>({\n // Don't check the schema of the resolve map as it can be very large.\n resolveMap: z.record(z.string(), z.any()),\n linkedPaths: z.array(ZodLinkedPath),\n});\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PackageJson } from '@ms-cloudpack/common-types';
|
|
2
|
+
import { z } from 'zod/v4-mini';
|
|
3
|
+
export interface NotifyLinkChangeInput {
|
|
4
|
+
packagePath: string;
|
|
5
|
+
hash?: string;
|
|
6
|
+
definition?: PackageJson;
|
|
7
|
+
}
|
|
8
|
+
export declare const ZodNotifyLinkChangeInput: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<NotifyLinkChangeInput>, z.core.$strip>;
|
|
9
|
+
//# sourceMappingURL=NotifyLinkChangeInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotifyLinkChangeInput.d.ts","sourceRoot":"","sources":["../../src/types/NotifyLinkChangeInput.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B;AAaD,eAAO,MAAM,wBAAwB,qHAInC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod/v4-mini';
|
|
2
|
+
import { matchingZodObject, matchingZodObjectLoose } from '../utilities/matchingZodObject.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validate that the package.json includes the name and version, and pass through all other fields
|
|
5
|
+
* without validation.
|
|
6
|
+
*/
|
|
7
|
+
const ZodBasicPackageJson = matchingZodObjectLoose({
|
|
8
|
+
name: z.string(),
|
|
9
|
+
version: z.string(),
|
|
10
|
+
});
|
|
11
|
+
export const ZodNotifyLinkChangeInput = matchingZodObject({
|
|
12
|
+
packagePath: z.string(),
|
|
13
|
+
hash: z.optional(z.string()),
|
|
14
|
+
definition: z.optional(ZodBasicPackageJson),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=NotifyLinkChangeInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotifyLinkChangeInput.js","sourceRoot":"","sources":["../../src/types/NotifyLinkChangeInput.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAQ9F;;;GAGG;AACH,MAAM,mBAAmB,GAA4C,sBAAsB,CAEzF;IACA,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAwB;IAC/E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CAC5C,CAAC,CAAC","sourcesContent":["//\n// This must be in a separate file because it's imported by busSources.ts, which is also used\n// in the browser, so it must only import zod types.\n//\nimport type { PackageJson } from '@ms-cloudpack/common-types';\nimport { z } from 'zod/v4-mini';\nimport { matchingZodObject, matchingZodObjectLoose } from '../utilities/matchingZodObject.js';\n\nexport interface NotifyLinkChangeInput {\n packagePath: string;\n hash?: string;\n definition?: PackageJson;\n}\n\n/**\n * Validate that the package.json includes the name and version, and pass through all other fields\n * without validation.\n */\nconst ZodBasicPackageJson: z.ZodMiniType<PackageJson, PackageJson> = matchingZodObjectLoose<\n Pick<PackageJson, 'name' | 'version'>\n>({\n name: z.string(),\n version: z.string(),\n});\n\nexport const ZodNotifyLinkChangeInput = matchingZodObject<NotifyLinkChangeInput>({\n packagePath: z.string(),\n hash: z.optional(z.string()),\n definition: z.optional(ZodBasicPackageJson),\n});\n"]}
|
|
@@ -18,5 +18,5 @@ export interface TaskDescription extends Pick<BundleResult, 'inputPath' | 'outpu
|
|
|
18
18
|
lastUpdated?: number;
|
|
19
19
|
timings?: Timing[];
|
|
20
20
|
}
|
|
21
|
-
export declare const ZodTaskDescription: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<TaskDescription>, z.core.$
|
|
21
|
+
export declare const ZodTaskDescription: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<TaskDescription>, z.core.$strip>;
|
|
22
22
|
//# sourceMappingURL=TaskDescription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskDescription.d.ts","sourceRoot":"","sources":["../../src/types/TaskDescription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,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AM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB,+GAY7B,CAAC"}
|
package/lib/types/TaskList.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { type TaskDescription } from './TaskDescription.js';
|
|
|
3
3
|
export interface TaskList {
|
|
4
4
|
tasks: TaskDescription[];
|
|
5
5
|
}
|
|
6
|
-
export declare const ZodTaskList: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<TaskList>, z.core.$
|
|
6
|
+
export declare const ZodTaskList: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<TaskList>, z.core.$strip>;
|
|
7
7
|
//# sourceMappingURL=TaskList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../src/types/TaskList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGhF,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../src/types/TaskList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGhF,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,WAAW,wGAEtB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { BundleMessage, BundleMessageNote } from '@ms-cloudpack/common-types';
|
|
3
3
|
export type TaskNote = BundleMessageNote;
|
|
4
|
-
export declare const ZodTaskNote: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<BundleMessageNote>, z.core.$
|
|
4
|
+
export declare const ZodTaskNote: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<BundleMessageNote>, z.core.$strip>;
|
|
5
5
|
export type TaskMessage = BundleMessage;
|
|
6
|
-
export declare const ZodTaskMessage: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<BundleMessage>, z.core.$
|
|
6
|
+
export declare const ZodTaskMessage: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<BundleMessage>, z.core.$strip>;
|
|
7
7
|
//# sourceMappingURL=TaskMessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskMessage.d.ts","sourceRoot":"","sources":["../../src/types/TaskMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAInF,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEzC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"TaskMessage.d.ts","sourceRoot":"","sources":["../../src/types/TaskMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAInF,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEzC,eAAO,MAAM,WAAW,iHAGtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAExC,eAAO,MAAM,cAAc,6GAKzB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod/v4-mini';
|
|
2
2
|
import type { BundleMessageLocation } from '@ms-cloudpack/common-types';
|
|
3
3
|
export type TaskMessageLocation = BundleMessageLocation;
|
|
4
|
-
export declare const ZodTaskMessageLocation: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<BundleMessageLocation>, z.core.$
|
|
4
|
+
export declare const ZodTaskMessageLocation: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<BundleMessageLocation>, z.core.$strip>;
|
|
5
5
|
//# sourceMappingURL=TaskMessageLocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskMessageLocation.d.ts","sourceRoot":"","sources":["../../src/types/TaskMessageLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"TaskMessageLocation.d.ts","sourceRoot":"","sources":["../../src/types/TaskMessageLocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,eAAO,MAAM,sBAAsB,qHAIjC,CAAC"}
|
package/lib/types/TaskStats.d.ts
CHANGED
|
@@ -27,5 +27,5 @@ export interface TaskStats {
|
|
|
27
27
|
*/
|
|
28
28
|
totalWarnings: number;
|
|
29
29
|
}
|
|
30
|
-
export declare const ZodTaskStats: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<TaskStats>, z.core.$
|
|
30
|
+
export declare const ZodTaskStats: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<TaskStats>, z.core.$strip>;
|
|
31
31
|
//# sourceMappingURL=TaskStats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskStats.d.ts","sourceRoot":"","sources":["../../src/types/TaskStats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,qGAAqG;IACrG,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IACvC,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"TaskStats.d.ts","sourceRoot":"","sources":["../../src/types/TaskStats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,qGAAqG;IACrG,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IACvC,yCAAyC;IACzC,cAAc,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,yGAMvB,CAAC"}
|
package/lib/types/Timing.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export interface Timing {
|
|
|
9
9
|
/** Exited prematurely. */
|
|
10
10
|
threwException?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare const ZodTiming: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<Timing>, z.core.$
|
|
12
|
+
export declare const ZodTiming: z.ZodMiniObject<import("../utilities/matchingZodObject.js").MatchingZodShape<Timing>, z.core.$strip>;
|
|
13
13
|
//# sourceMappingURL=Timing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timing.d.ts","sourceRoot":"","sources":["../../src/types/Timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC,MAAM,WAAW,MAAM;IACrB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"Timing.d.ts","sourceRoot":"","sources":["../../src/types/Timing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC,MAAM,WAAW,MAAM;IACrB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,SAAS,sGAKpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskRunner.d.ts","sourceRoot":"","sources":["../../src/utilities/TaskRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,KAAK,EAAE,IAAI,EAAsB,MAAM,kBAAkB,CAAC;AAGjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AASvD;;;;;;;GAOG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,IAAI,CAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,2EAA2E;IAC3E,OAAO,CA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,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,MAAsD;QAC5E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAChC,yCAAyC;QACzC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,CAAY,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9E,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,CAAW,cAAc,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;CACF","sourcesContent":["import type { DataBus } from '@ms-cloudpack/data-bus';\nimport PQueue from 'p-queue';\nimport { taskListSource, taskStatsSource } from '../data/busSources.js';\nimport type { Task, TaskEndDescription } from '../types/Task.js';\nimport type { TaskDescription } from '../types/TaskDescription.js';\nimport type { TaskList } from '../types/TaskList.js';\nimport type { TaskStats } from '../types/TaskStats.js';\n\ninterface TaskIssueStats extends Pick<TaskStats, 'totalErrors' | 'totalWarnings'> {\n /** Mapping from ID to count */\n taskWarnings: Record<string, number>;\n /** Mapping from ID to count */\n taskErrors: Record<string, number>;\n}\n\n/**\n * TaskRunner tracks the status of tasks, manages concurrency, allows reusing task results,\n * and sends notifications about task status to the data bus (currently just used for `start`).\n *\n * NOTE: To enable data bus notifications, you must call `connectToBus()`.\n * `createApiContext` does this with the `taskRunner` passed in.\n * (`createPartialApiContext` does not create or connect a data bus.)\n */\nexport class TaskRunner {\n private _bus: DataBus | undefined;\n private readonly _queue: PQueue;\n /** Stats about task errors/warnings, only updated if a bus is connected */\n private _taskIssues: TaskIssueStats;\n /**\n * Tasks that are currently either running or waiting. (Note that `PQeueue`'s definition of\n * \"pending\" is slightly different: it only counts tasks that are currently running.)\n */\n private readonly _pendingTasks: Map<string, Promise<unknown>>;\n /** Tasks that have completed */\n private readonly _completedTasks: Map<string, unknown>;\n /**\n * Task IDs where a re-run was requested while the task was running.\n * We let the current task finish, and then re-run it.\n */\n private readonly _requiresRerun: Set<string>;\n /** All previously-seen tasks (regardless of state) */\n private readonly _allTasks: Map<string, Task<unknown>>;\n\n constructor() {\n this._queue = new PQueue({ concurrency: 10 });\n this._taskIssues = { totalErrors: 0, totalWarnings: 0, taskWarnings: {}, taskErrors: {} };\n this._pendingTasks = new Map();\n this._completedTasks = new Map();\n this._requiresRerun = new Set();\n this._allTasks = new Map();\n }\n\n /**\n * Get current task stats. Public for testing.\n * @internal\n */\n get _taskStats(): Readonly<TaskStats> {\n return {\n status: this._pendingTasks.size ? 'pending' : 'idle',\n remainingTasks: this._pendingTasks.size,\n totalTasks: this._allTasks.size,\n totalErrors: this._taskIssues.totalErrors,\n totalWarnings: this._taskIssues.totalWarnings,\n };\n }\n\n /**\n * Connects the TaskRunner to the data bus. Tasks will still run without this, but they won't\n * send any notifications to a client (which only matters if a client is listening, e.g.\n * the browser while running `start`).\n */\n public connectToBus(bus: DataBus): void {\n this._bus = bus;\n }\n\n /**\n * Enqueue a task and return its result promise.\n *\n * If a task with the same `id` was already added, it returns either the previous result\n * (if completed) or the promise (if pending). Pass `options.rerun` to force re-running.\n *\n * (Note that any re-runs will use the *original* task function, not the new one.\n * If something has changed that requires a new task function, you should incorporate this\n * into the `id`.)\n */\n add<TReturn>(\n task: Task<TReturn>,\n options?: {\n rerun?: boolean;\n priority?: number;\n },\n ): Promise<TReturn> {\n const { name, id, execute } = task;\n const { rerun, priority } = options || {};\n\n if (!this._allTasks.has(id)) {\n this._allTasks.set(id, task as Task<unknown>);\n }\n\n // Check if we are already completed the task with that id.\n const action = this._completedTasks.get(id) as TReturn | undefined;\n if (action !== undefined && !rerun) {\n return Promise.resolve(action);\n }\n\n // Check if we are already running the task with that id.\n const pending = this._pendingTasks.get(id) as Promise<TReturn> | undefined;\n if (pending !== undefined) {\n if (rerun) {\n this._requiresRerun.add(id);\n }\n return pending;\n }\n\n const resultPromise: Promise<TReturn> = (async () => {\n let taskResult: TReturn | undefined;\n let taskError: unknown;\n\n try {\n do {\n // Delete from rerun list (if present).\n this._requiresRerun.delete(id);\n\n taskResult = await this._queue.add(\n execute,\n // Removes void from return type.\n // Read more on: https://github.com/sindresorhus/p-queue/issues/175\n { throwOnTimeout: true, priority },\n );\n } while (this._requiresRerun.has(id));\n } catch (error) {\n taskError = error;\n // Re-throw the error, but `finally` will handle completion\n throw error;\n } finally {\n // Delete from pending list.\n this._pendingTasks.delete(id);\n\n this._reportEnd(task, taskResult, taskError);\n }\n\n // Extra check to ensure that the task returned a value.\n // It should never throw, if it does we have a bug.\n if (taskResult === undefined) {\n throw new Error(`Task \"${name}:${id}\" returned undefined, without throwing an error, which was unexpected.`);\n }\n\n // Update finished Tasks.\n this._completedTasks.set(id, taskResult);\n\n return taskResult;\n })();\n\n this._pendingTasks.set(id, resultPromise);\n const wasCompleted = this._completedTasks.delete(id);\n if (wasCompleted) {\n this._removeTaskIssues(task.id);\n }\n\n this._reportStart<TReturn>(task);\n\n return resultPromise;\n }\n\n /**\n * Dispose in-memory resources of all tasks and clear the TaskRunner's state.\n */\n // NOTE: This is also used by clearAllResults(), so if it's updated to do anything that\n // renders the TaskRunner unusable/finished, the common parts should be refactored out.\n dispose(): void {\n this._queue.clear();\n for (const task of this._allTasks.values()) {\n task.dispose?.();\n }\n this._allTasks.clear();\n this._pendingTasks.clear();\n this._completedTasks.clear();\n this._requiresRerun.clear();\n this._taskIssues = { totalErrors: 0, totalWarnings: 0, taskWarnings: {}, taskErrors: {} };\n }\n\n /**\n * Clear the result of a specific task (could involve deleting files from disk) and remove\n * it from the TaskRunner's task records.\n */\n async clearResult(id: string): Promise<void> {\n const task = this._allTasks.get(id);\n task?.dispose?.();\n await task?.clear?.();\n\n this._allTasks.delete(id);\n this._requiresRerun.delete(id);\n this._pendingTasks.delete(id);\n this._completedTasks.delete(id);\n this._removeTaskIssues(id);\n\n if (this._bus) {\n const { tasks, index } = this._findFromTaskList(id);\n if (index !== -1) {\n tasks.splice(index, 1);\n this._publishUpdates({ tasks, stats: true });\n }\n }\n }\n\n /**\n * Clear the results of all tasks (might include deleting files on disk) and clear the\n * TaskRunner's task records.\n *\n * (To only dispose in-memory resources, use `dispose()`.)\n */\n async clearAllResults(): Promise<void> {\n // Publish the empty task list first since deleting things might take awhile.\n this._publishUpdates({ tasks: [] });\n\n for (const task of this._allTasks.values()) {\n task.dispose?.();\n await task.clear?.();\n }\n this.dispose();\n\n // Publish new stats after clearing everything (otherwise the calculated values will be wrong)\n this._publishUpdates({ stats: true });\n }\n\n /**\n * Pauses the TaskRunner (for testing).\n * @internal\n */\n _pause(): void {\n this._queue.pause();\n }\n\n /**\n * Starts or resumes the TaskRunner (for testing).\n * @internal\n */\n _start(): void {\n this._queue.start();\n }\n\n /** Remove any records of previous issues with this task from the totals */\n private _removeTaskIssues(id: string): void {\n this._taskIssues.totalErrors -= this._taskIssues.taskErrors[id] || 0;\n this._taskIssues.totalWarnings -= this._taskIssues.taskWarnings[id] || 0;\n delete this._taskIssues.taskErrors[id];\n delete this._taskIssues.taskWarnings[id];\n }\n\n /**\n * Internal method to report the start of a task to the bus.\n */\n private _reportStart<TReturn>(task: Task<TReturn>): void {\n if (!this._bus || !task.getStartDescription) return;\n\n const { tasks, index } = this._findFromTaskList(task.id);\n\n const taskDesc: TaskDescription = {\n id: task.id,\n name: task.name,\n ...task.getStartDescription(),\n status: 'pending',\n startTime: Date.now(),\n };\n if (index === -1) {\n tasks.push(taskDesc);\n } else {\n tasks[index] = taskDesc;\n }\n\n this._publishUpdates({ tasks, stats: true });\n }\n\n /**\n * Internal method to report the end of a task to the bus.\n */\n private _reportEnd<TReturn>(task: Task<TReturn>, taskResult: TReturn | undefined, taskError: unknown): void {\n if (!this._bus || !task.getEndDescription) return;\n\n // Replace the usual description with an error if relevant\n const description: TaskEndDescription = taskError\n ? {\n errors: [\n {\n source: 'running task',\n text: taskError instanceof Error ? taskError.stack || taskError.message : String(taskError),\n },\n ],\n }\n : task.getEndDescription(taskResult);\n const errorCount = description.errors?.length || 0;\n const warningCount = description.warnings?.length || 0;\n if (errorCount) {\n this._taskIssues.taskErrors[task.id] = errorCount;\n this._taskIssues.totalErrors += errorCount;\n }\n if (warningCount) {\n this._taskIssues.taskWarnings[task.id] = warningCount;\n this._taskIssues.totalWarnings += warningCount;\n }\n\n const { tasks, index } = this._findFromTaskList(task.id);\n const startDescription = tasks[index];\n\n if (startDescription) {\n const now = Date.now();\n tasks[index] = {\n ...startDescription,\n ...description,\n status: 'complete',\n duration: now - startDescription.startTime,\n lastUpdated: now,\n };\n\n this._publishUpdates({ tasks, stats: true });\n }\n }\n\n /** Get the task list from the data bus, and find the task's index. */\n private _findFromTaskList(id: string): { tasks: TaskDescription[]; index: number } {\n const tasks = this._bus?.getData<TaskList>(taskListSource.path)?.tasks || [];\n const index = tasks.findIndex((t) => t.id === id);\n return { tasks, index };\n }\n\n /**\n * Publish tasks and/or stats to the data bus.\n */\n private _publishUpdates(params: { tasks?: TaskDescription[]; stats?: boolean }): void {\n const { tasks, stats } = params;\n // Publish using .path for easier testing\n stats && this._bus?.publish<TaskStats>(taskStatsSource.path, this._taskStats);\n tasks && this._bus?.publish<TaskList>(taskListSource.path, { tasks });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TaskRunner.js","sourceRoot":"","sources":["../../src/utilities/TaskRunner.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAaxE;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IACb,IAAI,CAAsB;IACjB,MAAM,CAAS;IAChC,2EAA2E;IACnE,WAAW,CAAiB;IACpC;;;OAGG;IACc,aAAa,CAAgC;IAC9D,gCAAgC;IACf,eAAe,CAAuB;IACvD;;;OAGG;IACc,cAAc,CAAc;IAC7C,sDAAsD;IACrC,SAAS,CAA6B;IAEvD;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,WAAW,EAA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zD,MAAM,gBAAgB,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAEtC,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YACvB,KAAK,CAAC,KAAK,CAAC,GAAG;gBACb,GAAG,gBAAgB;gBACnB,GAAG,WAAW;gBACd,MAAM,EAAE,UAAU;gBAClB,QAAQ,EAAE,GAAG,GAAG,gBAAgB,CAAC,SAAS;gBAC1C,WAAW,EAAE,GAAG;aACjB,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,sEAAsE;IAC9D,iBAAiB,CAAC,EAAU;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,OAAO,CAAW,cAAc,CAAC,IAAI,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;QAC7E,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,MAAsD;QAC5E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAChC,yCAAyC;QACzC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,CAAY,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9E,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,CAAW,cAAc,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;CACF","sourcesContent":["import type { DataBus } from '@ms-cloudpack/data-bus';\nimport PQueue from 'p-queue';\nimport { taskListSource, taskStatsSource } from '../data/busSources.js';\nimport type { Task, TaskEndDescription } from '../types/Task.js';\nimport type { TaskDescription } from '../types/TaskDescription.js';\nimport type { TaskList } from '../types/TaskList.js';\nimport type { TaskStats } from '../types/TaskStats.js';\n\ninterface TaskIssueStats extends Pick<TaskStats, 'totalErrors' | 'totalWarnings'> {\n /** Mapping from ID to count */\n taskWarnings: Record<string, number>;\n /** Mapping from ID to count */\n taskErrors: Record<string, number>;\n}\n\n/**\n * TaskRunner tracks the status of tasks, manages concurrency, allows reusing task results,\n * and sends notifications about task status to the data bus (currently just used for `start`).\n *\n * NOTE: To enable data bus notifications, you must call `connectToBus()`.\n * `createApiContext` does this with the `taskRunner` passed in.\n * (`createPartialApiContext` does not create or connect a data bus.)\n */\nexport class TaskRunner {\n private _bus: DataBus | undefined;\n private readonly _queue: PQueue;\n /** Stats about task errors/warnings, only updated if a bus is connected */\n private _taskIssues: TaskIssueStats;\n /**\n * Tasks that are currently either running or waiting. (Note that `PQeueue`'s definition of\n * \"pending\" is slightly different: it only counts tasks that are currently running.)\n */\n private readonly _pendingTasks: Map<string, Promise<unknown>>;\n /** Tasks that have completed */\n private readonly _completedTasks: Map<string, unknown>;\n /**\n * Task IDs where a re-run was requested while the task was running.\n * We let the current task finish, and then re-run it.\n */\n private readonly _requiresRerun: Set<string>;\n /** All previously-seen tasks (regardless of state) */\n private readonly _allTasks: Map<string, Task<unknown>>;\n\n constructor() {\n this._queue = new PQueue({ concurrency: 10 });\n this._taskIssues = { totalErrors: 0, totalWarnings: 0, taskWarnings: {}, taskErrors: {} };\n this._pendingTasks = new Map();\n this._completedTasks = new Map();\n this._requiresRerun = new Set();\n this._allTasks = new Map();\n }\n\n /**\n * Get current task stats. Public for testing.\n * @internal\n */\n get _taskStats(): Readonly<TaskStats> {\n return {\n status: this._pendingTasks.size ? 'pending' : 'idle',\n remainingTasks: this._pendingTasks.size,\n totalTasks: this._allTasks.size,\n totalErrors: this._taskIssues.totalErrors,\n totalWarnings: this._taskIssues.totalWarnings,\n };\n }\n\n /**\n * Connects the TaskRunner to the data bus. Tasks will still run without this, but they won't\n * send any notifications to a client (which only matters if a client is listening, e.g.\n * the browser while running `start`).\n */\n public connectToBus(bus: DataBus): void {\n this._bus = bus;\n }\n\n /**\n * Enqueue a task and return its result promise.\n *\n * If a task with the same `id` was already added, it returns either the previous result\n * (if completed) or the promise (if pending). Pass `options.rerun` to force re-running.\n *\n * (Note that any re-runs will use the *original* task function, not the new one.\n * If something has changed that requires a new task function, you should incorporate this\n * into the `id`.)\n */\n add<TReturn>(\n task: Task<TReturn>,\n options?: {\n rerun?: boolean;\n priority?: number;\n },\n ): Promise<TReturn> {\n const { name, id, execute } = task;\n const { rerun, priority } = options || {};\n\n if (!this._allTasks.has(id)) {\n this._allTasks.set(id, task as Task<unknown>);\n }\n\n // Check if we are already completed the task with that id.\n const action = this._completedTasks.get(id) as TReturn | undefined;\n if (action !== undefined && !rerun) {\n return Promise.resolve(action);\n }\n\n // Check if we are already running the task with that id.\n const pending = this._pendingTasks.get(id) as Promise<TReturn> | undefined;\n if (pending !== undefined) {\n if (rerun) {\n this._requiresRerun.add(id);\n }\n return pending;\n }\n\n const resultPromise: Promise<TReturn> = (async () => {\n let taskResult: TReturn | undefined;\n let taskError: unknown;\n\n try {\n do {\n // Delete from rerun list (if present).\n this._requiresRerun.delete(id);\n\n taskResult = await this._queue.add(\n execute,\n // Removes void from return type.\n // Read more on: https://github.com/sindresorhus/p-queue/issues/175\n { throwOnTimeout: true, priority },\n );\n } while (this._requiresRerun.has(id));\n } catch (error) {\n taskError = error;\n // Re-throw the error, but `finally` will handle completion\n throw error;\n } finally {\n // Delete from pending list.\n this._pendingTasks.delete(id);\n\n this._reportEnd(task, taskResult, taskError);\n }\n\n // Extra check to ensure that the task returned a value.\n // It should never throw, if it does we have a bug.\n if (taskResult === undefined) {\n throw new Error(`Task \"${name}:${id}\" returned undefined, without throwing an error, which was unexpected.`);\n }\n\n // Update finished Tasks.\n this._completedTasks.set(id, taskResult);\n\n return taskResult;\n })();\n\n this._pendingTasks.set(id, resultPromise);\n const wasCompleted = this._completedTasks.delete(id);\n if (wasCompleted) {\n this._removeTaskIssues(task.id);\n }\n\n this._reportStart<TReturn>(task);\n\n return resultPromise;\n }\n\n /**\n * Dispose in-memory resources of all tasks and clear the TaskRunner's state.\n */\n // NOTE: This is also used by clearAllResults(), so if it's updated to do anything that\n // renders the TaskRunner unusable/finished, the common parts should be refactored out.\n dispose(): void {\n this._queue.clear();\n for (const task of this._allTasks.values()) {\n task.dispose?.();\n }\n this._allTasks.clear();\n this._pendingTasks.clear();\n this._completedTasks.clear();\n this._requiresRerun.clear();\n this._taskIssues = { totalErrors: 0, totalWarnings: 0, taskWarnings: {}, taskErrors: {} };\n }\n\n /**\n * Clear the result of a specific task (could involve deleting files from disk) and remove\n * it from the TaskRunner's task records.\n */\n async clearResult(id: string): Promise<void> {\n const task = this._allTasks.get(id);\n task?.dispose?.();\n await task?.clear?.();\n\n this._allTasks.delete(id);\n this._requiresRerun.delete(id);\n this._pendingTasks.delete(id);\n this._completedTasks.delete(id);\n this._removeTaskIssues(id);\n\n if (this._bus) {\n const { tasks, index } = this._findFromTaskList(id);\n if (index !== -1) {\n tasks.splice(index, 1);\n this._publishUpdates({ tasks, stats: true });\n }\n }\n }\n\n /**\n * Clear the results of all tasks (might include deleting files on disk) and clear the\n * TaskRunner's task records.\n *\n * (To only dispose in-memory resources, use `dispose()`.)\n */\n async clearAllResults(): Promise<void> {\n // Publish the empty task list first since deleting things might take awhile.\n this._publishUpdates({ tasks: [] });\n\n for (const task of this._allTasks.values()) {\n task.dispose?.();\n await task.clear?.();\n }\n this.dispose();\n\n // Publish new stats after clearing everything (otherwise the calculated values will be wrong)\n this._publishUpdates({ stats: true });\n }\n\n /**\n * Pauses the TaskRunner (for testing).\n * @internal\n */\n _pause(): void {\n this._queue.pause();\n }\n\n /**\n * Starts or resumes the TaskRunner (for testing).\n * @internal\n */\n _start(): void {\n this._queue.start();\n }\n\n /** Remove any records of previous issues with this task from the totals */\n private _removeTaskIssues(id: string): void {\n this._taskIssues.totalErrors -= this._taskIssues.taskErrors[id] || 0;\n this._taskIssues.totalWarnings -= this._taskIssues.taskWarnings[id] || 0;\n delete this._taskIssues.taskErrors[id];\n delete this._taskIssues.taskWarnings[id];\n }\n\n /**\n * Internal method to report the start of a task to the bus.\n */\n private _reportStart<TReturn>(task: Task<TReturn>): void {\n if (!this._bus || !task.getStartDescription) return;\n\n const { tasks, index } = this._findFromTaskList(task.id);\n\n const taskDesc: TaskDescription = {\n id: task.id,\n name: task.name,\n ...task.getStartDescription(),\n status: 'pending',\n startTime: Date.now(),\n };\n if (index === -1) {\n tasks.push(taskDesc);\n } else {\n tasks[index] = taskDesc;\n }\n\n this._publishUpdates({ tasks, stats: true });\n }\n\n /**\n * Internal method to report the end of a task to the bus.\n */\n private _reportEnd<TReturn>(task: Task<TReturn>, taskResult: TReturn | undefined, taskError: unknown): void {\n if (!this._bus || !task.getEndDescription) return;\n\n // Replace the usual description with an error if relevant\n const description: TaskEndDescription = taskError\n ? {\n errors: [\n {\n source: 'running task',\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n text: taskError instanceof Error ? taskError.stack || taskError.message : String(taskError),\n },\n ],\n }\n : task.getEndDescription(taskResult);\n const errorCount = description.errors?.length || 0;\n const warningCount = description.warnings?.length || 0;\n if (errorCount) {\n this._taskIssues.taskErrors[task.id] = errorCount;\n this._taskIssues.totalErrors += errorCount;\n }\n if (warningCount) {\n this._taskIssues.taskWarnings[task.id] = warningCount;\n this._taskIssues.totalWarnings += warningCount;\n }\n\n const { tasks, index } = this._findFromTaskList(task.id);\n const startDescription = tasks[index];\n\n if (startDescription) {\n const now = Date.now();\n tasks[index] = {\n ...startDescription,\n ...description,\n status: 'complete',\n duration: now - startDescription.startTime,\n lastUpdated: now,\n };\n\n this._publishUpdates({ tasks, stats: true });\n }\n }\n\n /** Get the task list from the data bus, and find the task's index. */\n private _findFromTaskList(id: string): { tasks: TaskDescription[]; index: number } {\n const tasks = this._bus?.getData<TaskList>(taskListSource.path)?.tasks || [];\n const index = tasks.findIndex((t) => t.id === id);\n return { tasks, index };\n }\n\n /**\n * Publish tasks and/or stats to the data bus.\n */\n private _publishUpdates(params: { tasks?: TaskDescription[]; stats?: boolean }): void {\n const { tasks, stats } = params;\n // Publish using .path for easier testing\n stats && this._bus?.publish<TaskStats>(taskStatsSource.path, this._taskStats);\n tasks && this._bus?.publish<TaskList>(taskListSource.path, { tasks });\n }\n}\n"]}
|
|
@@ -7,17 +7,19 @@ export type MatchingZodShape<T extends object> = {
|
|
|
7
7
|
[K in keyof Required<T>]: Omit<T, K> extends T ? z.ZodMiniOptional<z.ZodMiniType<T[K], T[K]>> : z.ZodMiniType<T[K], T[K]>;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
* Get a Zod object that
|
|
10
|
+
* Get a Zod object that matches the expected type, including any optional properties.
|
|
11
11
|
* (Does not provide the same guarantee for nested object types.)
|
|
12
12
|
*
|
|
13
|
+
* Unrecognized properties will be stripped/ignored at runtime.
|
|
14
|
+
* To preserve them, use `matchingZodObjectLoose` instead.
|
|
15
|
+
*
|
|
13
16
|
* Using this helper instead of `const ZodFoo = z.object({...}); type Foo = z.infer<typeof ZodFoo>;`
|
|
14
17
|
* is recommended in cases where the original type is defined elsewhere (such as in `common-types`),
|
|
15
18
|
* to ensure all the properties stay in sync.
|
|
16
19
|
*/
|
|
17
|
-
export declare function matchingZodObject<Expected extends object>(shape: MatchingZodShape<Expected>): z.ZodMiniObject<MatchingZodShape<Expected>, z.core.$
|
|
20
|
+
export declare function matchingZodObject<Expected extends object>(shape: MatchingZodShape<Expected>): z.ZodMiniObject<MatchingZodShape<Expected>, z.core.$strip>;
|
|
18
21
|
/**
|
|
19
22
|
* Like `matchingZodObject`, but pass through any extra properties that aren't defined in the shape.
|
|
20
|
-
* (The return type omits the index signature to ensure that the shape is still strictly typed.)
|
|
21
23
|
*
|
|
22
24
|
* See `matchingZodObject` comment for more details.
|
|
23
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchingZodObject.d.ts","sourceRoot":"","sources":["../../src/utilities/matchingZodObject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"matchingZodObject.d.ts","sourceRoot":"","sources":["../../src/utilities/matchingZodObject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAMhC;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;KAG9C,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAE1C,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5C,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,8DAE3F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,8DAEhG"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
2
|
import { z } from 'zod/v4-mini';
|
|
3
|
+
import enLocale from 'zod/v4/locales/en.js';
|
|
4
|
+
// Enable parse error messages
|
|
5
|
+
z.config(enLocale());
|
|
3
6
|
/**
|
|
4
|
-
* Get a Zod object that
|
|
7
|
+
* Get a Zod object that matches the expected type, including any optional properties.
|
|
5
8
|
* (Does not provide the same guarantee for nested object types.)
|
|
6
9
|
*
|
|
10
|
+
* Unrecognized properties will be stripped/ignored at runtime.
|
|
11
|
+
* To preserve them, use `matchingZodObjectLoose` instead.
|
|
12
|
+
*
|
|
7
13
|
* Using this helper instead of `const ZodFoo = z.object({...}); type Foo = z.infer<typeof ZodFoo>;`
|
|
8
14
|
* is recommended in cases where the original type is defined elsewhere (such as in `common-types`),
|
|
9
15
|
* to ensure all the properties stay in sync.
|
|
10
16
|
*/
|
|
11
17
|
export function matchingZodObject(shape) {
|
|
12
|
-
return z.
|
|
18
|
+
return z.object(shape);
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
15
21
|
* Like `matchingZodObject`, but pass through any extra properties that aren't defined in the shape.
|
|
16
|
-
* (The return type omits the index signature to ensure that the shape is still strictly typed.)
|
|
17
22
|
*
|
|
18
23
|
* See `matchingZodObject` comment for more details.
|
|
19
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchingZodObject.js","sourceRoot":"","sources":["../../src/utilities/matchingZodObject.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"matchingZodObject.js","sourceRoot":"","sources":["../../src/utilities/matchingZodObject.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAE5C,8BAA8B;AAC9B,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AAerB;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAA0B,KAAiC;IAC1F,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAA0B,KAAiC;IAC/F,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { z } from 'zod/v4-mini';\nimport enLocale from 'zod/v4/locales/en.js';\n\n// Enable parse error messages\nz.config(enLocale());\n\n/**\n * Zod shape object matching type `T`, with any optional properties remapped to required properties\n * with type `originalType | undefined`.\n */\nexport type MatchingZodShape<T extends object> = {\n // Use Required<T> in the mapping to ensure that all properties (including optional) are\n // included in the input zod shape.\n [K in keyof Required<T>]: Omit<T, K> extends T\n ? // If K is optional in T, make it a ZodOptional\n z.ZodMiniOptional<z.ZodMiniType<T[K], T[K]>>\n : z.ZodMiniType<T[K], T[K]>;\n};\n\n/**\n * Get a Zod object that matches the expected type, including any optional properties.\n * (Does not provide the same guarantee for nested object types.)\n *\n * Unrecognized properties will be stripped/ignored at runtime.\n * To preserve them, use `matchingZodObjectLoose` instead.\n *\n * Using this helper instead of `const ZodFoo = z.object({...}); type Foo = z.infer<typeof ZodFoo>;`\n * is recommended in cases where the original type is defined elsewhere (such as in `common-types`),\n * to ensure all the properties stay in sync.\n */\nexport function matchingZodObject<Expected extends object>(shape: MatchingZodShape<Expected>) {\n return z.object(shape);\n}\n\n/**\n * Like `matchingZodObject`, but pass through any extra properties that aren't defined in the shape.\n *\n * See `matchingZodObject` comment for more details.\n */\nexport function matchingZodObjectLoose<Expected extends object>(shape: MatchingZodShape<Expected>) {\n return z.looseObject(shape);\n}\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { NotifyLinkChangeInput } from '../
|
|
1
|
+
import type { NotifyLinkChangeInput } from '../types/NotifyLinkChangeInput.js';
|
|
2
2
|
import type { PartialContext } from '../types/Context.js';
|
|
3
|
+
import { type NotifyReloadOptions } from './notifyReload.js';
|
|
3
4
|
/**
|
|
4
5
|
* Notifies clients that a reload is needed and notifies the host of link changes.
|
|
5
6
|
*/
|
|
6
|
-
export declare function notifyHost(options: NotifyLinkChangeInput &
|
|
7
|
-
reason: string;
|
|
8
|
-
}, context: PartialContext<'bus' | 'telemetryClient', 'sequence'>): Promise<void>;
|
|
7
|
+
export declare function notifyHost(options: NotifyLinkChangeInput & NotifyReloadOptions, context: PartialContext<'bus' | 'telemetryClient', 'sequence'>): Promise<void>;
|
|
9
8
|
//# sourceMappingURL=notifyHost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyHost.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyHost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifyHost.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE3E;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,qBAAqB,GAAG,mBAAmB,EACpD,OAAO,EAAE,cAAc,CAAC,KAAK,GAAG,iBAAiB,EAAE,UAAU,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyHost.js","sourceRoot":"","sources":["../../src/utilities/notifyHost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifyHost.js","sourceRoot":"","sources":["../../src/utilities/notifyHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAE3E;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAoD,EACpD,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 { linkUpdateSource } from '../data/busSources.js';\nimport type { NotifyLinkChangeInput } from '../types/NotifyLinkChangeInput.js';\nimport type { PartialContext } from '../types/Context.js';\nimport { notifyReload, type NotifyReloadOptions } 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 & NotifyReloadOptions,\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"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { PartialContext } from '../types/Context.js';
|
|
2
|
+
export interface NotifyReloadOptions {
|
|
3
|
+
reason: string;
|
|
4
|
+
}
|
|
2
5
|
/**
|
|
3
6
|
* Notifies clients that a reload is needed by incrementing the session version.
|
|
4
7
|
*/
|
|
5
|
-
export declare function notifyReload(options:
|
|
6
|
-
reason: string;
|
|
7
|
-
}, context: PartialContext<'bus' | 'telemetryClient', 'sequence'>): Promise<void>;
|
|
8
|
+
export declare function notifyReload(options: NotifyReloadOptions, context: PartialContext<'bus' | 'telemetryClient', 'sequence'>): Promise<void>;
|
|
8
9
|
//# sourceMappingURL=notifyReload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyReload.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"notifyReload.d.ts","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,cAAc,CAAC,KAAK,GAAG,iBAAiB,EAAE,UAAU,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyReload.js","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"notifyReload.js","sourceRoot":"","sources":["../../src/utilities/notifyReload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA4B,EAC5B,OAA8D;IAE9D,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAElD,MAAM,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,EAAE;QACrE,OAAO,CAAC,QAAQ,EAAE,CAAC;QAEnB,IAAI,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAE3D,yCAAyC;QACzC,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { reloadCountSource } from '../data/busSources.js';\nimport type { PartialContext } from '../types/Context.js';\n\nexport interface NotifyReloadOptions {\n reason: string;\n}\n\n/**\n * Notifies clients that a reload is needed by incrementing the session version.\n */\nexport async function notifyReload(\n options: NotifyReloadOptions,\n context: PartialContext<'bus' | 'telemetryClient', 'sequence'>,\n): Promise<void> {\n const { reason } = options;\n const { bus, session, telemetryClient } = context;\n\n await telemetryClient.tracer.startActiveSpan('NOTIFY_RELOAD', (span) => {\n session.sequence++;\n\n span.setAttributes({ sequence: session.sequence, reason });\n\n // Publish using .path for easier testing\n bus.publish(reloadCountSource.path, session.sequence);\n });\n}\n"]}
|