@procedures/client 0.39.0 → 0.41.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/CHANGELOG.md +18 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/client/middleware/cache.js +3 -3
- package/dist/client/middleware/cache.js.map +1 -1
- package/dist/procedures/core/array.d.ts +1 -1
- package/dist/procedures/core/array.js +1 -1
- package/dist/procedures/core/comparison.d.ts +1 -1
- package/dist/procedures/core/comparison.js +1 -1
- package/dist/procedures/core/index.d.ts +2 -2
- package/dist/procedures/core/index.d.ts.map +1 -1
- package/dist/procedures/core/math.d.ts +1 -1
- package/dist/procedures/core/math.js +1 -1
- package/dist/procedures/core/meta.d.ts +1 -1
- package/dist/procedures/core/meta.js +1 -1
- package/dist/procedures/core/object.d.ts +1 -1
- package/dist/procedures/core/object.js +1 -1
- package/dist/procedures/core/string.d.ts +1 -1
- package/dist/procedures/core/string.js +1 -1
- package/dist/procedures/core/type.d.ts +1 -1
- package/dist/procedures/core/type.js +1 -1
- package/dist/procedures/define-procedure.js +1 -1
- package/dist/procedures/define-procedure.js.map +1 -1
- package/dist/procedures/module.d.ts +1 -1
- package/dist/procedures/module.d.ts.map +1 -1
- package/dist/procedures/module.js +2 -1
- package/dist/procedures/module.js.map +1 -1
- package/dist/procedures/ref.d.ts +4 -4
- package/dist/procedures/ref.js +4 -4
- package/dist/procedures/types.d.ts +2 -2
- package/dist/procedures/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client/middleware/cache.ts +3 -3
- package/src/procedures/core/array.ts +1 -1
- package/src/procedures/core/comparison.ts +1 -1
- package/src/procedures/core/index.ts +2 -2
- package/src/procedures/core/math.ts +1 -1
- package/src/procedures/core/meta.ts +1 -1
- package/src/procedures/core/object.ts +1 -1
- package/src/procedures/core/string.ts +1 -1
- package/src/procedures/core/type.ts +1 -1
- package/src/procedures/define-procedure.ts +1 -1
- package/src/procedures/module.ts +2 -2
- package/src/procedures/ref.ts +4 -4
- package/src/procedures/types.ts +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Object Procedures
|
|
3
3
|
*
|
|
4
4
|
* Object manipulation operations for procedure aggregation.
|
|
5
|
-
*
|
|
5
|
+
* The namespace of all these procedures is "client": for example client.get and client.set.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* String Procedures
|
|
3
3
|
*
|
|
4
4
|
* String manipulation operations for procedure aggregation.
|
|
5
|
-
*
|
|
5
|
+
* The namespace of all these procedures is "client": for example client.concat and client.split.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { z } from "zod";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Type Procedures
|
|
3
3
|
*
|
|
4
4
|
* Type checking and coercion operations for procedure aggregation.
|
|
5
|
-
*
|
|
5
|
+
* The namespace of all these procedures is "client": for example client.typeof and client.isArray.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { z } from "zod";
|
|
@@ -575,7 +575,7 @@ export const deleteProcedureProcedure: Procedure<
|
|
|
575
575
|
// A code procedure stays (deep dive CORE-3: before, delete only forgot the runtime record)
|
|
576
576
|
if (!isRuntimeDefined(existing)) {
|
|
577
577
|
throw new Error(
|
|
578
|
-
`procedure.delete removes only a procedure that procedure.define made: ${input.path
|
|
578
|
+
`procedure.delete removes only a procedure that procedure.define made: ${pathToKey(input.path)} is a code procedure.`
|
|
579
579
|
);
|
|
580
580
|
}
|
|
581
581
|
return { deleted: registry.unregister(input.path) };
|
package/src/procedures/module.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { PROCEDURE_REGISTRY, ProcedureRegistry, RegistryError } from "./registry.js";
|
|
22
22
|
import { coreProcedures } from "./core/index.js";
|
|
23
23
|
import { metaProcedures as definitionProcedures } from "./define-procedure.js";
|
|
24
|
-
import type
|
|
24
|
+
import { pathToKey, type AnyProcedure, type ProcedureModule, type RegistrationOptions } from "./types.js";
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* The procedures of `@procedures/client`: the control flow (`client.chain`, `client.map` and the
|
|
@@ -121,7 +121,7 @@ export function registerModules(
|
|
|
121
121
|
if (existing && !options?.override) {
|
|
122
122
|
if (existing.handler === procedure.handler) continue;
|
|
123
123
|
throw new RegistryError(
|
|
124
|
-
`Two modules give the procedure ${path
|
|
124
|
+
`Two modules give the procedure ${pathToKey(path)}: the second one is ${module.name ?? "a module without a name"}`,
|
|
125
125
|
path
|
|
126
126
|
);
|
|
127
127
|
}
|
package/src/procedures/ref.ts
CHANGED
|
@@ -234,7 +234,7 @@ export function lookupOutputRef(refPath: string, scope: RefScope | undefined): {
|
|
|
234
234
|
/**
|
|
235
235
|
* Resolve an output reference within a scope.
|
|
236
236
|
*
|
|
237
|
-
* @param refPath - The reference path (
|
|
237
|
+
* @param refPath - The reference path (for example "stageName.value" or "$last.value")
|
|
238
238
|
* @param scope - The current scope to resolve within
|
|
239
239
|
* @returns The resolved value, or undefined if not found
|
|
240
240
|
*/
|
|
@@ -434,12 +434,12 @@ export function getRefName(ref: AnyProcedureRef): string | undefined {
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/**
|
|
437
|
-
*
|
|
437
|
+
* This function tells if a procedure reference runs at this time in the given context.
|
|
438
438
|
*
|
|
439
439
|
* @param ref - The procedure reference to check
|
|
440
440
|
* @param contextStack - Stack of named contexts (innermost first)
|
|
441
441
|
* @param isParentContext - Whether we're checking from a parent procedure
|
|
442
|
-
* @returns true if the ref
|
|
442
|
+
* @returns true if the ref runs at this time
|
|
443
443
|
*/
|
|
444
444
|
export function shouldExecuteRef(
|
|
445
445
|
ref: AnyProcedureRef,
|
|
@@ -503,7 +503,7 @@ export class ProcedureRefBuilder<TInput = unknown, TOutput = unknown> {
|
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
/**
|
|
506
|
-
*
|
|
506
|
+
* This method sets when this reference runs.
|
|
507
507
|
* @param when - "$immediate", "$never", "$parent", or a named context
|
|
508
508
|
*/
|
|
509
509
|
when(when: ProcedureWhen): this {
|
package/src/procedures/types.ts
CHANGED
|
@@ -293,7 +293,7 @@ export interface RepositoryProvider {
|
|
|
293
293
|
* Contains request metadata and service access.
|
|
294
294
|
*/
|
|
295
295
|
export interface ProcedureContext {
|
|
296
|
-
/**
|
|
296
|
+
/** The request metadata, for example the authentication and the trace. */
|
|
297
297
|
metadata: Record<string, unknown>;
|
|
298
298
|
|
|
299
299
|
/** Abort signal for cancellation */
|
|
@@ -593,7 +593,7 @@ export interface Procedure<
|
|
|
593
593
|
|
|
594
594
|
/**
|
|
595
595
|
* Whether this procedure supports streaming (multi-yield).
|
|
596
|
-
* When true, the handler is
|
|
596
|
+
* When true, the handler is a generator that can yield more than one time.
|
|
597
597
|
* When false or undefined, the procedure yields exactly once.
|
|
598
598
|
*
|
|
599
599
|
* This is a capability declaration - callers can still consume
|