@process.co/element-types 0.0.25 → 0.0.27
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/README.md +6 -1
- package/dist/authoring-contract-types.d.ts +5 -0
- package/dist/authoring-contract-types.d.ts.map +1 -1
- package/dist/container-runtime-routing.d.ts +36 -0
- package/dist/container-runtime-routing.d.ts.map +1 -0
- package/dist/container-runtime-routing.js +15 -0
- package/dist/define-signal-ingress.test-d.d.ts +2 -0
- package/dist/define-signal-ingress.test-d.d.ts.map +1 -0
- package/dist/define-signal-ingress.test-d.js +52 -0
- package/dist/execution-tags.d.ts +65 -0
- package/dist/execution-tags.d.ts.map +1 -0
- package/dist/execution-tags.js +33 -0
- package/dist/index.d.ts +72 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/ingress-filters.d.ts +75 -10
- package/dist/ingress-filters.d.ts.map +1 -1
- package/dist/ingress-filters.js +10 -5
- package/dist/slot-definition.d.ts +10 -0
- package/dist/slot-definition.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/authoring-contract-types.ts +5 -0
- package/src/container-runtime-routing.ts +47 -0
- package/src/define-signal-ingress.test-d.ts +51 -0
- package/src/execution-tags.ts +79 -0
- package/src/index.ts +100 -3
- package/src/ingress-filters.ts +83 -9
- package/src/slot-definition.ts +10 -0
package/dist/index.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zodObjectToContainerExportJsonSchema = exports.ZOD_CONTAINER_EXPORT_TO_JSON_SCHEMA_PARAMS = exports.DEFAULT_DEFER_HTTP_RESPONSE_MS = exports.PROCESS_CO_ENFORCE_SCHEMA_HOST_PAYLOAD_MARKER = exports.INGRESS_FILTER_TYPES = exports.INGRESS_FILTERS_KEY = exports.REPLAY_META_RANGE = exports.REPLAY_BINDING_RANGE = exports.HTTP_REQUEST_CACHE_POLICY_KEY = exports.isPlatformBoundLoaderType = exports.PLATFORM_BOUND_LOADER_TYPE_PREFIXES = exports.ELEMENT_AUTHORING_CONTRACT_VERSION = exports.builtinActionSlotsRegistry = void 0;
|
|
3
|
+
exports.zodObjectToContainerExportJsonSchema = exports.ZOD_CONTAINER_EXPORT_TO_JSON_SCHEMA_PARAMS = exports.DEFAULT_DEFER_HTTP_RESPONSE_MS = exports.PROCESS_CO_ENFORCE_SCHEMA_HOST_PAYLOAD_MARKER = exports.INGRESS_FILTER_TYPES = exports.INGRESS_FILTERS_KEY = exports.REPLAY_META_RANGE = exports.REPLAY_BINDING_RANGE = exports.HTTP_REQUEST_CACHE_POLICY_KEY = exports.isPlatformBoundLoaderType = exports.PLATFORM_BOUND_LOADER_TYPE_PREFIXES = exports.isKnownExecutionTagKey = exports.SOCKET_STATE_TAG = exports.ELEMENT_AUTHORING_CONTRACT_VERSION = exports.builtinActionSlotsRegistry = exports.containerRuntimeRangeKey = exports.CONTAINER_RUNTIME_ROUTING_SLUG = void 0;
|
|
4
4
|
exports.resolveSignalHookIsDraft = resolveSignalHookIsDraft;
|
|
5
5
|
exports.setSignalEmitValidationHost = setSignalEmitValidationHost;
|
|
6
6
|
exports.validateEmitPayload = validateEmitPayload;
|
|
7
7
|
exports.defineApp = defineApp;
|
|
8
8
|
exports.defineAction = defineAction;
|
|
9
9
|
exports.defineSignal = defineSignal;
|
|
10
|
+
var container_runtime_routing_1 = require("./container-runtime-routing");
|
|
11
|
+
Object.defineProperty(exports, "CONTAINER_RUNTIME_ROUTING_SLUG", { enumerable: true, get: function () { return container_runtime_routing_1.CONTAINER_RUNTIME_ROUTING_SLUG; } });
|
|
12
|
+
Object.defineProperty(exports, "containerRuntimeRangeKey", { enumerable: true, get: function () { return container_runtime_routing_1.containerRuntimeRangeKey; } });
|
|
10
13
|
var builtin_action_slots_registry_1 = require("./builtin-action-slots-registry");
|
|
11
14
|
Object.defineProperty(exports, "builtinActionSlotsRegistry", { enumerable: true, get: function () { return builtin_action_slots_registry_1.builtinActionSlotsRegistry; } });
|
|
12
15
|
/** Locked authoring catalog **types** + version (runtime materialize: **`@process.co/compatibility`** **`authoring-spec`**). */
|
|
13
16
|
var authoring_contract_types_1 = require("./authoring-contract-types");
|
|
14
17
|
Object.defineProperty(exports, "ELEMENT_AUTHORING_CONTRACT_VERSION", { enumerable: true, get: function () { return authoring_contract_types_1.ELEMENT_AUTHORING_CONTRACT_VERSION; } });
|
|
18
|
+
var execution_tags_1 = require("./execution-tags");
|
|
19
|
+
Object.defineProperty(exports, "SOCKET_STATE_TAG", { enumerable: true, get: function () { return execution_tags_1.SOCKET_STATE_TAG; } });
|
|
20
|
+
Object.defineProperty(exports, "isKnownExecutionTagKey", { enumerable: true, get: function () { return execution_tags_1.isKnownExecutionTagKey; } });
|
|
15
21
|
var platform_loader_type_1 = require("./platform-loader-type");
|
|
16
22
|
Object.defineProperty(exports, "PLATFORM_BOUND_LOADER_TYPE_PREFIXES", { enumerable: true, get: function () { return platform_loader_type_1.PLATFORM_BOUND_LOADER_TYPE_PREFIXES; } });
|
|
17
23
|
Object.defineProperty(exports, "isPlatformBoundLoaderType", { enumerable: true, get: function () { return platform_loader_type_1.isPlatformBoundLoaderType; } });
|
|
@@ -138,4 +144,4 @@ function defineSignal(signal) {
|
|
|
138
144
|
var zod_container_export_json_schema_1 = require("./zod-container-export-json-schema");
|
|
139
145
|
Object.defineProperty(exports, "ZOD_CONTAINER_EXPORT_TO_JSON_SCHEMA_PARAMS", { enumerable: true, get: function () { return zod_container_export_json_schema_1.ZOD_CONTAINER_EXPORT_TO_JSON_SCHEMA_PARAMS; } });
|
|
140
146
|
Object.defineProperty(exports, "zodObjectToContainerExportJsonSchema", { enumerable: true, get: function () { return zod_container_export_json_schema_1.zodObjectToContainerExportJsonSchema; } });
|
|
141
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
147
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5k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
|
|
5
|
+
* `defineSignal({ ingress: { filters } })`, and may call
|
|
6
|
+
* `params.$.http.configureIngressFilters(...)` from `hooks.save` to replace
|
|
7
|
+
* that default chain. The final chain runs at the edge **instead of**
|
|
6
8
|
* proxying the request back to Node. The chain is validated at publish time
|
|
7
9
|
* and persisted onto the element's stash row at {@link INGRESS_FILTERS_KEY}.
|
|
8
10
|
*
|
|
@@ -10,8 +12,8 @@
|
|
|
10
12
|
* each filter in order. When the chain is absent the edge falls back to
|
|
11
13
|
* `ext_proc` (proxy back to the Node API).
|
|
12
14
|
*
|
|
13
|
-
* Style mirrors {@link ./http-request-cache.ts}:
|
|
14
|
-
*
|
|
15
|
+
* Style mirrors {@link ./http-request-cache.ts}: public authoring shape first,
|
|
16
|
+
* reserved `$` materialized row field at save/publish time.
|
|
15
17
|
*/
|
|
16
18
|
/** Where to read auth material from on the inbound HTTP request. */
|
|
17
19
|
export type IngressAuthExtract = {
|
|
@@ -41,17 +43,80 @@ export type IngressVerifyAuthFilter = {
|
|
|
41
43
|
/**
|
|
42
44
|
* Native Go implementation of `http::signal:new-requests`.
|
|
43
45
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* This is a built-in filter for a specific element shape. The chain entry
|
|
47
|
+
* should usually be `{ type: 'http_new_requests' }`; the Go runtime reads
|
|
48
|
+
* authored fields such as `responseType`, `resBodyJSON`, `eventData`, and
|
|
49
|
+
* `resIncludeProcessTicket` from the published element row.
|
|
47
50
|
*/
|
|
48
51
|
export type IngressHttpNewRequestsFilter = {
|
|
49
52
|
type: 'http_new_requests';
|
|
50
|
-
config
|
|
53
|
+
config?: {
|
|
51
54
|
resStatusCode?: number;
|
|
52
55
|
resBody?: string;
|
|
53
56
|
resContentType?: string;
|
|
54
57
|
emitBodyOnly?: boolean;
|
|
58
|
+
eventData?: 'full' | 'body';
|
|
59
|
+
responseType?: 'OK' | 'NO_CONTENT' | 'STATIC' | 'CUSTOM' | string;
|
|
60
|
+
responseTimeout?: number;
|
|
61
|
+
includeProcessTicket?: boolean;
|
|
62
|
+
summary?: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/** Validate the selected inbound payload against JSON Schema before emit. */
|
|
66
|
+
export type IngressValidateJSONSchemaFilter = {
|
|
67
|
+
type: 'validate_json_schema';
|
|
68
|
+
config: {
|
|
69
|
+
schema: Record<string, unknown>;
|
|
70
|
+
eventData?: 'full' | 'body';
|
|
71
|
+
responseType?: 'OK' | 'NO_CONTENT' | 'STATIC' | 'CUSTOM' | string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Validate the inbound payload against a Zod schema hosted on Node.
|
|
76
|
+
*
|
|
77
|
+
* The Go edge cannot evaluate Zod schemas natively (they are TypeScript
|
|
78
|
+
* runtime objects, not data), so this filter delegates to a Node
|
|
79
|
+
* "validate" microservice at `_internal/zod-validate/:schemaBuildId`.
|
|
80
|
+
* The schema is registered against `schemaBuildId` at element publish
|
|
81
|
+
* time; the edge calls it as a sidecar and reads back a structured
|
|
82
|
+
* result. Aligns with the envoy-style filter chain so we keep full Zod
|
|
83
|
+
* validation on the edge without porting the engine to Go.
|
|
84
|
+
*
|
|
85
|
+
* `failOpen=true` lets the chain continue when the validate endpoint is
|
|
86
|
+
* unreachable. Default is `false` (reject with 502 on outage).
|
|
87
|
+
*/
|
|
88
|
+
export type IngressValidateZodFilter = {
|
|
89
|
+
type: 'validate_zod';
|
|
90
|
+
config: {
|
|
91
|
+
/** Stable identity for the registered Zod schema. Required. */
|
|
92
|
+
schemaBuildId: string;
|
|
93
|
+
/** Optional S3 key for the edge-compatible validator artifact. */
|
|
94
|
+
artifactKey?: string;
|
|
95
|
+
/** Legacy/current S3 key for the compiled validator module. */
|
|
96
|
+
compiledValidatorKey?: string;
|
|
97
|
+
/** Optional friendly name used in error messages. */
|
|
98
|
+
schemaName?: string;
|
|
99
|
+
eventData?: 'full' | 'body';
|
|
100
|
+
responseType?: 'OK' | 'NO_CONTENT' | 'STATIC' | 'CUSTOM' | string;
|
|
101
|
+
/** Continue the chain when the validate endpoint cannot be reached. */
|
|
102
|
+
failOpen?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Compile-time hint for how the edge should run this validator:
|
|
105
|
+
* `inline` (embedded QuickJS/Zod) or `sidecar` (trusted-tier endpoint).
|
|
106
|
+
* Absent ⇒ edge uses its deployment default (inline, sidecar fallback).
|
|
107
|
+
*/
|
|
108
|
+
validatorBackend?: 'inline' | 'sidecar';
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Generic chain equivalent of a source calling `$emit`. Compound filters such
|
|
113
|
+
* as `http_new_requests` may emit directly instead of composing this filter.
|
|
114
|
+
*/
|
|
115
|
+
export type IngressEmitFilter = {
|
|
116
|
+
type: '$emit';
|
|
117
|
+
config: {
|
|
118
|
+
eventData?: 'full' | 'body';
|
|
119
|
+
emitBodyOnly?: boolean;
|
|
55
120
|
summary?: string;
|
|
56
121
|
};
|
|
57
122
|
};
|
|
@@ -106,8 +171,8 @@ export type IngressJSONPathMetaFilter = {
|
|
|
106
171
|
* must be added here AND registered on the Go edge — `validate-ingress-filters`
|
|
107
172
|
* rejects unknown types at publish time.
|
|
108
173
|
*/
|
|
109
|
-
export type IngressFilterDescriptor = IngressVerifyAuthFilter | IngressHttpNewRequestsFilter | IngressRespondThenEmitFilter | IngressHMACVerifyFilter | IngressChallengeResponseFilter | IngressJSONPathMetaFilter;
|
|
110
|
-
/** Save-only: hooks.save → `$.http.configureIngressFilters`. */
|
|
174
|
+
export type IngressFilterDescriptor = IngressVerifyAuthFilter | IngressValidateJSONSchemaFilter | IngressValidateZodFilter | IngressEmitFilter | IngressHttpNewRequestsFilter | IngressRespondThenEmitFilter | IngressHMACVerifyFilter | IngressChallengeResponseFilter | IngressJSONPathMetaFilter;
|
|
175
|
+
/** Save-only override: hooks.save → `$.http.configureIngressFilters`. */
|
|
111
176
|
export type ConfigureIngressFiltersOptions = {
|
|
112
177
|
filters: IngressFilterDescriptor[];
|
|
113
178
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingress-filters.d.ts","sourceRoot":"","sources":["../src/ingress-filters.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ingress-filters.d.ts","sourceRoot":"","sources":["../src/ingress-filters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE;QACJ,IAAI,EAAE,qBAAqB,CAAC;QAC5B,mEAAmE;QACnE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,kBAAkB,CAAC;QAC5B,0EAA0E;QAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACL,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACvC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,CAAC,EAAE;QACL,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAC5B,YAAY,CAAC,EAAE,IAAI,GAAG,YAAY,GAA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8B,GAC9B,yBAAyB,CAAC;AAEhC,yEAAyE;AACzE,MAAM,MAAM,8BAA8B,GAAG;IACzC,OAAO,EAAE,uBAAuB,EAAE,CAAC;CACtC,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,oBAAoB,GAAG;IAC/B,OAAO,EAAE,uBAAuB,EAAE,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAG,iBAA0B,CAAC;AAE9D,gFAAgF;AAChF,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAUtE,CAAC"}
|
package/dist/ingress-filters.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Webhook ingress filter chain — author-facing types.
|
|
4
4
|
*
|
|
5
|
-
* Authors
|
|
6
|
-
*
|
|
5
|
+
* Authors declare a static Go-native filter chain with
|
|
6
|
+
* `defineSignal({ ingress: { filters } })`, and may call
|
|
7
|
+
* `params.$.http.configureIngressFilters(...)` from `hooks.save` to replace
|
|
8
|
+
* that default chain. The final chain runs at the edge **instead of**
|
|
7
9
|
* proxying the request back to Node. The chain is validated at publish time
|
|
8
10
|
* and persisted onto the element's stash row at {@link INGRESS_FILTERS_KEY}.
|
|
9
11
|
*
|
|
@@ -11,8 +13,8 @@
|
|
|
11
13
|
* each filter in order. When the chain is absent the edge falls back to
|
|
12
14
|
* `ext_proc` (proxy back to the Node API).
|
|
13
15
|
*
|
|
14
|
-
* Style mirrors {@link ./http-request-cache.ts}:
|
|
15
|
-
*
|
|
16
|
+
* Style mirrors {@link ./http-request-cache.ts}: public authoring shape first,
|
|
17
|
+
* reserved `$` materialized row field at save/publish time.
|
|
16
18
|
*/
|
|
17
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
20
|
exports.INGRESS_FILTER_TYPES = exports.INGRESS_FILTERS_KEY = void 0;
|
|
@@ -20,10 +22,13 @@ exports.INGRESS_FILTERS_KEY = '$ingressFilters';
|
|
|
20
22
|
/** Names accepted at publish time. Keep in sync with the Go filter registry. */
|
|
21
23
|
exports.INGRESS_FILTER_TYPES = [
|
|
22
24
|
'verify_auth',
|
|
25
|
+
'validate_json_schema',
|
|
26
|
+
'validate_zod',
|
|
27
|
+
'$emit',
|
|
23
28
|
'http_new_requests',
|
|
24
29
|
'respond_then_emit',
|
|
25
30
|
'hmac_verify',
|
|
26
31
|
'challenge_response',
|
|
27
32
|
'jsonpath_meta',
|
|
28
33
|
];
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5ncmVzcy1maWx0ZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2luZ3Jlc3MtZmlsdGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7R0FnQkc7OztBQThMVSxRQUFBLG1CQUFtQixHQUFHLGlCQUEwQixDQUFDO0FBRTlELGdGQUFnRjtBQUNuRSxRQUFBLG9CQUFvQixHQUFtRDtJQUNoRixhQUFhO0lBQ2Isc0JBQXNCO0lBQ3RCLGNBQWM7SUFDZCxPQUFPO0lBQ1AsbUJBQW1CO0lBQ25CLG1CQUFtQjtJQUNuQixhQUFhO0lBQ2Isb0JBQW9CO0lBQ3BCLGVBQWU7Q0FDVCxDQUFDIn0=
|
|
@@ -12,6 +12,16 @@ export type ISlotInstanceDefinition = {
|
|
|
12
12
|
hideOnDisable?: boolean;
|
|
13
13
|
actionsPath?: string;
|
|
14
14
|
exportsPath?: string;
|
|
15
|
+
/** Milliseconds until the container scope times out (element data path). */
|
|
16
|
+
timeoutMsPath?: string;
|
|
17
|
+
/** FERN of the handler to run on timeout (element data path). */
|
|
18
|
+
timeoutHandlerFernPath?: string;
|
|
19
|
+
/** Dispatch mode: `execute` | `signal` (element data path). */
|
|
20
|
+
timeoutHandlerModePath?: string;
|
|
21
|
+
/** Payload path resolved at fire time (element data path). */
|
|
22
|
+
timeoutHandlerDataPath?: string;
|
|
23
|
+
/** Recovery policy: `resurrect` | `drop` (element data path). */
|
|
24
|
+
timeoutRecoveryPolicyPath?: string;
|
|
15
25
|
};
|
|
16
26
|
export type ISlotStaticInstanceDefinition = ISlotInstanceDefinition & {
|
|
17
27
|
type: 'static';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot-definition.d.ts","sourceRoot":"","sources":["../src/slot-definition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"slot-definition.d.ts","sourceRoot":"","sources":["../src/slot-definition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iEAAiE;IACjE,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,+DAA+D;IAC/D,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,8DAA8D;IAC9D,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iEAAiE;IACjE,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,uBAAuB,GAAG;IACpE,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,CAAC,uBAAuB,GAAG,6BAA6B,CAAC,EAAE,CAAC;CACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -49,6 +49,11 @@ export interface SlotBranchAuthoringContract {
|
|
|
49
49
|
enabled?: string;
|
|
50
50
|
actions?: string;
|
|
51
51
|
exports?: string;
|
|
52
|
+
timeoutMs?: string;
|
|
53
|
+
timeoutHandlerFern?: string;
|
|
54
|
+
timeoutHandlerMode?: string;
|
|
55
|
+
timeoutHandlerData?: string;
|
|
56
|
+
timeoutRecoveryPolicy?: string;
|
|
52
57
|
}>;
|
|
53
58
|
/**
|
|
54
59
|
* Where nested steps attach on each branch row, relative to that row’s object.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolved container timeout metadata persisted on workflow context rows
|
|
3
|
+
* (`routingInfo` on ContextDataService saves).
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type WorkflowTimeoutHandlerMode = 'execute' | 'signal';
|
|
7
|
+
|
|
8
|
+
export type WorkflowTimeoutRecoveryPolicy = 'resurrect' | 'drop';
|
|
9
|
+
|
|
10
|
+
export type WorkflowContainerRoutingRef = {
|
|
11
|
+
fern: string;
|
|
12
|
+
slotId: string;
|
|
13
|
+
groupId?: string;
|
|
14
|
+
elementId?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type WorkflowContainerTimeoutRouting = {
|
|
18
|
+
durationMs: number;
|
|
19
|
+
startedAtMs: number;
|
|
20
|
+
expiresAtMs: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type WorkflowContainerTimeoutHandlerRouting = {
|
|
24
|
+
fern: string;
|
|
25
|
+
mode: WorkflowTimeoutHandlerMode;
|
|
26
|
+
dataPath?: string;
|
|
27
|
+
dataSnapshot?: unknown;
|
|
28
|
+
recoveryPolicy: WorkflowTimeoutRecoveryPolicy;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type WorkflowContainerRuntimeRoutingInfo = {
|
|
32
|
+
container: WorkflowContainerRoutingRef;
|
|
33
|
+
timeout: WorkflowContainerTimeoutRouting;
|
|
34
|
+
timeoutHandler: WorkflowContainerTimeoutHandlerRouting;
|
|
35
|
+
/** Set when a timeout actor claims this row (ms epoch). */
|
|
36
|
+
timeoutClaimedAt?: number;
|
|
37
|
+
/** Terminal when timeout handling completed. */
|
|
38
|
+
timeoutTerminal?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const CONTAINER_RUNTIME_ROUTING_SLUG = '$container-runtime';
|
|
42
|
+
|
|
43
|
+
export function containerRuntimeRangeKey(containerFern: string, slotId: string): string {
|
|
44
|
+
const fern = containerFern.trim();
|
|
45
|
+
const slot = slotId.trim();
|
|
46
|
+
return `$container-runtime#${fern}#${slot}`;
|
|
47
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-only checks for static `defineSignal().ingress` declarations.
|
|
3
|
+
*/
|
|
4
|
+
import { defineSignal } from './index';
|
|
5
|
+
|
|
6
|
+
const _staticIngressSignal = defineSignal({
|
|
7
|
+
type: 'signal',
|
|
8
|
+
app: 'http',
|
|
9
|
+
key: 'new-requests',
|
|
10
|
+
name: 'New Requests',
|
|
11
|
+
ingress: {
|
|
12
|
+
filters: [
|
|
13
|
+
{
|
|
14
|
+
type: 'verify_auth',
|
|
15
|
+
config: {
|
|
16
|
+
kind: 'simple',
|
|
17
|
+
extract: { from: 'header', name: 'Authorization', scheme: 'Bearer' },
|
|
18
|
+
simpleToken: 'token',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{ type: 'http_new_requests' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
async run() {
|
|
26
|
+
return this.ingress!.filters;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
hooks: {
|
|
30
|
+
async save({ $ }) {
|
|
31
|
+
await $.http.configureIngressFilters({
|
|
32
|
+
filters: this.ingress!.filters,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
defineSignal({
|
|
39
|
+
type: 'signal',
|
|
40
|
+
ingress: {
|
|
41
|
+
filters: [
|
|
42
|
+
// @ts-expect-error unknown ingress filter types are rejected
|
|
43
|
+
{ type: 'not_a_real_filter' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
async run() {
|
|
48
|
+
return null;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution tags: a first-class, element-emittable annotation channel on a
|
|
3
|
+
* single workflow execution. An element calls `$.tag(key, value)` during `run`
|
|
4
|
+
* to attach a labelled status to its execution; the runtime carries the tags to
|
|
5
|
+
* the edge (batched on the run result as `$tags`, and/or live via the
|
|
6
|
+
* `execution.tag` host-proxy op) and the UI renders them as badges in the
|
|
7
|
+
* execution history.
|
|
8
|
+
*
|
|
9
|
+
* Tags are **orthogonal to the run lifecycle status** (`pending|running|
|
|
10
|
+
* complete|error`): an execution can be `complete` yet tagged
|
|
11
|
+
* `socket.state=disconnected`. They are annotations, not lifecycle transitions.
|
|
12
|
+
*
|
|
13
|
+
* This module is the single cross-runtime source of truth for the **known**
|
|
14
|
+
* (system) tag vocabulary. The Go edge mirrors these exact string literals, the
|
|
15
|
+
* element-host emits them, and the web UI keys dedicated badge styling off them.
|
|
16
|
+
* Author/free tags use any other key with a string value and render generically.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Reserved key for the deferred-HTTP held-socket lifecycle state. The edge owns
|
|
21
|
+
* this tag (it is derived from the terminal `http.*` / disconnect / timeout
|
|
22
|
+
* signals the edge already emits), so authors never set it directly — it is part
|
|
23
|
+
* of the known vocabulary so the UI can render it as a first-class badge.
|
|
24
|
+
*/
|
|
25
|
+
export const SOCKET_STATE_TAG = 'socket.state';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Lifecycle of a deferred HTTP held socket:
|
|
29
|
+
* - `open` — held, no terminal op yet.
|
|
30
|
+
* - `completed` — a terminal op (respond/redirect/end) closed the exchange.
|
|
31
|
+
* - `disconnected` — the client socket dropped before a terminal op.
|
|
32
|
+
* - `timeout` — the deferred deadline elapsed with no terminal op.
|
|
33
|
+
* - `aborted` — the exchange was abandoned (server-side teardown).
|
|
34
|
+
*/
|
|
35
|
+
export type SocketStateTagValue =
|
|
36
|
+
| 'open'
|
|
37
|
+
| 'completed'
|
|
38
|
+
| 'disconnected'
|
|
39
|
+
| 'timeout'
|
|
40
|
+
| 'aborted';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Closed registry of known/system execution tags: reserved key → allowed value
|
|
44
|
+
* union. Extend this type (and the mirrors in the edge + web registries) when a
|
|
45
|
+
* new system tag graduates from a free author tag to a first-class badge.
|
|
46
|
+
*/
|
|
47
|
+
export type KnownExecutionTags = {
|
|
48
|
+
[SOCKET_STATE_TAG]: SocketStateTagValue;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** Reserved key of a known/system execution tag. */
|
|
52
|
+
export type KnownExecutionTagKey = keyof KnownExecutionTags;
|
|
53
|
+
|
|
54
|
+
/** A single tag value on the wire. Known keys narrow this via {@link ExecutionTagFn}. */
|
|
55
|
+
export type ExecutionTagValue = string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Aggregated execution tags carried on a run result as `$tags`. Last write per
|
|
59
|
+
* key wins. Stored as a plain string map for transport stability; per-key value
|
|
60
|
+
* typing is enforced at the {@link ExecutionTagFn} call site, not here.
|
|
61
|
+
*/
|
|
62
|
+
export type ExecutionTags = Record<string, ExecutionTagValue>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* `$.tag(key, value)` — attach a tag to the current execution for UI display.
|
|
66
|
+
*
|
|
67
|
+
* Known keys (e.g. {@link SOCKET_STATE_TAG}) get literal-union value typing for
|
|
68
|
+
* autocomplete + safety; any other key accepts a free string for element-defined
|
|
69
|
+
* annotations (e.g. `$.tag('rate.limited', 'true')`).
|
|
70
|
+
*/
|
|
71
|
+
export interface ExecutionTagFn {
|
|
72
|
+
<K extends KnownExecutionTagKey>(key: K, value: KnownExecutionTags[K]): void;
|
|
73
|
+
(key: string, value: string): void;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** True when `key` is a reserved system tag key. */
|
|
77
|
+
export function isKnownExecutionTagKey(key: string): key is KnownExecutionTagKey {
|
|
78
|
+
return key === SOCKET_STATE_TAG;
|
|
79
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -22,10 +22,24 @@ import type {
|
|
|
22
22
|
ISlotDefinition,
|
|
23
23
|
} from './slot-definition';
|
|
24
24
|
import { ConfigureResponseCachingOptions } from './http-request-cache';
|
|
25
|
-
import type { ConfigureIngressFiltersOptions } from './ingress-filters';
|
|
25
|
+
import type { ConfigureIngressFiltersOptions, IngressFiltersPolicy } from './ingress-filters';
|
|
26
|
+
import type { ExecutionTagFn } from './execution-tags';
|
|
26
27
|
|
|
27
28
|
export type { ISlotInstanceDefinition, ISlotStaticInstanceDefinition, ISlotDefinition };
|
|
28
29
|
|
|
30
|
+
export {
|
|
31
|
+
CONTAINER_RUNTIME_ROUTING_SLUG,
|
|
32
|
+
containerRuntimeRangeKey,
|
|
33
|
+
} from './container-runtime-routing';
|
|
34
|
+
export type {
|
|
35
|
+
WorkflowContainerRoutingRef,
|
|
36
|
+
WorkflowContainerRuntimeRoutingInfo,
|
|
37
|
+
WorkflowContainerTimeoutHandlerRouting,
|
|
38
|
+
WorkflowContainerTimeoutRouting,
|
|
39
|
+
WorkflowTimeoutHandlerMode,
|
|
40
|
+
WorkflowTimeoutRecoveryPolicy,
|
|
41
|
+
} from './container-runtime-routing';
|
|
42
|
+
|
|
29
43
|
export {
|
|
30
44
|
builtinActionSlotsRegistry,
|
|
31
45
|
type BuiltinActionSlotsRegistry,
|
|
@@ -43,6 +57,19 @@ export type {
|
|
|
43
57
|
|
|
44
58
|
/** Locked authoring catalog **types** + version (runtime materialize: **`@process.co/compatibility`** **`authoring-spec`**). */
|
|
45
59
|
export { ELEMENT_AUTHORING_CONTRACT_VERSION } from './authoring-contract-types';
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
SOCKET_STATE_TAG,
|
|
63
|
+
isKnownExecutionTagKey,
|
|
64
|
+
} from './execution-tags';
|
|
65
|
+
export type {
|
|
66
|
+
ExecutionTagFn,
|
|
67
|
+
ExecutionTagValue,
|
|
68
|
+
ExecutionTags,
|
|
69
|
+
KnownExecutionTagKey,
|
|
70
|
+
KnownExecutionTags,
|
|
71
|
+
SocketStateTagValue,
|
|
72
|
+
} from './execution-tags';
|
|
46
73
|
export type {
|
|
47
74
|
AuthoringPropWireKind,
|
|
48
75
|
AuthoringPropContract,
|
|
@@ -81,12 +108,15 @@ export {
|
|
|
81
108
|
type ConfigureIngressFiltersOptions,
|
|
82
109
|
type IngressAuthExtract,
|
|
83
110
|
type IngressChallengeResponseFilter,
|
|
111
|
+
type IngressEmitFilter,
|
|
84
112
|
type IngressFilterDescriptor,
|
|
85
113
|
type IngressFiltersPolicy,
|
|
86
114
|
type IngressHMACVerifyFilter,
|
|
87
115
|
type IngressHttpNewRequestsFilter,
|
|
88
116
|
type IngressJSONPathMetaFilter,
|
|
89
117
|
type IngressRespondThenEmitFilter,
|
|
118
|
+
type IngressValidateJSONSchemaFilter,
|
|
119
|
+
type IngressValidateZodFilter,
|
|
90
120
|
type IngressVerifyAuthFilter,
|
|
91
121
|
type IngressVerifyAuthKind,
|
|
92
122
|
} from './ingress-filters';
|
|
@@ -153,14 +183,37 @@ export type HttpInterfaceSchemaWire = {
|
|
|
153
183
|
/**
|
|
154
184
|
* When true, `enforceSchema` runs the **compiled** default-export Zod schema for this interface
|
|
155
185
|
* (full parse/transform/refine), not a lightweight check of `exportSchema` alone.
|
|
186
|
+
*
|
|
187
|
+
* Legacy switch. Prefer {@link HttpInterfaceSchemaWire.validationLevel}; this boolean is kept
|
|
188
|
+
* for back-compat and is treated as `validation === true ⇔ validationLevel === 'full'`.
|
|
156
189
|
*/
|
|
157
190
|
validation?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Tiered inbound validation policy authored per signal:
|
|
193
|
+
*
|
|
194
|
+
* - `'typing'` — design-time only (editor type inference); **no runtime validation** (UI label: `SKIP`).
|
|
195
|
+
* - `'basic'` — structural JSON Schema validation derived from the Zod schema, no coercion (UI label: `VALIDATE`).
|
|
196
|
+
* - `'full'` — full compiled Zod `safeParse` (transforms/refine/coerce) (UI label: `FULL VALIDATE`).
|
|
197
|
+
*
|
|
198
|
+
* Back-compat: when absent, derive from {@link HttpInterfaceSchemaWire.validation}
|
|
199
|
+
* (`true → 'full'`, otherwise `'typing'`).
|
|
200
|
+
*/
|
|
201
|
+
validationLevel?: 'typing' | 'basic' | 'full';
|
|
158
202
|
exportSchema?: Record<string, JSONValue>;
|
|
159
203
|
exportSchemaZodex?: Record<string, JSONValue>;
|
|
160
204
|
exportSchemaSource?: string;
|
|
161
205
|
exportSchemaKey?: string | null;
|
|
162
206
|
/** S3 object key (element-registry bucket) for compiled ESM whose default export is the Zod schema used at runtime. */
|
|
163
207
|
compiledValidatorKey?: string | null;
|
|
208
|
+
/** S3 object key (element-registry bucket) for the Go edge QuickJS validator unit. */
|
|
209
|
+
edgeValidatorKey?: string | null;
|
|
210
|
+
/**
|
|
211
|
+
* Compile-time decision for how the Go edge runs `full` Zod validation for this
|
|
212
|
+
* schema: `inline` (embedded QuickJS) or `sidecar` (trusted-tier endpoint).
|
|
213
|
+
* Derived by a cheap heuristic at compile time; the edge keeps a runtime
|
|
214
|
+
* sidecar fallback regardless. Absent ⇒ edge deployment default applies.
|
|
215
|
+
*/
|
|
216
|
+
validatorBackend?: 'inline' | 'sidecar' | null;
|
|
164
217
|
/**
|
|
165
218
|
* Client-issued token stored with the interface schema blob; included in validator artifact paths
|
|
166
219
|
* so successive saves and draft/live rows do not share one S3 prefix unless intended.
|
|
@@ -185,6 +238,14 @@ export type HttpInterfaceSchemaWire = {
|
|
|
185
238
|
export type SignalRunHostServices = {
|
|
186
239
|
export: (category: string, message: string) => void | Promise<void>;
|
|
187
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Attach a {@link ExecutionTagFn tag} to the current execution for UI
|
|
243
|
+
* display (execution-history badges). Known keys (e.g. `socket.state`) are
|
|
244
|
+
* value-typed; any other key accepts a free string for element-defined
|
|
245
|
+
* annotations. Tags are orthogonal to the run lifecycle status.
|
|
246
|
+
*/
|
|
247
|
+
tag: ExecutionTagFn;
|
|
248
|
+
|
|
188
249
|
$transitionToSlot: (slots: Array<SlotTransitionDefinition>) => void | Promise<void>;
|
|
189
250
|
|
|
190
251
|
/**
|
|
@@ -637,6 +698,10 @@ export interface ProcessRuntimeFernInfo {
|
|
|
637
698
|
namespaceModifier?: string;
|
|
638
699
|
/** Namespace tag (e.g. `main`); mutually exclusive with `serial`. */
|
|
639
700
|
tag?: string;
|
|
701
|
+
/** Namespace `@` selector; resolvable tags/versions or bracketed build ids. */
|
|
702
|
+
namespaceBuildSelector?: string;
|
|
703
|
+
/** Pre-resolved build run id from `namespace@[buildID]`. */
|
|
704
|
+
buildRunId?: string;
|
|
640
705
|
/** Numeric namespace serial; mutually exclusive with `tag`. */
|
|
641
706
|
serial?: bigint;
|
|
642
707
|
/** Element type kind: `action` | `signal` | `flow` | `credential` | … */
|
|
@@ -718,6 +783,14 @@ export interface ProcessFunctions {
|
|
|
718
783
|
|
|
719
784
|
export: (key: string, value: JSONValue) => void;
|
|
720
785
|
|
|
786
|
+
/**
|
|
787
|
+
* Attach a {@link ExecutionTagFn tag} to the current execution for UI
|
|
788
|
+
* display (execution-history badges). Known keys (e.g. `socket.state`) are
|
|
789
|
+
* value-typed; any other key accepts a free string for element-defined
|
|
790
|
+
* annotations. Tags are orthogonal to the run lifecycle status.
|
|
791
|
+
*/
|
|
792
|
+
tag: ExecutionTagFn;
|
|
793
|
+
|
|
721
794
|
send: SendFunctionsWrapper;
|
|
722
795
|
|
|
723
796
|
/**
|
|
@@ -1068,7 +1141,8 @@ type HttpInterfacePropKeys<T> =
|
|
|
1068
1141
|
: never;
|
|
1069
1142
|
|
|
1070
1143
|
/**
|
|
1071
|
-
* `this` inside signal hooks: instance props minus
|
|
1144
|
+
* `this` inside signal hooks: instance props/static metadata minus
|
|
1145
|
+
* `$.interface.http` and `$emit`.
|
|
1072
1146
|
* Use `params.$.http.configureResponseCaching` in `save`.
|
|
1073
1147
|
*/
|
|
1074
1148
|
export type DeriveSignalHookInstance<T> = Omit<
|
|
@@ -1280,6 +1354,15 @@ export type SignalHooksWithThis<T> = SignalHooksContextualDefinition &
|
|
|
1280
1354
|
|
|
1281
1355
|
/** Structural requirements for a signal module (used by tooling; prefer {@link defineSignal}). */
|
|
1282
1356
|
export type SignalDefinitionShape<T> = {
|
|
1357
|
+
/**
|
|
1358
|
+
* Static edge-ingress declaration authored on the element definition.
|
|
1359
|
+
*
|
|
1360
|
+
* During save/publish this public `ingress.filters` shape is materialized
|
|
1361
|
+
* onto the element row as `$ingressFilters`. A `hooks.save` body may call
|
|
1362
|
+
* `params.$.http.configureIngressFilters(...)` to replace the materialized
|
|
1363
|
+
* chain when the final filter list depends on authored props.
|
|
1364
|
+
*/
|
|
1365
|
+
ingress?: IngressFiltersPolicy;
|
|
1283
1366
|
methods: Record<string, unknown> & {
|
|
1284
1367
|
run: (this: DeriveSignalInstance<T>, params: SignalRunOptions) => Promise<unknown>;
|
|
1285
1368
|
};
|
|
@@ -1309,6 +1392,20 @@ export type SignalMethodsLegacyTopLevelRun = {
|
|
|
1309
1392
|
/** Minimum shape for {@link defineSignal}. Prefer {@link SignalMethodsRun}. */
|
|
1310
1393
|
export type SignalMethods = SignalMethodsRun | SignalMethodsLegacyTopLevelRun;
|
|
1311
1394
|
|
|
1395
|
+
/** Public static edge-ingress declaration accepted by {@link defineSignal}. */
|
|
1396
|
+
export type SignalIngressDeclaration = IngressFiltersPolicy;
|
|
1397
|
+
|
|
1398
|
+
/** Optional static metadata accepted on every signal definition. */
|
|
1399
|
+
export type SignalStaticMetadata = {
|
|
1400
|
+
/**
|
|
1401
|
+
* Static edge-ingress filter chain for this signal. The element definition
|
|
1402
|
+
* uses `ingress.filters`; save/publish materializes it to the reserved row
|
|
1403
|
+
* field `$ingressFilters`. Calling `configureIngressFilters` in `hooks.save`
|
|
1404
|
+
* replaces this default chain completely.
|
|
1405
|
+
*/
|
|
1406
|
+
ingress?: SignalIngressDeclaration;
|
|
1407
|
+
};
|
|
1408
|
+
|
|
1312
1409
|
/** Contextual `this` for top-level and `methods.*` signal functions. */
|
|
1313
1410
|
export type SignalMethodsWithThis<T> = T &
|
|
1314
1411
|
ThisType<DeriveSignalInstance<T>> &
|
|
@@ -1317,7 +1414,7 @@ export type SignalMethodsWithThis<T> = T &
|
|
|
1317
1414
|
: {});
|
|
1318
1415
|
|
|
1319
1416
|
export function defineSignal<
|
|
1320
|
-
const T extends SignalMethods & Record<string, unknown>,
|
|
1417
|
+
const T extends SignalMethods & SignalStaticMetadata & Record<string, unknown>,
|
|
1321
1418
|
>(signal: SignalMethodsWithThis<T> & { hooks?: SignalHooksWithThis<T> }): T {
|
|
1322
1419
|
return signal;
|
|
1323
1420
|
}
|