@ms-cloudpack/api-server 0.64.0 → 0.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/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/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 +5 -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 +14 -14
- 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
|
@@ -1 +1 @@
|
|
|
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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 '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,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,WAAW,GAAG,EAAE,WAAW,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;QAC1F,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,IAAI,GAAG,EAAE,CAAC;QACjC,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACH,IAAI,U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,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;AAEhC;;;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
|
|
1
|
+
{"version":3,"file":"matchingZodObject.d.ts","sourceRoot":"","sources":["../../src/utilities/matchingZodObject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC;;;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,21 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
2
|
import { z } from 'zod/v4-mini';
|
|
3
3
|
/**
|
|
4
|
-
* Get a Zod object that
|
|
4
|
+
* Get a Zod object that matches the expected type, including any optional properties.
|
|
5
5
|
* (Does not provide the same guarantee for nested object types.)
|
|
6
6
|
*
|
|
7
|
+
* Unrecognized properties will be stripped/ignored at runtime.
|
|
8
|
+
* To preserve them, use `matchingZodObjectLoose` instead.
|
|
9
|
+
*
|
|
7
10
|
* Using this helper instead of `const ZodFoo = z.object({...}); type Foo = z.infer<typeof ZodFoo>;`
|
|
8
11
|
* is recommended in cases where the original type is defined elsewhere (such as in `common-types`),
|
|
9
12
|
* to ensure all the properties stay in sync.
|
|
10
13
|
*/
|
|
11
14
|
export function matchingZodObject(shape) {
|
|
12
|
-
return z.
|
|
15
|
+
return z.object(shape);
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* 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
19
|
*
|
|
18
20
|
* See `matchingZodObject` comment for more details.
|
|
19
21
|
*/
|
|
@@ -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;AAehC
|
|
1
|
+
{"version":3,"file":"matchingZodObject.js","sourceRoot":"","sources":["../../src/utilities/matchingZodObject.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAehC;;;;;;;;;;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';\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/api-server",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.1",
|
|
4
4
|
"description": "An implementation of the API server that does interacts with a task scheduler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@ms-cloudpack/bundler": "^0.25.
|
|
27
|
-
"@ms-cloudpack/common-types": "^0.25.
|
|
28
|
-
"@ms-cloudpack/config": "^0.35.
|
|
29
|
-
"@ms-cloudpack/create-express-app": "^1.10.
|
|
26
|
+
"@ms-cloudpack/bundler": "^0.25.15",
|
|
27
|
+
"@ms-cloudpack/common-types": "^0.25.1",
|
|
28
|
+
"@ms-cloudpack/config": "^0.35.12",
|
|
29
|
+
"@ms-cloudpack/create-express-app": "^1.10.37",
|
|
30
30
|
"@ms-cloudpack/data-bus": "^0.5.0",
|
|
31
31
|
"@ms-cloudpack/environment": "^0.1.1",
|
|
32
|
-
"@ms-cloudpack/esm-stub-utilities": "^0.15.
|
|
33
|
-
"@ms-cloudpack/file-watcher": "^0.3.
|
|
34
|
-
"@ms-cloudpack/import-map": "^0.10.
|
|
32
|
+
"@ms-cloudpack/esm-stub-utilities": "^0.15.1",
|
|
33
|
+
"@ms-cloudpack/file-watcher": "^0.3.8",
|
|
34
|
+
"@ms-cloudpack/import-map": "^0.10.30",
|
|
35
35
|
"@ms-cloudpack/json-utilities": "^0.1.10",
|
|
36
|
-
"@ms-cloudpack/package-hashes": "^0.8.
|
|
37
|
-
"@ms-cloudpack/package-utilities": "^12.3.
|
|
36
|
+
"@ms-cloudpack/package-hashes": "^0.8.13",
|
|
37
|
+
"@ms-cloudpack/package-utilities": "^12.3.14",
|
|
38
38
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
39
|
-
"@ms-cloudpack/path-utilities": "^3.1.
|
|
40
|
-
"@ms-cloudpack/remote-cache": "^0.11.
|
|
41
|
-
"@ms-cloudpack/task-reporter": "^0.17.
|
|
42
|
-
"@ms-cloudpack/telemetry": "^0.11.
|
|
39
|
+
"@ms-cloudpack/path-utilities": "^3.1.8",
|
|
40
|
+
"@ms-cloudpack/remote-cache": "^0.11.24",
|
|
41
|
+
"@ms-cloudpack/task-reporter": "^0.17.2",
|
|
42
|
+
"@ms-cloudpack/telemetry": "^0.11.26",
|
|
43
43
|
"@trpc/client": "^11.1.1",
|
|
44
44
|
"@trpc/server": "^11.1.1",
|
|
45
45
|
"cors": "^2.8.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZodGetLinkConfigOutput.d.ts","sourceRoot":"","sources":["../../src/types/ZodGetLinkConfigOutput.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAQtE,eAAO,MAAM,sBAAsB,EAAE,CAAC,CAAC,WAAW,CAAC,mBAAmB,EAAE,mBAAmB,CAMvF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZodGetLinkConfigOutput.js","sourceRoot":"","sources":["../../src/types/ZodGetLinkConfigOutput.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,6FAA6F;AAC7F,oDAAoD;AACpD,EAAE;AACF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,gEAAgE;AAChE,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AACtG,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,6BAA6B,CAAC,CAAC,CAAC;AACrF,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,sBAAsB,GACjC,sBAAsB,CAAsB;IAC1C,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 } from '@ms-cloudpack/common-types';\nimport { matchingZodObjectLoose } from '../utilities/matchingZodObject.js';\n\n// Minimum acceptable match object for a low maintenance burden.\nconst ZodPackageSettingsMatchObject = z.object({ name: z.string(), version: z.optional(z.string()) });\nconst ZodPackageSettingsMatch = z.union([z.string(), ZodPackageSettingsMatchObject]);\nconst ZodGeneratedPackageSettingsMatch = z.union([z.string(), z.required(ZodPackageSettingsMatchObject)]);\n\nexport const ZodGetLinkConfigOutput: z.ZodMiniType<CloudpackLinkConfig, CloudpackLinkConfig> =\n matchingZodObjectLoose<CloudpackLinkConfig>({\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"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4-mini';
|
|
2
|
-
export declare const ZodNotifyLinkChangeInput: z.ZodMiniObject<{
|
|
3
|
-
packagePath: z.ZodMiniString<string>;
|
|
4
|
-
hash: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
5
|
-
definition: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
6
|
-
name: z.ZodMiniString<string>;
|
|
7
|
-
version: z.ZodMiniString<string>;
|
|
8
|
-
exports: z.ZodMiniOptional<z.ZodMiniAny>;
|
|
9
|
-
dependencies: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniUndefined, z.ZodMiniString<string>]>>>>;
|
|
10
|
-
peerDependencies: z.ZodMiniOptional<z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniUndefined, z.ZodMiniString<string>]>>>>;
|
|
11
|
-
}, z.core.$strip>>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
|
-
//# sourceMappingURL=ZodNotifyLinkChangeInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZodNotifyLinkChangeInput.d.ts","sourceRoot":"","sources":["../../src/types/ZodNotifyLinkChangeInput.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAGhC,eAAO,MAAM,wBAAwB;;;;;;;;;;iBAInC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// This must be in a separate file because it's imported by busSources.ts, which is also used
|
|
3
|
-
// in the browser, so it must only import zod types.
|
|
4
|
-
//
|
|
5
|
-
import { z } from 'zod/v4-mini';
|
|
6
|
-
import { ZodLinkPackageDefinition } from '../types/LinkPath.js';
|
|
7
|
-
export const ZodNotifyLinkChangeInput = z.object({
|
|
8
|
-
packagePath: z.string(),
|
|
9
|
-
hash: z.optional(z.string()),
|
|
10
|
-
definition: z.optional(ZodLinkPackageDefinition),
|
|
11
|
-
});
|
|
12
|
-
//# sourceMappingURL=ZodNotifyLinkChangeInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZodNotifyLinkChangeInput.js","sourceRoot":"","sources":["../../src/types/ZodNotifyLinkChangeInput.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,6FAA6F;AAC7F,oDAAoD;AACpD,EAAE;AACF,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;CACjD,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 { ZodLinkPackageDefinition } from '../types/LinkPath.js';\n\nexport const ZodNotifyLinkChangeInput = z.object({\n packagePath: z.string(),\n hash: z.optional(z.string()),\n definition: z.optional(ZodLinkPackageDefinition),\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZodResolveMap.d.ts","sourceRoot":"","sources":["../../src/types/ZodResolveMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,4BAA4B,CAAC;AAqB9E,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,WAAW,CAAC,UAAU,EAAE,UAAU,CAA4C,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4-mini';
|
|
2
|
-
import { matchingZodObject } from '../utilities/matchingZodObject.js';
|
|
3
|
-
const ZodResolveMapEntry = z.lazy(() => matchingZodObject({
|
|
4
|
-
name: z.string(),
|
|
5
|
-
version: z.string(),
|
|
6
|
-
path: z.string(),
|
|
7
|
-
dependencies: z.record(z.string(), z.string()),
|
|
8
|
-
requiredBy: z.record(z.string(), z.string()),
|
|
9
|
-
isExternal: z.optional(z.boolean()),
|
|
10
|
-
isLinked: z.optional(z.boolean()),
|
|
11
|
-
scopedVersions: z.optional(z.record(z.string(), z.lazy(() => ZodResolveMapEntry))),
|
|
12
|
-
}));
|
|
13
|
-
export const ZodResolveMap = z.record(z.string(), ZodResolveMapEntry);
|
|
14
|
-
//# sourceMappingURL=ZodResolveMap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ZodResolveMap.js","sourceRoot":"","sources":["../../src/types/ZodResolveMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,kBAAkB,GAAoD,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACtF,iBAAiB,CAAkB;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACjC,cAAc,EAAE,CAAC,CAAC,QAAQ,CACxB,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,CACjC,CACF;CACF,CAAC,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAA0C,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { z } from 'zod/v4-mini';\nimport type { ResolveMap, ResolveMapEntry } from '@ms-cloudpack/common-types';\nimport { matchingZodObject } from '../utilities/matchingZodObject.js';\n\nconst ZodResolveMapEntry: z.ZodMiniType<ResolveMapEntry, ResolveMapEntry> = z.lazy(() =>\n matchingZodObject<ResolveMapEntry>({\n name: z.string(),\n version: z.string(),\n path: z.string(),\n dependencies: z.record(z.string(), z.string()),\n requiredBy: z.record(z.string(), z.string()),\n isExternal: z.optional(z.boolean()),\n isLinked: z.optional(z.boolean()),\n scopedVersions: z.optional(\n z.record(\n z.string(),\n z.lazy(() => ZodResolveMapEntry),\n ),\n ),\n }),\n);\n\nexport const ZodResolveMap: z.ZodMiniType<ResolveMap, ResolveMap> = z.record(z.string(), ZodResolveMapEntry);\n"]}
|