@ontemper/sdk 0.1.0-rc.1 → 0.2.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.
Files changed (96) hide show
  1. package/README.md +92 -22
  2. package/dist/AxiosError.d.ts +46 -0
  3. package/dist/AxiosError.d.ts.map +1 -0
  4. package/dist/AxiosError.js +118 -0
  5. package/dist/AxiosError.js.map +1 -0
  6. package/dist/Contract/Invocation.d.ts +21 -0
  7. package/dist/Contract/Invocation.d.ts.map +1 -0
  8. package/dist/Contract/Invocation.js +2 -0
  9. package/dist/Contract/Invocation.js.map +1 -0
  10. package/dist/Contract/Manifest.d.ts +125 -0
  11. package/dist/Contract/Manifest.d.ts.map +1 -0
  12. package/dist/Contract/Manifest.js +59 -0
  13. package/dist/Contract/Manifest.js.map +1 -0
  14. package/dist/Contract/RuntimeApi.d.ts +143 -0
  15. package/dist/Contract/RuntimeApi.d.ts.map +1 -0
  16. package/dist/Contract/RuntimeApi.js +148 -0
  17. package/dist/Contract/RuntimeApi.js.map +1 -0
  18. package/dist/Contract/index.d.ts +4 -0
  19. package/dist/Contract/index.d.ts.map +1 -0
  20. package/dist/Contract/index.js +3 -0
  21. package/dist/Contract/index.js.map +1 -0
  22. package/dist/Correlation.d.ts +33 -0
  23. package/dist/Correlation.d.ts.map +1 -0
  24. package/dist/Correlation.js +57 -0
  25. package/dist/Correlation.js.map +1 -0
  26. package/dist/HttpApiResource.d.ts +32 -0
  27. package/dist/HttpApiResource.d.ts.map +1 -0
  28. package/dist/HttpApiResource.js +35 -0
  29. package/dist/HttpApiResource.js.map +1 -0
  30. package/dist/HttpClient.d.ts +10 -0
  31. package/dist/HttpClient.d.ts.map +1 -0
  32. package/dist/HttpClient.js +167 -0
  33. package/dist/HttpClient.js.map +1 -0
  34. package/dist/HttpPayload.d.ts +9 -0
  35. package/dist/HttpPayload.d.ts.map +1 -0
  36. package/dist/HttpPayload.js +32 -0
  37. package/dist/HttpPayload.js.map +1 -0
  38. package/dist/Invocation.d.ts +1 -20
  39. package/dist/Invocation.d.ts.map +1 -1
  40. package/dist/Invocation.js.map +1 -1
  41. package/dist/LogContext.d.ts +59 -0
  42. package/dist/LogContext.d.ts.map +1 -0
  43. package/dist/LogContext.js +47 -0
  44. package/dist/LogContext.js.map +1 -0
  45. package/dist/Logger.d.ts +3 -3
  46. package/dist/Logger.d.ts.map +1 -1
  47. package/dist/Logger.js +305 -37
  48. package/dist/Logger.js.map +1 -1
  49. package/dist/Manifest.d.ts +4 -16
  50. package/dist/Manifest.d.ts.map +1 -1
  51. package/dist/Manifest.js +65 -4
  52. package/dist/Manifest.js.map +1 -1
  53. package/dist/Middleware.d.ts +5 -2
  54. package/dist/Middleware.d.ts.map +1 -1
  55. package/dist/Middleware.js +278 -27
  56. package/dist/Middleware.js.map +1 -1
  57. package/dist/Redaction.d.ts +27 -0
  58. package/dist/Redaction.d.ts.map +1 -0
  59. package/dist/Redaction.js +149 -0
  60. package/dist/Redaction.js.map +1 -0
  61. package/dist/Resource.d.ts +66 -0
  62. package/dist/Resource.d.ts.map +1 -0
  63. package/dist/Resource.js +57 -0
  64. package/dist/Resource.js.map +1 -0
  65. package/dist/ResourcesErrors.d.ts +36 -0
  66. package/dist/ResourcesErrors.d.ts.map +1 -0
  67. package/dist/ResourcesErrors.js +27 -0
  68. package/dist/ResourcesErrors.js.map +1 -0
  69. package/dist/ResourcesToken.d.ts +10 -0
  70. package/dist/ResourcesToken.d.ts.map +1 -0
  71. package/dist/ResourcesToken.js +63 -0
  72. package/dist/ResourcesToken.js.map +1 -0
  73. package/dist/RuntimeResources.d.ts +26 -0
  74. package/dist/RuntimeResources.d.ts.map +1 -0
  75. package/dist/RuntimeResources.js +115 -0
  76. package/dist/RuntimeResources.js.map +1 -0
  77. package/dist/Trigger.d.ts +1 -26
  78. package/dist/Trigger.d.ts.map +1 -1
  79. package/dist/Trigger.js +1 -24
  80. package/dist/Trigger.js.map +1 -1
  81. package/dist/Workflow.d.ts +26 -9
  82. package/dist/Workflow.d.ts.map +1 -1
  83. package/dist/Workflow.js +48 -12
  84. package/dist/Workflow.js.map +1 -1
  85. package/dist/cli.d.ts.map +1 -1
  86. package/dist/cli.js +193 -41
  87. package/dist/cli.js.map +1 -1
  88. package/dist/index.d.ts +15 -4
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +12 -2
  91. package/dist/index.js.map +1 -1
  92. package/dist/testing.d.ts +34 -2
  93. package/dist/testing.d.ts.map +1 -1
  94. package/dist/testing.js +35 -0
  95. package/dist/testing.js.map +1 -1
  96. package/package.json +6 -2
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Runtime resolution surface for workflow runtimes and sandboxes. The caller presents a deployment-scoped
3
+ * runtime-resolver JWT (never a user session) and resolves variables, resources, and selectors by key.
4
+ * The Temper API serves it; the SDK derives its client from it.
5
+ */
6
+ import { Schema } from 'effect';
7
+ import { HttpApi, HttpApiEndpoint, HttpApiGroup } from 'effect/unstable/httpapi';
8
+ export declare const SelectResourceRuntimeInputSchema: Schema.Struct<{
9
+ readonly resourceTypeKey: Schema.String;
10
+ readonly match: Schema.$Record<Schema.String, Schema.String>;
11
+ }>;
12
+ export declare const SelectResourceRuntimeOutputSchema: Schema.Struct<{
13
+ readonly key: Schema.String;
14
+ }>;
15
+ declare const RuntimeResourcesUnauthorizedError_base: Schema.Class<RuntimeResourcesUnauthorizedError, Schema.TaggedStruct<"RuntimeResourcesUnauthorizedError", {
16
+ readonly error: Schema.Literal<"Unauthorized">;
17
+ }>, import("effect/Cause").YieldableError>;
18
+ export declare class RuntimeResourcesUnauthorizedError extends RuntimeResourcesUnauthorizedError_base {
19
+ }
20
+ declare const RuntimeResourcesForbiddenError_base: Schema.Class<RuntimeResourcesForbiddenError, Schema.TaggedStruct<"RuntimeResourcesForbiddenError", {
21
+ readonly error: Schema.Literal<"Forbidden">;
22
+ }>, import("effect/Cause").YieldableError>;
23
+ export declare class RuntimeResourcesForbiddenError extends RuntimeResourcesForbiddenError_base {
24
+ }
25
+ declare const RuntimeResourcesNotFoundError_base: Schema.Class<RuntimeResourcesNotFoundError, Schema.TaggedStruct<"RuntimeResourcesNotFoundError", {
26
+ readonly error: Schema.Literal<"Not found">;
27
+ }>, import("effect/Cause").YieldableError>;
28
+ export declare class RuntimeResourcesNotFoundError extends RuntimeResourcesNotFoundError_base {
29
+ }
30
+ declare const RuntimeResourcesBadRequestError_base: Schema.Class<RuntimeResourcesBadRequestError, Schema.TaggedStruct<"RuntimeResourcesBadRequestError", {
31
+ readonly error: Schema.String;
32
+ }>, import("effect/Cause").YieldableError>;
33
+ export declare class RuntimeResourcesBadRequestError extends RuntimeResourcesBadRequestError_base {
34
+ }
35
+ declare const RuntimeResourcesConflictError_base: Schema.Class<RuntimeResourcesConflictError, Schema.TaggedStruct<"RuntimeResourcesConflictError", {
36
+ readonly error: Schema.String;
37
+ }>, import("effect/Cause").YieldableError>;
38
+ export declare class RuntimeResourcesConflictError extends RuntimeResourcesConflictError_base {
39
+ }
40
+ declare const RuntimeResourcesUnavailableError_base: Schema.Class<RuntimeResourcesUnavailableError, Schema.TaggedStruct<"RuntimeResourcesUnavailableError", {
41
+ readonly error: Schema.String;
42
+ }>, import("effect/Cause").YieldableError>;
43
+ export declare class RuntimeResourcesUnavailableError extends RuntimeResourcesUnavailableError_base {
44
+ }
45
+ export declare const ResourcesRuntimeApi: HttpApi.HttpApi<"resources-runtime-api", HttpApiGroup.HttpApiGroup<"resourcesRuntime", HttpApiEndpoint.HttpApiEndpoint<"inspectResource", "POST", "/api/v1/runtime/resources/inspect", never, never, Schema.toCodecJson<Schema.Struct<{
46
+ readonly key: Schema.String;
47
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
48
+ readonly authorization: Schema.optionalKey<Schema.String>;
49
+ }>>, Schema.toCodecJson<Schema.Struct<{
50
+ readonly redactionMasks: Schema.optionalKey<Schema.$Array<Schema.String>>;
51
+ readonly value: Schema.Struct<{
52
+ readonly id: Schema.String;
53
+ readonly organizationId: Schema.String;
54
+ readonly resourceTypeId: Schema.String;
55
+ readonly resourceTypeKey: Schema.String;
56
+ readonly resourceTypeName: Schema.String;
57
+ readonly projectId: Schema.NullOr<Schema.String>;
58
+ readonly workflowId: Schema.NullOr<Schema.String>;
59
+ readonly environment: Schema.NullOr<Schema.Literals<readonly ["sandbox", "production", "staging"]>>;
60
+ readonly key: Schema.String;
61
+ readonly label: Schema.NullOr<Schema.String>;
62
+ readonly value: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
63
+ readonly refs: Schema.$Record<Schema.String, Schema.Struct<{
64
+ readonly key: Schema.String;
65
+ }>>;
66
+ readonly description: Schema.NullOr<Schema.String>;
67
+ readonly metadata: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
68
+ }>;
69
+ }>>, Schema.toCodecJson<Schema.decodeTo<typeof RuntimeResourcesUnauthorizedError, Schema.Struct<{
70
+ readonly error: Schema.Literal<"Unauthorized">;
71
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesForbiddenError, Schema.Struct<{
72
+ readonly error: Schema.Literal<"Forbidden">;
73
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesNotFoundError, Schema.Struct<{
74
+ readonly error: Schema.Literal<"Not found">;
75
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesBadRequestError, Schema.Struct<{
76
+ readonly error: Schema.String;
77
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesConflictError, Schema.Struct<{
78
+ readonly error: Schema.String;
79
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
80
+ readonly error: Schema.String;
81
+ }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"resolveResource", "POST", "/api/v1/runtime/resources/resolve", never, never, Schema.toCodecJson<Schema.Struct<{
82
+ readonly key: Schema.String;
83
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
84
+ readonly authorization: Schema.optionalKey<Schema.String>;
85
+ }>>, Schema.toCodecJson<Schema.Struct<{
86
+ readonly redactionMasks: Schema.optionalKey<Schema.$Array<Schema.String>>;
87
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
88
+ }>>, Schema.toCodecJson<Schema.decodeTo<typeof RuntimeResourcesUnauthorizedError, Schema.Struct<{
89
+ readonly error: Schema.Literal<"Unauthorized">;
90
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesForbiddenError, Schema.Struct<{
91
+ readonly error: Schema.Literal<"Forbidden">;
92
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesNotFoundError, Schema.Struct<{
93
+ readonly error: Schema.Literal<"Not found">;
94
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesBadRequestError, Schema.Struct<{
95
+ readonly error: Schema.String;
96
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesConflictError, Schema.Struct<{
97
+ readonly error: Schema.String;
98
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
99
+ readonly error: Schema.String;
100
+ }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"resolveVariable", "POST", "/api/v1/runtime/variables/resolve", never, never, Schema.toCodecJson<Schema.Struct<{
101
+ readonly key: Schema.String;
102
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
103
+ readonly authorization: Schema.optionalKey<Schema.String>;
104
+ }>>, Schema.toCodecJson<Schema.Struct<{
105
+ readonly redactionMasks: Schema.optionalKey<Schema.$Array<Schema.String>>;
106
+ readonly value: Schema.String;
107
+ }>>, Schema.toCodecJson<Schema.decodeTo<typeof RuntimeResourcesUnauthorizedError, Schema.Struct<{
108
+ readonly error: Schema.Literal<"Unauthorized">;
109
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesForbiddenError, Schema.Struct<{
110
+ readonly error: Schema.Literal<"Forbidden">;
111
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesNotFoundError, Schema.Struct<{
112
+ readonly error: Schema.Literal<"Not found">;
113
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesBadRequestError, Schema.Struct<{
114
+ readonly error: Schema.String;
115
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesConflictError, Schema.Struct<{
116
+ readonly error: Schema.String;
117
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
118
+ readonly error: Schema.String;
119
+ }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"selectResource", "POST", "/api/v1/runtime/resources/select", never, never, Schema.toCodecJson<Schema.Struct<{
120
+ readonly resourceTypeKey: Schema.String;
121
+ readonly match: Schema.$Record<Schema.String, Schema.String>;
122
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
123
+ readonly authorization: Schema.optionalKey<Schema.String>;
124
+ }>>, Schema.toCodecJson<Schema.Struct<{
125
+ readonly redactionMasks: Schema.optionalKey<Schema.$Array<Schema.String>>;
126
+ readonly value: Schema.Struct<{
127
+ readonly key: Schema.String;
128
+ }>;
129
+ }>>, Schema.toCodecJson<Schema.decodeTo<typeof RuntimeResourcesUnauthorizedError, Schema.Struct<{
130
+ readonly error: Schema.Literal<"Unauthorized">;
131
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesForbiddenError, Schema.Struct<{
132
+ readonly error: Schema.Literal<"Forbidden">;
133
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesNotFoundError, Schema.Struct<{
134
+ readonly error: Schema.Literal<"Not found">;
135
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesBadRequestError, Schema.Struct<{
136
+ readonly error: Schema.String;
137
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesConflictError, Schema.Struct<{
138
+ readonly error: Schema.String;
139
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
140
+ readonly error: Schema.String;
141
+ }>, never, never>>, never, never>, false>>;
142
+ export {};
143
+ //# sourceMappingURL=RuntimeApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeApi.d.ts","sourceRoot":"","sources":["../../src/Contract/RuntimeApi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAA0B,MAAM,yBAAyB,CAAC;AAUzG,eAAO,MAAM,gCAAgC;;;EAK3C,CAAC;AAoDH,eAAO,MAAM,iCAAiC;;EAE5C,CAAC;;;;AAaH,qBAAa,iCAAkC,SAAQ,sCAGtD;CAAG;;;;AAEJ,qBAAa,8BAA+B,SAAQ,mCAGnD;CAAG;;;;AAEJ,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;AAEJ,qBAAa,+BAAgC,SAAQ,oCAGpD;CAAG;;;;AAEJ,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;AACJ,qBAAa,gCAAiC,SAAQ,qCAGrD;CAAG;AAmGJ,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAA0E,CAAC"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Runtime resolution surface for workflow runtimes and sandboxes. The caller presents a deployment-scoped
3
+ * runtime-resolver JWT (never a user session) and resolves variables, resources, and selectors by key.
4
+ * The Temper API serves it; the SDK derives its client from it.
5
+ */
6
+ import { Schema, SchemaGetter } from 'effect';
7
+ import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from 'effect/unstable/httpapi';
8
+ const AuthorizationHeadersSchema = Schema.Struct({
9
+ authorization: Schema.optionalKey(Schema.String),
10
+ });
11
+ const ResolveKeyInputSchema = Schema.Struct({
12
+ key: Schema.String.annotate({ description: 'Variable or resource key.' }),
13
+ });
14
+ export const SelectResourceRuntimeInputSchema = Schema.Struct({
15
+ resourceTypeKey: Schema.String,
16
+ match: Schema.Record(Schema.String, Schema.String).annotate({
17
+ description: 'Exactly one selectable field to match on (enforced by the service).',
18
+ }),
19
+ });
20
+ /** Masks ride along so the caller can redact log output that embeds secret material. */
21
+ const redactionMasksField = {
22
+ redactionMasks: Schema.optionalKey(Schema.Array(Schema.String)),
23
+ };
24
+ const VariableValueOutputSchema = Schema.Struct({
25
+ value: Schema.String,
26
+ ...redactionMasksField,
27
+ });
28
+ const ResolvedResourceOutputSchema = Schema.Struct({
29
+ value: Schema.Json,
30
+ ...redactionMasksField,
31
+ });
32
+ const JsonObjectSchema = Schema.Record(Schema.String, Schema.Json).annotate({ description: 'JSON object.' });
33
+ /** A record without its secret fields: a field that points at a Variable sits in `refs`, and only a resolve fills it. */
34
+ const RuntimeInspectedResourceSchema = Schema.Struct({
35
+ id: Schema.String.annotate({ description: 'The immutable resource UUID.' }),
36
+ organizationId: Schema.String,
37
+ resourceTypeId: Schema.String.annotate({ description: 'The immutable resource-type UUID.' }),
38
+ resourceTypeKey: Schema.String.check(Schema.isMinLength(1)).annotate({
39
+ description: 'Editable resource-type key used for display, filtering, and runtime selection.',
40
+ }),
41
+ resourceTypeName: Schema.String,
42
+ projectId: Schema.NullOr(Schema.String),
43
+ workflowId: Schema.NullOr(Schema.String),
44
+ environment: Schema.NullOr(Schema.Literals(['sandbox', 'production', 'staging'])),
45
+ key: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_.-]{1,128}$/, {
46
+ message: 'Key may contain letters, digits, `_`, `.`, and `-` (1-128 characters)',
47
+ })).annotate({
48
+ description: 'The name workflow code uses to read this record. Unique within its scope and environment.',
49
+ }),
50
+ label: Schema.NullOr(Schema.String),
51
+ value: JsonObjectSchema.annotate({
52
+ description: 'Literal fields. A field that points at a Variable is absent here.',
53
+ }),
54
+ refs: Schema.Record(Schema.String, Schema.Struct({ key: Schema.String })),
55
+ description: Schema.NullOr(Schema.String),
56
+ metadata: JsonObjectSchema,
57
+ });
58
+ const InspectedResourceOutputSchema = Schema.Struct({
59
+ value: RuntimeInspectedResourceSchema,
60
+ ...redactionMasksField,
61
+ });
62
+ export const SelectResourceRuntimeOutputSchema = Schema.Struct({
63
+ key: Schema.String,
64
+ });
65
+ const SelectResourceRuntimeResponseSchema = Schema.Struct({
66
+ value: SelectResourceRuntimeOutputSchema,
67
+ ...redactionMasksField,
68
+ });
69
+ const UnauthorizedBodySchema = Schema.Struct({ error: Schema.Literal('Unauthorized') });
70
+ const ForbiddenBodySchema = Schema.Struct({ error: Schema.Literal('Forbidden') });
71
+ const NotFoundBodySchema = Schema.Struct({ error: Schema.Literal('Not found') });
72
+ const ErrorBodySchema = Schema.Struct({ error: Schema.String });
73
+ export class RuntimeResourcesUnauthorizedError extends Schema.TaggedError()('RuntimeResourcesUnauthorizedError', { error: Schema.Literal('Unauthorized') }) {
74
+ }
75
+ export class RuntimeResourcesForbiddenError extends Schema.TaggedError()('RuntimeResourcesForbiddenError', { error: Schema.Literal('Forbidden') }) {
76
+ }
77
+ export class RuntimeResourcesNotFoundError extends Schema.TaggedError()('RuntimeResourcesNotFoundError', { error: Schema.Literal('Not found') }) {
78
+ }
79
+ export class RuntimeResourcesBadRequestError extends Schema.TaggedError()('RuntimeResourcesBadRequestError', { error: Schema.String }) {
80
+ }
81
+ export class RuntimeResourcesConflictError extends Schema.TaggedError()('RuntimeResourcesConflictError', { error: Schema.String }) {
82
+ }
83
+ export class RuntimeResourcesUnavailableError extends Schema.TaggedError()('RuntimeResourcesUnavailableError', { error: Schema.String }) {
84
+ }
85
+ const unauthorizedError = UnauthorizedBodySchema.pipe(Schema.decodeTo(RuntimeResourcesUnauthorizedError, {
86
+ decode: SchemaGetter.transform(() => new RuntimeResourcesUnauthorizedError({ error: 'Unauthorized' })),
87
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
88
+ }), HttpApiSchema.status(401));
89
+ const forbiddenError = ForbiddenBodySchema.pipe(Schema.decodeTo(RuntimeResourcesForbiddenError, {
90
+ decode: SchemaGetter.transform(() => new RuntimeResourcesForbiddenError({ error: 'Forbidden' })),
91
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
92
+ }), HttpApiSchema.status(403));
93
+ const notFoundError = NotFoundBodySchema.pipe(Schema.decodeTo(RuntimeResourcesNotFoundError, {
94
+ decode: SchemaGetter.transform(() => new RuntimeResourcesNotFoundError({ error: 'Not found' })),
95
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
96
+ }), HttpApiSchema.status(404));
97
+ const badRequestError = ErrorBodySchema.pipe(Schema.decodeTo(RuntimeResourcesBadRequestError, {
98
+ decode: SchemaGetter.transform((body) => new RuntimeResourcesBadRequestError(body)),
99
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
100
+ }), HttpApiSchema.status(400));
101
+ const conflictError = ErrorBodySchema.pipe(Schema.decodeTo(RuntimeResourcesConflictError, {
102
+ decode: SchemaGetter.transform((body) => new RuntimeResourcesConflictError(body)),
103
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
104
+ }), HttpApiSchema.status(409));
105
+ const unavailableError = ErrorBodySchema.pipe(Schema.decodeTo(RuntimeResourcesUnavailableError, {
106
+ decode: SchemaGetter.transform((body) => new RuntimeResourcesUnavailableError(body)),
107
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
108
+ }), HttpApiSchema.status(503));
109
+ const runtimeErrors = [
110
+ unauthorizedError,
111
+ forbiddenError,
112
+ notFoundError,
113
+ badRequestError,
114
+ conflictError,
115
+ unavailableError,
116
+ ];
117
+ const ResourcesRuntimeHttpApiGroup = HttpApiGroup.make('resourcesRuntime')
118
+ .add(HttpApiEndpoint.post('resolveVariable', '/variables/resolve', {
119
+ headers: AuthorizationHeadersSchema,
120
+ payload: ResolveKeyInputSchema,
121
+ success: VariableValueOutputSchema,
122
+ error: runtimeErrors,
123
+ }))
124
+ .add(HttpApiEndpoint.post('inspectResource', '/resources/inspect', {
125
+ headers: AuthorizationHeadersSchema,
126
+ payload: ResolveKeyInputSchema,
127
+ success: InspectedResourceOutputSchema,
128
+ error: runtimeErrors,
129
+ }))
130
+ .add(HttpApiEndpoint.post('resolveResource', '/resources/resolve', {
131
+ headers: AuthorizationHeadersSchema,
132
+ payload: ResolveKeyInputSchema,
133
+ success: ResolvedResourceOutputSchema,
134
+ error: runtimeErrors,
135
+ }))
136
+ .add(HttpApiEndpoint.post('selectResource', '/resources/select', {
137
+ headers: AuthorizationHeadersSchema,
138
+ payload: SelectResourceRuntimeInputSchema,
139
+ success: SelectResourceRuntimeResponseSchema,
140
+ error: runtimeErrors,
141
+ }))
142
+ .prefix('/api/v1/runtime')
143
+ .annotateMerge(OpenApi.annotations({
144
+ title: 'Resources runtime',
145
+ description: 'Runtime-token-authenticated variable and resource resolution for workflow runtimes.',
146
+ }));
147
+ export const ResourcesRuntimeApi = HttpApi.make('resources-runtime-api').add(ResourcesRuntimeHttpApiGroup);
148
+ //# sourceMappingURL=RuntimeApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeApi.js","sourceRoot":"","sources":["../../src/Contract/RuntimeApi.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEzG,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,2BAA2B,EAAE,CAAC;CAC1E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC,M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IAAI,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { InvocationContext, InvocationTriggerKind } from './Invocation.js';
2
+ export { ManifestResource, ResponsePolicy, TriggerKind, TriggerMetadata, WorkflowManifest, WorkflowManifestEndpoint, } from './Manifest.js';
3
+ export { ResourcesRuntimeApi, RuntimeResourcesBadRequestError, RuntimeResourcesConflictError, RuntimeResourcesForbiddenError, RuntimeResourcesNotFoundError, RuntimeResourcesUnauthorizedError, RuntimeResourcesUnavailableError, SelectResourceRuntimeInputSchema, SelectResourceRuntimeOutputSchema, } from './RuntimeApi.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Contract/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ManifestResource, ResponsePolicy, TriggerKind, TriggerMetadata, WorkflowManifest, WorkflowManifestEndpoint, } from './Manifest.js';
2
+ export { ResourcesRuntimeApi, RuntimeResourcesBadRequestError, RuntimeResourcesConflictError, RuntimeResourcesForbiddenError, RuntimeResourcesNotFoundError, RuntimeResourcesUnauthorizedError, RuntimeResourcesUnavailableError, SelectResourceRuntimeInputSchema, SelectResourceRuntimeOutputSchema, } from './RuntimeApi.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Contract/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Effect } from 'effect';
2
+ import { Invocation } from './Invocation.js';
3
+ /** The ids legacy code read from `storage.getStore()`; each is `undefined` outside a request or span. */
4
+ export interface Correlation {
5
+ readonly traceId: string | undefined;
6
+ readonly messageId: string | undefined;
7
+ readonly spanId: string | undefined;
8
+ }
9
+ /** The current correlation, e.g. the `x-unnbound-trace-id` and `x-message-id` a child enqueue sends. */
10
+ export declare const currentCorrelation: Effect.Effect<Correlation>;
11
+ /**
12
+ * Legacy `withTrace(callback, extra)` (sdk/logger/src/trace.ts:9-15): the effect's lines, and the
13
+ * `x-unnbound-trace-id` of its SDK `HttpClient` calls, carry the given ids, else the enclosing ones,
14
+ * else fresh UUIDs. The enclosing span chain stays, as the legacy store merged the previous one.
15
+ */
16
+ export declare const withCorrelation: (ids: Partial<Pick<Correlation, 'traceId' | 'messageId'>>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
17
+ /** Legacy `withTrace(callback, { traceId: getTraceId() })`: each run of the effect gets a new trace id. */
18
+ export declare const withFreshTrace: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
19
+ /** The child request a message id is derived from, exactly as it will be sent. */
20
+ export interface ChildRequest {
21
+ readonly method: string;
22
+ readonly path: string;
23
+ readonly body: string;
24
+ }
25
+ /**
26
+ * The `x-message-id` for one child Run. The gateway keys durable admission on it
27
+ * (apps/workflow-gateway/src/async_delivery.rs:228-233, 347-351), and legacy enqueue reused the
28
+ * parent's for every child, collapsing them into one Run (T-2601). The id is SHA-256 in UUID v5 layout
29
+ * over the parent's stable id (the caller's message id, else the Run id, else the execution id; never
30
+ * an SDK-minted one) and the child request: a replayed parent resends it, distinct children differ.
31
+ */
32
+ export declare const childMessageId: (child: ChildRequest) => Effect.Effect<string, never, Invocation>;
33
+ //# sourceMappingURL=Correlation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Correlation.d.ts","sourceRoot":"","sources":["../src/Correlation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,yGAAyG;AACzG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,wGAAwG;AACxG,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAIvD,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,eAAe,QACpB,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC,MACxD,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAW5D,CAAC;AAEP,2GAA2G;AAC3G,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CACb,CAAC;AAElF,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAAW,YAAY,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,CAsBxF,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { Effect } from 'effect';
3
+ import { Invocation } from './Invocation.js';
4
+ import { CurrentLogContext } from './LogContext.js';
5
+ /** The current correlation, e.g. the `x-unnbound-trace-id` and `x-message-id` a child enqueue sends. */
6
+ export const currentCorrelation = CurrentLogContext.useSync((context) => ({
7
+ traceId: context?.traceId,
8
+ messageId: context?.messageId,
9
+ spanId: context?.spanId,
10
+ }));
11
+ /**
12
+ * Legacy `withTrace(callback, extra)` (sdk/logger/src/trace.ts:9-15): the effect's lines, and the
13
+ * `x-unnbound-trace-id` of its SDK `HttpClient` calls, carry the given ids, else the enclosing ones,
14
+ * else fresh UUIDs. The enclosing span chain stays, as the legacy store merged the previous one.
15
+ */
16
+ export const withCorrelation = (ids) => (effect) => Effect.withFiber((fiber) => {
17
+ const enclosing = fiber.getRef(CurrentLogContext);
18
+ const messageId = ids.messageId ?? enclosing?.messageId;
19
+ return Effect.provideService(effect, CurrentLogContext, {
20
+ ...enclosing,
21
+ traceId: ids.traceId ?? enclosing?.traceId ?? crypto.randomUUID(),
22
+ messageId: messageId ?? crypto.randomUUID(),
23
+ messageIdMinted: ids.messageId === undefined && (messageId === undefined || enclosing?.messageIdMinted === true),
24
+ });
25
+ });
26
+ /** Legacy `withTrace(callback, { traceId: getTraceId() })`: each run of the effect gets a new trace id. */
27
+ export const withFreshTrace = (effect) => Effect.suspend(() => withCorrelation({ traceId: crypto.randomUUID() })(effect));
28
+ /**
29
+ * The `x-message-id` for one child Run. The gateway keys durable admission on it
30
+ * (apps/workflow-gateway/src/async_delivery.rs:228-233, 347-351), and legacy enqueue reused the
31
+ * parent's for every child, collapsing them into one Run (T-2601). The id is SHA-256 in UUID v5 layout
32
+ * over the parent's stable id (the caller's message id, else the Run id, else the execution id; never
33
+ * an SDK-minted one) and the child request: a replayed parent resends it, distinct children differ.
34
+ */
35
+ export const childMessageId = (child) => Effect.gen(function* () {
36
+ const invocation = yield* Invocation;
37
+ const context = yield* CurrentLogContext;
38
+ const parent =
39
+ // An empty caller id is no id: the gateway ignores it (async_delivery.rs:1043), so every Run would share it.
40
+ context !== undefined &&
41
+ context.messageIdMinted !== true &&
42
+ context.messageId !== undefined &&
43
+ context.messageId !== ''
44
+ ? context.messageId
45
+ : invocation.runId !== ''
46
+ ? invocation.runId
47
+ : invocation.executionId;
48
+ const bytes = createHash('sha256')
49
+ .update(JSON.stringify([parent, child.method, child.path, child.body]))
50
+ .digest()
51
+ .subarray(0, 16);
52
+ bytes[6] = (bytes[6] & 0x0f) | 0x50;
53
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
54
+ const hex = bytes.toString('hex');
55
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
56
+ });
57
+ //# sourceMappingURL=Correlation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Correlation.js","sourceRoot":"","sources":["../src/Correlation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AASpD,wGAAwG;AACxG,MAAM,CAAC,MAAM,kBAAkB,GAA+B,iBAA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AAE,CAAC,EAAE,CAAC;AAC7G,CAAC,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { Schema } from 'effect';
2
+ /** The resolved value of the `http_api` system type, with the defaults its schema declares. */
3
+ export declare const HttpApiResource: Schema.Struct<{
4
+ readonly baseUrl: Schema.String;
5
+ readonly headers: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>;
6
+ readonly auth: Schema.withDecodingDefaultKey<Schema.Union<readonly [Schema.Struct<{
7
+ readonly type: Schema.Literal<"none">;
8
+ }>, Schema.Struct<{
9
+ readonly type: Schema.Literal<"basic">;
10
+ readonly username: Schema.String;
11
+ readonly password: Schema.RedactedFromValue<Schema.String>;
12
+ }>, Schema.Struct<{
13
+ readonly type: Schema.Literal<"bearer">;
14
+ readonly token: Schema.RedactedFromValue<Schema.String>;
15
+ }>, Schema.Struct<{
16
+ readonly type: Schema.Literal<"api_key">;
17
+ readonly apiKey: Schema.RedactedFromValue<Schema.String>;
18
+ readonly placement: Schema.withDecodingDefaultKey<Schema.Literals<readonly ["authorization_bearer", "header", "query"]>, never>;
19
+ readonly name: Schema.withDecodingDefaultKey<Schema.String, never>;
20
+ }>, Schema.Struct<{
21
+ readonly type: Schema.Literal<"oauth2_client_credentials">;
22
+ readonly tokenUrl: Schema.String;
23
+ readonly clientId: Schema.String;
24
+ readonly clientSecret: Schema.RedactedFromValue<Schema.String>;
25
+ readonly scope: Schema.optionalKey<Schema.String>;
26
+ readonly audience: Schema.optionalKey<Schema.String>;
27
+ readonly extraParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
28
+ }>]>, never>;
29
+ readonly tenantKey: Schema.optionalKey<Schema.RedactedFromValue<Schema.String>>;
30
+ }>;
31
+ export type HttpApiResource = typeof HttpApiResource.Type;
32
+ //# sourceMappingURL=HttpApiResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpApiResource.d.ts","sourceRoot":"","sources":["../src/HttpApiResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AA4BxC,+FAA+F;AAC/F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { Effect, Schema } from 'effect';
2
+ /** An `x-secret` field: the value arrives `Redacted`, so logging the record never prints it. */
3
+ const Secret = Schema.RedactedFromValue(Schema.String);
4
+ const HttpApiAuth = Schema.Union([
5
+ Schema.Struct({ type: Schema.Literal('none') }),
6
+ Schema.Struct({ type: Schema.Literal('basic'), username: Schema.String, password: Secret }),
7
+ Schema.Struct({ type: Schema.Literal('bearer'), token: Secret }),
8
+ Schema.Struct({
9
+ type: Schema.Literal('api_key'),
10
+ apiKey: Secret,
11
+ placement: Schema.Literals(['authorization_bearer', 'header', 'query']).pipe(Schema.withDecodingDefaultKey(Effect.succeed('header'))),
12
+ name: Schema.String.check(Schema.isMinLength(1)).pipe(Schema.withDecodingDefaultKey(Effect.succeed('x-api-key'))),
13
+ }),
14
+ Schema.Struct({
15
+ type: Schema.Literal('oauth2_client_credentials'),
16
+ tokenUrl: Schema.String.check(Schema.isMinLength(1)),
17
+ clientId: Schema.String,
18
+ clientSecret: Secret,
19
+ scope: Schema.optionalKey(Schema.String),
20
+ audience: Schema.optionalKey(Schema.String),
21
+ extraParams: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
22
+ }),
23
+ ]);
24
+ /** The resolved value of the `http_api` system type, with the defaults its schema declares. */
25
+ export const HttpApiResource = Schema.Struct({
26
+ // Requests join paths onto `baseUrl`, so a relative or non-http base would fail every call.
27
+ baseUrl: Schema.String.check(
28
+ // Carried into the manifest's JSON Schema, so deploy rejects a non-http base before a run does.
29
+ Schema.isPattern(/^https?:\/\//i), Schema.makeFilter((url) => (URL.canParse(url) && ['http:', 'https:'].includes(new URL(url).protocol)) ||
30
+ 'Expected an absolute http(s) URL')),
31
+ headers: Schema.Record(Schema.String, Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
32
+ auth: HttpApiAuth.pipe(Schema.withDecodingDefaultKey(Effect.succeed({ type: 'none' }))),
33
+ tenantKey: Schema.optionalKey(Secret),
34
+ });
35
+ //# sourceMappingURL=HttpApiResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpApiResource.js","sourceRoot":"","sources":["../src/HttpApiResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,gGAAgG;AAChG,MAAM,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC;IAC/B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/C,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC3F,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChE,MAAM,CAAC,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;QAC/B,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,sBAAsB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAC1E,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,QAAiB,CAAC,CAAC,CACjE;QACD,IAAI,EAAE,MAAM,CAAC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C,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5G,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,CAAC,CAAC,CAAC;IAChG,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC;CACtC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Layer } from 'effect';
2
+ import { HttpClient } from 'effect/unstable/http';
3
+ /** Sends one outbound request: the global `fetch` in production, a fake in tests. */
4
+ export type OutboundFetch = (url: URL, init: RequestInit) => Promise<Response>;
5
+ /**
6
+ * The workflow's `HttpClient`: every call carries the request trace and logs legacy
7
+ * `Outgoing HTTP request` lines, unless `HttpClient.TracerDisabledWhen` holds for the request.
8
+ */
9
+ export declare const httpClientLayer: (outboundFetch: OutboundFetch) => Layer.Layer<HttpClient.HttpClient>;
10
+ //# sourceMappingURL=HttpClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpClient.d.ts","sourceRoot":"","sources":["../src/HttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,EAAkB,MAAM,QAAQ,CAAC;AACpE,OAAO,EAEL,UAAU,EAIX,MAAM,sBAAsB,CAAC;AAmB9B,qFAAqF;AACrF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AA8J/E;;;GAGG;AACH,eAAO,MAAM,eAAe,kBAAmB,aAAa,KAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CA+C7F,CAAC"}