@ms-cloudpack/api-server 0.22.0 → 0.23.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/syncDownload.d.ts.map +1 -1
- package/lib/apis/syncDownload.js +8 -12
- package/lib/apis/syncDownload.js.map +1 -1
- package/lib/apis/syncUpload.d.ts.map +1 -1
- package/lib/apis/syncUpload.js +9 -14
- package/lib/apis/syncUpload.js.map +1 -1
- package/lib/common/createPartialApiContext.d.ts.map +1 -1
- package/lib/common/createPartialApiContext.js +16 -2
- package/lib/common/createPartialApiContext.js.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +2 -0
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.js.map +1 -1
- package/lib/trpc/createContextFactory.d.ts +2 -0
- package/lib/trpc/createContextFactory.d.ts.map +1 -1
- package/lib/trpc/createContextFactory.js +3 -1
- package/lib/trpc/createContextFactory.js.map +1 -1
- package/lib/types/Context.d.ts +2 -0
- package/lib/types/Context.d.ts.map +1 -1
- package/lib/types/Context.js.map +1 -1
- package/lib/utilities/createRemoteCacheClient.d.ts +7 -0
- package/lib/utilities/createRemoteCacheClient.d.ts.map +1 -0
- package/lib/utilities/createRemoteCacheClient.js +20 -0
- package/lib/utilities/createRemoteCacheClient.js.map +1 -0
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncDownload.d.ts","sourceRoot":"","sources":["../../src/apis/syncDownload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"syncDownload.d.ts","sourceRoot":"","sources":["../../src/apis/syncDownload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD,QAAA,MAAM,oBAAoB;;;;;;EAExB,CAAC;AAEH,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE9D,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,CAAC,iBAAiB,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,iBAAiB,CAAC,GAC5F,OAAO,CAAC,IAAI,CAAC,CAyBf;yBA3BqB,YAAY"}
|
package/lib/apis/syncDownload.js
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { publicProcedure } from '../trpc/common.js';
|
|
3
|
-
import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';
|
|
4
3
|
import { getPackagesToSync } from '../utilities/getPackagesToSync.js';
|
|
5
4
|
import { PerfMeasurementSyncDownload } from '../performance/markers.js';
|
|
6
5
|
import { getRemoteCachePromiseResultCounts } from '../utilities/getRemoteCachePromiseResultCounts.js';
|
|
6
|
+
import { createRemoteCacheClient } from '../utilities/createRemoteCacheClient.js';
|
|
7
7
|
const ZodSyncDownloadInput = z.object({
|
|
8
8
|
isInteractiveLogin: z.boolean(),
|
|
9
9
|
});
|
|
10
10
|
export async function syncDownload(params) {
|
|
11
11
|
const { input, ctx } = params;
|
|
12
12
|
const { isInteractiveLogin } = input;
|
|
13
|
-
const {
|
|
13
|
+
const { session, packages, telemetryClient } = ctx;
|
|
14
14
|
const { resolveMap } = session;
|
|
15
15
|
await telemetryClient.performance.track(PerfMeasurementSyncDownload, async (tracker) => {
|
|
16
|
-
const config = ensureRemoteCacheEnabled(session.config);
|
|
17
16
|
const [client, packagesToSync] = await Promise.all([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
connectionStringOptions: {
|
|
21
|
-
container: config.container,
|
|
22
|
-
storageAccount: config.storageAccount,
|
|
23
|
-
permissions: { read: true, write: false, list: true },
|
|
17
|
+
createRemoteCacheClient({
|
|
18
|
+
input: {
|
|
24
19
|
isInteractiveLogin,
|
|
25
|
-
|
|
20
|
+
permissions: { read: true, write: false, list: true },
|
|
26
21
|
},
|
|
27
|
-
|
|
22
|
+
ctx,
|
|
23
|
+
}),
|
|
28
24
|
getPackagesToSync({ packages, resolveMap }),
|
|
29
25
|
]);
|
|
30
26
|
const downloads = packagesToSync.map((pkg) => client.downloadFolder(pkg));
|
|
31
|
-
// Do not reject
|
|
27
|
+
// Do not reject if there is a failure. Failed downloads will be logged in the task reporter.
|
|
32
28
|
const promiseResults = await Promise.allSettled(downloads);
|
|
33
29
|
tracker.setProperties(getRemoteCachePromiseResultCounts(promiseResults));
|
|
34
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncDownload.js","sourceRoot":"","sources":["../../src/apis/syncDownload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"syncDownload.js","sourceRoot":"","sources":["../../src/apis/syncDownload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE;CAChC,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA6F;IAE7F,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IACrC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;IACnD,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,MAAM,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACrF,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACjD,uBAAuB,CAAC;gBACtB,KAAK,EAAE;oBACL,kBAAkB;oBAClB,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;iBACtD;gBACD,GAAG;aACJ,CAAC;YACF,iBAAiB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;SAC5C,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1E,6FAA6F;QAC7F,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE3D,OAAO,CAAC,aAAa,CAAC,iCAAiC,CAAC,cAAc,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,YAAY,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport { getPackagesToSync } from '../utilities/getPackagesToSync.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { PerfMeasurementSyncDownload } from '../performance/markers.js';\nimport { getRemoteCachePromiseResultCounts } from '../utilities/getRemoteCachePromiseResultCounts.js';\nimport { createRemoteCacheClient } from '../utilities/createRemoteCacheClient.js';\n\nconst ZodSyncDownloadInput = z.object({\n isInteractiveLogin: z.boolean(),\n});\n\ntype SyncDownloadInput = z.infer<typeof ZodSyncDownloadInput>;\n\nexport async function syncDownload(\n params: ApiParams<SyncDownloadInput, 'session' | 'packages' | 'reporter' | 'telemetryClient'>,\n): Promise<void> {\n const { input, ctx } = params;\n const { isInteractiveLogin } = input;\n const { session, packages, telemetryClient } = ctx;\n const { resolveMap } = session;\n\n await telemetryClient.performance.track(PerfMeasurementSyncDownload, async (tracker) => {\n const [client, packagesToSync] = await Promise.all([\n createRemoteCacheClient({\n input: {\n isInteractiveLogin,\n permissions: { read: true, write: false, list: true },\n },\n ctx,\n }),\n getPackagesToSync({ packages, resolveMap }),\n ]);\n\n const downloads = packagesToSync.map((pkg) => client.downloadFolder(pkg));\n\n // Do not reject if there is a failure. Failed downloads will be logged in the task reporter.\n const promiseResults = await Promise.allSettled(downloads);\n\n tracker.setProperties(getRemoteCachePromiseResultCounts(promiseResults));\n });\n}\n\n// Attach a trpc procedure to the function.\nsyncDownload.procedure = publicProcedure.input(ZodSyncDownloadInput).mutation(syncDownload);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncUpload.d.ts","sourceRoot":"","sources":["../../src/apis/syncUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"syncUpload.d.ts","sourceRoot":"","sources":["../../src/apis/syncUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD,QAAA,MAAM,kBAAkB;;;;;;EAEtB,CAAC;AAEH,KAAK,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE1D,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CACf,eAAe,EACf,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,SAAS,GAAG,iBAAiB,GAAG,oBAAoB,CAClH,GACA,OAAO,CAAC,IAAI,CAAC,CA4Cf;yBAjDqB,UAAU"}
|
package/lib/apis/syncUpload.js
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { publicProcedure } from '../trpc/common.js';
|
|
3
|
-
import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';
|
|
4
3
|
import { ensurePackageBundled } from './ensurePackageBundled.js';
|
|
5
4
|
import { basename } from 'path';
|
|
6
5
|
import { ensureFieldsExist } from '../utilities/ensureFieldsExist.js';
|
|
7
6
|
import { PerfMeasurementSyncUpload } from '../performance/markers.js';
|
|
8
7
|
import { getRemoteCachePromiseResultCounts } from '../utilities/getRemoteCachePromiseResultCounts.js';
|
|
8
|
+
import { createRemoteCacheClient } from '../utilities/createRemoteCacheClient.js';
|
|
9
9
|
const ZodSyncUploadInput = z.object({
|
|
10
10
|
isInteractiveLogin: z.boolean(),
|
|
11
11
|
});
|
|
12
12
|
export async function syncUpload(params) {
|
|
13
13
|
const { ctx, input } = params;
|
|
14
|
-
const {
|
|
14
|
+
const { session, telemetryClient } = ctx;
|
|
15
15
|
const { appPath } = session;
|
|
16
16
|
const { isInteractiveLogin } = input;
|
|
17
17
|
await telemetryClient.performance.track(PerfMeasurementSyncUpload, async (tracker) => {
|
|
18
|
-
const config = ensureRemoteCacheEnabled(session.config);
|
|
19
18
|
const packageDefinition = await ctx.packages.get(appPath);
|
|
20
19
|
const { name, version } = ensureFieldsExist(packageDefinition, ['name', 'version']);
|
|
21
20
|
const [client, { dependencies, result }] = await Promise.all([
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
permissions: { read: false, write: true, list: true },
|
|
29
|
-
isInteractiveLogin,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
21
|
+
createRemoteCacheClient({
|
|
22
|
+
input: {
|
|
23
|
+
isInteractiveLogin,
|
|
24
|
+
permissions: { read: false, write: true, list: true },
|
|
25
|
+
},
|
|
26
|
+
ctx,
|
|
32
27
|
}),
|
|
33
28
|
ensurePackageBundled({
|
|
34
29
|
input: {
|
|
@@ -48,7 +43,7 @@ export async function syncUpload(params) {
|
|
|
48
43
|
path: p.outputPath,
|
|
49
44
|
}));
|
|
50
45
|
const uploads = packages.map((pkg) => client.uploadFolder(pkg));
|
|
51
|
-
// Do not reject
|
|
46
|
+
// Do not reject if there is a failure. Failed uploads will be logged in the task reporter.
|
|
52
47
|
const promiseResults = await Promise.allSettled(uploads);
|
|
53
48
|
tracker.setProperties(getRemoteCachePromiseResultCounts(promiseResults));
|
|
54
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncUpload.js","sourceRoot":"","sources":["../../src/apis/syncUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"syncUpload.js","sourceRoot":"","sources":["../../src/apis/syncUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,iCAAiC,EAAE,MA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AC,MAAM,YAAY,CAAC,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,eAAe;aAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;aAC3B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACX,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;YAClC,YAAY,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,OAAO,EAAE;YACtC,IAAI,EAAE,CAAC,CAAC,UAAU;SACnB,CAAC,CAAC,CAAC;QAEN,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAEhE,2FAA2F;QAC3F,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,CAAC,aAAa,CAAC,iCAAiC,CAAC,cAAc,CAAC,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,UAAU,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { publicProcedure } from '../trpc/common.js';\nimport { ensurePackageBundled } from './ensurePackageBundled.js';\nimport { basename } from 'path';\nimport { ensureFieldsExist } from '../utilities/ensureFieldsExist.js';\nimport { PerfMeasurementSyncUpload } from '../performance/markers.js';\nimport type { ApiParams } from '../types/ApiParams.js';\nimport { getRemoteCachePromiseResultCounts } from '../utilities/getRemoteCachePromiseResultCounts.js';\nimport { createRemoteCacheClient } from '../utilities/createRemoteCacheClient.js';\n\nconst ZodSyncUploadInput = z.object({\n isInteractiveLogin: z.boolean(),\n});\n\ntype SyncUploadInput = z.infer<typeof ZodSyncUploadInput>;\n\nexport async function syncUpload(\n params: ApiParams<\n SyncUploadInput,\n 'session' | 'packages' | 'reporter' | 'bus' | 'taskRunner' | 'watcher' | 'telemetryClient' | 'packageImportPaths'\n >,\n): Promise<void> {\n const { ctx, input } = params;\n const { session, telemetryClient } = ctx;\n const { appPath } = session;\n const { isInteractiveLogin } = input;\n\n await telemetryClient.performance.track(PerfMeasurementSyncUpload, async (tracker) => {\n const packageDefinition = await ctx.packages.get(appPath);\n const { name, version } = ensureFieldsExist(packageDefinition, ['name', 'version']);\n\n const [client, { dependencies, result }] = await Promise.all([\n createRemoteCacheClient({\n input: {\n isInteractiveLogin,\n permissions: { read: false, write: true, list: true },\n },\n ctx,\n }),\n ensurePackageBundled({\n input: {\n name,\n version,\n enqueueDependencies: true,\n },\n ctx,\n }),\n ]);\n\n const bundledPackages = [result, ...(await dependencies)];\n const packages = bundledPackages\n .filter((p) => p.isExternal)\n .map((p) => ({\n folderName: basename(p.outputPath),\n friendlyName: `${p.name}@${p.version}`,\n path: p.outputPath,\n }));\n\n const uploads = packages.map((pkg) => client.uploadFolder(pkg));\n\n // Do not reject if there is a failure. Failed uploads will be logged in the task reporter.\n const promiseResults = await Promise.allSettled(uploads);\n\n tracker.setProperties(getRemoteCachePromiseResultCounts(promiseResults));\n });\n}\n\n// Attach a trpc procedure to the function.\nsyncUpload.procedure = publicProcedure.input(ZodSyncUploadInput).mutation(syncUpload);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPartialApiContext.d.ts","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"createPartialApiContext.d.ts","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAUnD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;CAClC;AAsHD,wBAAsB,uBAAuB,CAC3C,KAAK,SAAS,OAAO,CAAC,MAAM,OAAO,EAAE,SAAS,CAAC,EAC/C,OAAO,SAAS,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,iBAAiB,CAAC,EACjF,OAAO,EAAE,qBAAqB,GAAG;IAAE,KAAK,EAAE,KAAK,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBvE"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _LazyApiContext_bus, _LazyApiContext_watcher, _LazyApiContext_packages, _LazyApiContext_taskRunner, _LazyApiContext_session, _LazyApiContext_packageImportPaths;
|
|
12
|
+
var _LazyApiContext_bus, _LazyApiContext_watcher, _LazyApiContext_packages, _LazyApiContext_taskRunner, _LazyApiContext_session, _LazyApiContext_packageImportPaths, _LazyApiContext_packageHashes;
|
|
13
13
|
class LazyApiContext {
|
|
14
14
|
constructor(options) {
|
|
15
15
|
this.options = options;
|
|
@@ -19,6 +19,7 @@ class LazyApiContext {
|
|
|
19
19
|
_LazyApiContext_taskRunner.set(this, void 0);
|
|
20
20
|
_LazyApiContext_session.set(this, void 0);
|
|
21
21
|
_LazyApiContext_packageImportPaths.set(this, void 0);
|
|
22
|
+
_LazyApiContext_packageHashes.set(this, void 0);
|
|
22
23
|
}
|
|
23
24
|
get telemetryClient() {
|
|
24
25
|
return Promise.resolve(this.options.telemetryClient);
|
|
@@ -56,6 +57,19 @@ class LazyApiContext {
|
|
|
56
57
|
}
|
|
57
58
|
return __classPrivateFieldGet(this, _LazyApiContext_packages, "f");
|
|
58
59
|
}
|
|
60
|
+
get packageHashes() {
|
|
61
|
+
if (!__classPrivateFieldGet(this, _LazyApiContext_packageHashes, "f")) {
|
|
62
|
+
const createPackageHashesLazy = async () => {
|
|
63
|
+
const { PackageHashes } = await import('@ms-cloudpack/package-hashes');
|
|
64
|
+
const { resolveMap } = await this.session;
|
|
65
|
+
return new PackageHashes({
|
|
66
|
+
context: { packages: await this.packages, config: this.options.config, resolveMap },
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
__classPrivateFieldSet(this, _LazyApiContext_packageHashes, createPackageHashesLazy(), "f");
|
|
70
|
+
}
|
|
71
|
+
return __classPrivateFieldGet(this, _LazyApiContext_packageHashes, "f");
|
|
72
|
+
}
|
|
59
73
|
get taskRunner() {
|
|
60
74
|
if (!__classPrivateFieldGet(this, _LazyApiContext_taskRunner, "f")) {
|
|
61
75
|
const createTaskRunnerLazy = async () => {
|
|
@@ -93,7 +107,7 @@ class LazyApiContext {
|
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
|
-
_LazyApiContext_bus = new WeakMap(), _LazyApiContext_watcher = new WeakMap(), _LazyApiContext_packages = new WeakMap(), _LazyApiContext_taskRunner = new WeakMap(), _LazyApiContext_session = new WeakMap(), _LazyApiContext_packageImportPaths = new WeakMap();
|
|
110
|
+
_LazyApiContext_bus = new WeakMap(), _LazyApiContext_watcher = new WeakMap(), _LazyApiContext_packages = new WeakMap(), _LazyApiContext_taskRunner = new WeakMap(), _LazyApiContext_session = new WeakMap(), _LazyApiContext_packageImportPaths = new WeakMap(), _LazyApiContext_packageHashes = new WeakMap();
|
|
97
111
|
export async function createPartialApiContext(options) {
|
|
98
112
|
const { reporter, telemetryClient, items } = options;
|
|
99
113
|
const lazyContext = new LazyApiContext(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPartialApiContext.js","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"createPartialApiContext.js","sourceRoot":"","sources":["../../src/common/createPartialApiContext.ts"],"names":[],"mappings":";;;;;;;;;;;;AAwBA,MAAM,cAAc;IASlB,YAA6B,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;QAR3D,sCAAmC;QACnC,0CAAuC;QACvC,2CAAwD;QACxD,6CAA6C;QAC7C,0CAAuC;QACvC,qDAA6D;QAC7D,gDAAmD;IAEW,CAAC;IAE/D,IAAW,eAAe;QACxB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvD,CAAC;IAED,IAAW,GAAG;QACZ,IAAI,CAAC,uBAAA,IAAI,2BAAK,EAAE;YACd,MAAM,iBAAiB,GAAG,KAAK,IAAI,EAAE;gBACnC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;gBACjE,OAAO,aAAa,EAAE,CAAC;YACzB,CAAC,CAAC;YACF,uBAAA,IAAI,uBAAQ,iBAAiB,EAAE,MAAA,CAAC;SACjC;QAED,OAAO,uBAAA,IAAI,2BAAK,CAAC;IACnB,CAAC;IAED,IAAW,OAAO;QA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AAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,iCAAiC,CAAC,CAAC;gBAC/E,OAAO,IAAI,kBAAkB,EAAE,CAAC;YAClC,CAAC,CAAC;YACF,uBAAA,IAAI,sCAAuB,4BAA4B,EAAE,MAAA,CAAC;SAC3D;QAED,OAAO,uBAAA,IAAI,0CAAoB,CAAC;IAClC,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,IAAI,uBAAA,IAAI,+BAAS,EAAE;YACjB,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,+BAAS,CAAC;YACpC,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;SAC5B;IACH,CAAC;CACF;;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAG3C,OAAmD;IACnD,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IACrD,MAAM,WAAW,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAEhD,MAAM,MAAM,GAAG;QACb,QAAQ;QACR,eAAe;QACf,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,WAAW,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC;KACS,CAAC;IAEb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAmB,CAAC;KAC5D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { CloudpackConfig } from '@ms-cloudpack/config';\nimport type { DataBus } from '@ms-cloudpack/data-bus';\nimport type { Watcher } from '@ms-cloudpack/file-watcher';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { Context } from '../types/Context.js';\nimport type { Session } from '../types/Session.js';\nimport type { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\ntype PromisifyProperties<T> = {\n [K in keyof T]: T[K] extends (...args: unknown[]) => unknown ? T[K] : Promise<T[K]>;\n};\n\nexport interface LazyApiContextOptions {\n reporter: TaskReporter;\n appPath: string;\n overlayPath?: string;\n config: CloudpackConfig;\n telemetryClient: TelemetryClient;\n}\n\nclass LazyApiContext implements PromisifyProperties<Context> {\n #bus: Promise<DataBus> | undefined;\n #watcher: Promise<Watcher> | undefined;\n #packages: Promise<PackageDefinitionsCache> | undefined;\n #taskRunner: Promise<TaskRunner> | undefined;\n #session: Promise<Session> | undefined;\n #packageImportPaths: Promise<PackageImportPaths> | undefined;\n #packageHashes: Promise<PackageHashes> | undefined;\n\n constructor(private readonly options: LazyApiContextOptions) {}\n\n public get telemetryClient(): Promise<TelemetryClient> {\n return Promise.resolve(this.options.telemetryClient);\n }\n\n public get bus(): Promise<DataBus> {\n if (!this.#bus) {\n const createDataBusLazy = async () => {\n const { createDataBus } = await import('@ms-cloudpack/data-bus');\n return createDataBus();\n };\n this.#bus = createDataBusLazy();\n }\n\n return this.#bus;\n }\n\n public get watcher(): Promise<Watcher> {\n if (!this.#watcher) {\n const createWatcherLazy = async () => {\n const { createWatcher } = await import('@ms-cloudpack/file-watcher');\n return createWatcher();\n };\n this.#watcher = createWatcherLazy();\n }\n\n return this.#watcher;\n }\n\n public get reporter(): Promise<TaskReporter> {\n return Promise.resolve(this.options.reporter);\n }\n\n public get packages(): Promise<PackageDefinitionsCache> {\n if (!this.#packages) {\n const createPackageDefinitionsLazy = async () => {\n const { createPackageDefinitions } = await import('@ms-cloudpack/config');\n return createPackageDefinitions({ config: this.options.config });\n };\n this.#packages = createPackageDefinitionsLazy();\n }\n\n return this.#packages;\n }\n\n public get packageHashes(): Promise<PackageHashes> {\n if (!this.#packageHashes) {\n const createPackageHashesLazy = async () => {\n const { PackageHashes } = await import('@ms-cloudpack/package-hashes');\n const { resolveMap } = await this.session;\n return new PackageHashes({\n context: { packages: await this.packages, config: this.options.config, resolveMap },\n });\n };\n this.#packageHashes = createPackageHashesLazy();\n }\n\n return this.#packageHashes;\n }\n\n public get taskRunner(): Promise<TaskRunner> {\n if (!this.#taskRunner) {\n const createTaskRunnerLazy = async () => {\n const { TaskRunner } = await import('../utilities/TaskRunner.js');\n return new TaskRunner();\n };\n this.#taskRunner = createTaskRunnerLazy();\n }\n return this.#taskRunner;\n }\n\n public get session(): Promise<Session> {\n if (!this.#session) {\n const createSessionLazy = async () => {\n const { createSession } = await import('./createSession.js');\n return createSession(\n { appPath: this.options.appPath, config: this.options.config, overlayPath: this.options.overlayPath },\n { reporter: await this.reporter, packages: await this.packages },\n );\n };\n this.#session = createSessionLazy();\n }\n\n return this.#session;\n }\n\n public get packageImportPaths(): Promise<PackageImportPaths> {\n if (!this.#packageImportPaths) {\n const createPackageImportPathsLazy = async () => {\n const { PackageImportPaths } = await import('@ms-cloudpack/package-utilities');\n return new PackageImportPaths();\n };\n this.#packageImportPaths = createPackageImportPathsLazy();\n }\n\n return this.#packageImportPaths;\n }\n\n public async dispose() {\n if (this.#watcher) {\n const watcher = await this.#watcher;\n await watcher.unwatchAll();\n }\n }\n}\n\nexport async function createPartialApiContext<\n TKeys extends Exclude<keyof Context, 'dispose'>,\n TReturn extends Pick<Context, TKeys | 'dispose' | 'reporter' | 'telemetryClient'>,\n>(options: LazyApiContextOptions & { items: TKeys[] }): Promise<TReturn> {\n const { reporter, telemetryClient, items } = options;\n const lazyContext = new LazyApiContext(options);\n\n const result = {\n reporter,\n telemetryClient,\n dispose: () => {\n return lazyContext.dispose();\n },\n } as TReturn;\n\n for (const item of items) {\n result[item] = (await lazyContext[item]) as TReturn[TKeys];\n }\n\n return result;\n}\n"]}
|
|
@@ -3,12 +3,14 @@ import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
|
3
3
|
import type { Session } from '../types/Session.js';
|
|
4
4
|
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
5
5
|
import type { PackageImportPaths } from '@ms-cloudpack/package-utilities';
|
|
6
|
+
import type { PackageHashes } from '@ms-cloudpack/package-hashes';
|
|
6
7
|
export declare function createCloudpackServer(options: {
|
|
7
8
|
session: Session;
|
|
8
9
|
telemetryClient: TelemetryClient;
|
|
9
10
|
reporter: TaskReporter;
|
|
10
11
|
packages: PackageDefinitionsCache;
|
|
11
12
|
packageImportPaths: PackageImportPaths;
|
|
13
|
+
packageHashes: PackageHashes;
|
|
12
14
|
}): Promise<{
|
|
13
15
|
url: string;
|
|
14
16
|
port: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAKnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC;CAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCA;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCloudpackServer.js","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,EAAE,eAAe,EAAkB,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"createCloudpackServer.js","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,E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AAO;QACL,GAAG,eAAe;QAClB,GAAG,EAAE,GAAG,iBAAiB,MAAM,QAAQ,IAAI,IAAI,EAAE;QACjD,IAAI;QACJ,GAAG,EAAE,gBAAgB;QAErB,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAID,8FAA8F;AAC9F,8DAA8D;AAC9D,SAAS,WAAW,CAClB,IAAW,EACX,GAAa;IAEb,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAChC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,EAAE;QAC1B,GAAG,CAAC,GAAkB,CAAC,GAAG,CAAC,KAAgD,EAAE,EAAE;QAC7E,+DAA+D;QAC/D,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAuG,CACxG,CAAC;AACJ,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { applyWSSHandler } from '@trpc/server/adapters/ws';\nimport getPort from 'get-port';\nimport { WebSocketServer } from 'ws';\nimport type { Session } from '../types/Session.js';\nimport { createAppRouter, type AppRouter } from './createAppRouter.js';\nimport { createContextFactory } from './createContextFactory.js';\nimport { createHTTPServer } from './httpAdapter.js';\nimport cors from 'cors';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\nexport async function createCloudpackServer(options: {\n session: Session;\n telemetryClient: TelemetryClient;\n reporter: TaskReporter;\n packages: PackageDefinitionsCache;\n packageImportPaths: PackageImportPaths;\n packageHashes: PackageHashes;\n}) {\n const createContext = await createContextFactory(options);\n const hostname = options.session.config?.devServer?.domain || 'localhost';\n const https = options.session.config?.devServer?.https;\n const port = await getPort({ port: [9890, 9891, 9892, 9893] });\n const { router, apis } = createAppRouter();\n const { server, listen } = createHTTPServer({\n middleware: cors(),\n router,\n createContext,\n https,\n });\n const webSocketProtocol = https ? 'wss' : 'ws';\n const wss = new WebSocketServer({ server });\n\n applyWSSHandler<AppRouter>({\n wss,\n router,\n createContext,\n });\n\n listen(port, hostname);\n\n const localCallContext = await createContext();\n const apisWithContext = withContext(apis, localCallContext);\n\n return {\n ...apisWithContext,\n url: `${webSocketProtocol}://${hostname}:${port}`,\n port,\n ctx: localCallContext,\n\n close: async () => {\n await localCallContext.dispose();\n server.close();\n wss.close();\n },\n };\n}\n\nexport type CloudpackServer = ReturnType<typeof createCloudpackServer>;\n\n/** Helper to tie the local call context with the apis so callers don't have to cache them. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction withContext<TApis extends { [key: string]: (options: { input: any; ctx: TContext }) => any }, TContext>(\n apis: TApis,\n ctx: TContext,\n) {\n return Object.entries(apis).reduce(\n (acc, [key, apiFunction]) => {\n acc[key as keyof TApis] = (input: Parameters<TApis[typeof key]>[0]['input']) =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n apiFunction({ input, ctx });\n return acc;\n },\n {} as { [key in keyof TApis]: (options: Parameters<TApis[key]>[0]['input']) => ReturnType<TApis[key]> },\n );\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
|
4
4
|
import type { Context } from '../types/Context.js';
|
|
5
5
|
import type { Session } from '../types/Session.js';
|
|
6
6
|
import type { PackageImportPaths } from '@ms-cloudpack/package-utilities';
|
|
7
|
+
import type { PackageHashes } from '@ms-cloudpack/package-hashes';
|
|
7
8
|
export type CreateContext = () => Promise<Context>;
|
|
8
9
|
/**
|
|
9
10
|
* Creates the server context and returns a connection context factory.
|
|
@@ -16,5 +17,6 @@ export declare function createContextFactory(options: {
|
|
|
16
17
|
telemetryClient: TelemetryClient;
|
|
17
18
|
packages: PackageDefinitionsCache;
|
|
18
19
|
packageImportPaths: PackageImportPaths;
|
|
20
|
+
packageHashes: PackageHashes;
|
|
19
21
|
}): Promise<CreateContext>;
|
|
20
22
|
//# sourceMappingURL=createContextFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContextFactory.d.ts","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"createContextFactory.d.ts","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAEnD;;;;GAIG;AAEH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC;CAC9B,0BAmDA"}
|
|
@@ -8,7 +8,7 @@ import { TaskRunner } from '../utilities/TaskRunner.js';
|
|
|
8
8
|
*/
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/require-await
|
|
10
10
|
export async function createContextFactory(options) {
|
|
11
|
-
const { session, telemetryClient, reporter, packages, packageImportPaths } = options;
|
|
11
|
+
const { session, telemetryClient, reporter, packages, packageImportPaths, packageHashes } = options;
|
|
12
12
|
// const host = config?.devServer?.domain || 'localhost';
|
|
13
13
|
// const port = await getPort({ port: [9890, 9891, 9892, 9893] });
|
|
14
14
|
// const bus = createDataBus();
|
|
@@ -37,6 +37,8 @@ export async function createContextFactory(options) {
|
|
|
37
37
|
taskRunner,
|
|
38
38
|
// package import paths
|
|
39
39
|
packageImportPaths,
|
|
40
|
+
// package hashes
|
|
41
|
+
packageHashes,
|
|
40
42
|
// dispose things that the context creates.
|
|
41
43
|
async dispose() {
|
|
42
44
|
await watcher.unwatchAll();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createContextFactory.js","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"createContextFactory.js","sourceRoot":"","sources":["../../src/trpc/createContextFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQxD;;;;GAIG;AACH,4DAA4D;AAC5D,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAO1C;IACC,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACpG,yDAAyD;IACzD,kEAAkE;IAClE,+BAA+B;IAE/B,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,yFAAyF;IACzF,wFAAwF;IACxF,6CAA6C;IAC7C,4DAA4D;IAC5D,MAAM,aAAa,GAAkB,KAAK,IAAI,EAAE;QAC9C,OAAO;YACL,kBAAkB;YAClB,OAAO;YAEP,WAAW;YACX,GAAG;YAEH,YAAY;YACZ,eAAe;YAEf,UAAU;YACV,QAAQ;YAER,eAAe;YACf,OAAO;YAEP,WAAW;YACX,QAAQ;YAER,QAAQ;YACR,UAAU;YAEV,uBAAuB;YACvB,kBAAkB;YAElB,iBAAiB;YACjB,aAAa;YAEb,2CAA2C;YAC3C,KAAK,CAAC,OAAO;gBACX,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC7B,CAAC;SACF,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport { createDataBus } from '@ms-cloudpack/data-bus';\nimport { createWatcher } from '@ms-cloudpack/file-watcher';\nimport type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { Context } from '../types/Context.js';\nimport type { Session } from '../types/Session.js';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\nexport type CreateContext = () => Promise<Context>;\n\n/**\n * Creates the server context and returns a connection context factory.\n * The context object is accessible to apis and serves as a way to share stateful\n * objects across them.\n */\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function createContextFactory(options: {\n session: Session;\n reporter: TaskReporter;\n telemetryClient: TelemetryClient;\n packages: PackageDefinitionsCache;\n packageImportPaths: PackageImportPaths;\n packageHashes: PackageHashes;\n}) {\n const { session, telemetryClient, reporter, packages, packageImportPaths, packageHashes } = options;\n // const host = config?.devServer?.domain || 'localhost';\n // const port = await getPort({ port: [9890, 9891, 9892, 9893] });\n // const bus = createDataBus();\n\n const bus = createDataBus();\n const watcher = createWatcher();\n const taskRunner = new TaskRunner();\n\n // Return the factory function which creates a context object per connection. This allows\n // us to choose what we expose to each client from server context, but also allows us to\n // add additional context to each connection.\n // eslint-disable-next-line @typescript-eslint/require-await\n const createContext: CreateContext = async () => {\n return {\n // session manager\n session,\n\n // data bus\n bus,\n\n // telemetry\n telemetryClient,\n\n // logging\n reporter,\n\n // file watcher\n watcher,\n\n // packages\n packages,\n\n // tasks\n taskRunner,\n\n // package import paths\n packageImportPaths,\n\n // package hashes\n packageHashes,\n\n // dispose things that the context creates.\n async dispose() {\n await watcher.unwatchAll();\n },\n };\n };\n\n return createContext;\n}\n"]}
|
package/lib/types/Context.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { TelemetryClient } from '@ms-cloudpack/telemetry';
|
|
|
6
6
|
import type { Session } from '../types/Session.js';
|
|
7
7
|
import type { TaskRunner } from '../utilities/TaskRunner.js';
|
|
8
8
|
import type { PackageImportPaths } from '@ms-cloudpack/package-utilities';
|
|
9
|
+
import type { PackageHashes } from '@ms-cloudpack/package-hashes';
|
|
9
10
|
/** Context for Cloudpack API server procedures. */
|
|
10
11
|
export interface Context {
|
|
11
12
|
session: Session;
|
|
@@ -16,6 +17,7 @@ export interface Context {
|
|
|
16
17
|
packages: PackageDefinitionsCache;
|
|
17
18
|
taskRunner: TaskRunner;
|
|
18
19
|
packageImportPaths: PackageImportPaths;
|
|
20
|
+
packageHashes: PackageHashes;
|
|
19
21
|
dispose(): Promise<void>;
|
|
20
22
|
}
|
|
21
23
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,mDAAmD;AACnD,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,EAAE,UAAU,CAAC;IACvB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"}
|
package/lib/types/Context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { DataBus } from '@ms-cloudpack/data-bus';\nimport type { Watcher } from '@ms-cloudpack/file-watcher';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { Session } from '../types/Session.js';\nimport type { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\n\n/** Context for Cloudpack API server procedures. */\nexport interface Context {\n session: Session;\n bus: DataBus;\n telemetryClient: TelemetryClient;\n reporter: TaskReporter;\n watcher: Watcher;\n packages: PackageDefinitionsCache;\n taskRunner: TaskRunner;\n packageImportPaths: PackageImportPaths;\n dispose(): Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../src/types/Context.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';\nimport type { DataBus } from '@ms-cloudpack/data-bus';\nimport type { Watcher } from '@ms-cloudpack/file-watcher';\nimport type { TaskReporter } from '@ms-cloudpack/task-reporter';\nimport type { TelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { Session } from '../types/Session.js';\nimport type { TaskRunner } from '../utilities/TaskRunner.js';\nimport type { PackageImportPaths } from '@ms-cloudpack/package-utilities';\nimport type { PackageHashes } from '@ms-cloudpack/package-hashes';\n\n/** Context for Cloudpack API server procedures. */\nexport interface Context {\n session: Session;\n bus: DataBus;\n telemetryClient: TelemetryClient;\n reporter: TaskReporter;\n watcher: Watcher;\n packages: PackageDefinitionsCache;\n taskRunner: TaskRunner;\n packageImportPaths: PackageImportPaths;\n packageHashes: PackageHashes;\n dispose(): Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConnectionStringOptions } from '@ms-cloudpack/remote-cache';
|
|
2
|
+
import type { ApiParams } from '../types/ApiParams.js';
|
|
3
|
+
export declare function createRemoteCacheClient(params: ApiParams<{
|
|
4
|
+
permissions: ConnectionStringOptions['permissions'];
|
|
5
|
+
isInteractiveLogin: boolean;
|
|
6
|
+
}, 'session' | 'reporter'>): Promise<import("@ms-cloudpack/remote-cache").RemoteCacheClient>;
|
|
7
|
+
//# sourceMappingURL=createRemoteCacheClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRemoteCacheClient.d.ts","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,CACf;IACE,WAAW,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACpD,kBAAkB,EAAE,OAAO,CAAC;CAC7B,EACD,SAAS,GAAG,UAAU,CACvB,mEAqBF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';
|
|
2
|
+
export async function createRemoteCacheClient(params) {
|
|
3
|
+
const { ctx, input } = params;
|
|
4
|
+
const { permissions, isInteractiveLogin } = input;
|
|
5
|
+
const { session, reporter } = ctx;
|
|
6
|
+
const { container, storageAccount, tokenExpiresInMs } = ensureRemoteCacheEnabled(session.config);
|
|
7
|
+
const remoteCacheModule = await import('@ms-cloudpack/remote-cache');
|
|
8
|
+
const client = await remoteCacheModule.createRemoteCacheClient({
|
|
9
|
+
reporter,
|
|
10
|
+
connectionStringOptions: {
|
|
11
|
+
container,
|
|
12
|
+
storageAccount,
|
|
13
|
+
permissions,
|
|
14
|
+
isInteractiveLogin,
|
|
15
|
+
tokenExpiresInMs,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return client;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=createRemoteCacheClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRemoteCacheClient.js","sourceRoot":"","sources":["../../src/utilities/createRemoteCacheClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAIpF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAMC;IAED,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;IAClC,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjG,MAAM,iBAAiB,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,uBAAuB,CAAC;QAC7D,QAAQ;QACR,uBAAuB,EAAE;YACvB,SAAS;YACT,cAAc;YACd,WAAW;YACX,kBAAkB;YAClB,gBAAgB;SACjB;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { ensureRemoteCacheEnabled } from '../utilities/ensureRemoteCacheEnabled.js';\nimport type { ConnectionStringOptions } from '@ms-cloudpack/remote-cache';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nexport async function createRemoteCacheClient(\n params: ApiParams<\n {\n permissions: ConnectionStringOptions['permissions'];\n isInteractiveLogin: boolean;\n },\n 'session' | 'reporter'\n >,\n) {\n const { ctx, input } = params;\n const { permissions, isInteractiveLogin } = input;\n const { session, reporter } = ctx;\n const { container, storageAccount, tokenExpiresInMs } = ensureRemoteCacheEnabled(session.config);\n\n const remoteCacheModule = await import('@ms-cloudpack/remote-cache');\n\n const client = await remoteCacheModule.createRemoteCacheClient({\n reporter,\n connectionStringOptions: {\n container,\n storageAccount,\n permissions,\n isInteractiveLogin,\n tokenExpiresInMs,\n },\n });\n\n return client;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/api-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "An implementation of the API server that does interacts with a task scheduler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,14 +28,15 @@
|
|
|
28
28
|
"@lage-run/scheduler": "^1.1.9",
|
|
29
29
|
"@lage-run/target-graph": "^0.8.7",
|
|
30
30
|
"@lage-run/hasher": "^1.0.5",
|
|
31
|
-
"@ms-cloudpack/bundler": "^0.15.
|
|
31
|
+
"@ms-cloudpack/bundler": "^0.15.3",
|
|
32
32
|
"@ms-cloudpack/bundler-types": "^0.19.4",
|
|
33
|
-
"@ms-cloudpack/config": "^0.14.
|
|
33
|
+
"@ms-cloudpack/config": "^0.14.5",
|
|
34
34
|
"@ms-cloudpack/create-express-app": "^1.3.12",
|
|
35
35
|
"@ms-cloudpack/data-bus": "^0.4.1",
|
|
36
36
|
"@ms-cloudpack/file-watcher": "^0.1.1",
|
|
37
37
|
"@ms-cloudpack/json-utilities": "^0.0.8",
|
|
38
|
-
"@ms-cloudpack/package-
|
|
38
|
+
"@ms-cloudpack/package-hashes": "^0.0.1",
|
|
39
|
+
"@ms-cloudpack/package-utilities": "^5.2.0",
|
|
39
40
|
"@ms-cloudpack/path-string-parsing": "^1.1.1",
|
|
40
41
|
"@ms-cloudpack/path-utilities": "^2.3.5",
|
|
41
42
|
"@ms-cloudpack/task-reporter": "^0.10.0",
|