@ontemper/sdk 0.9.0-rc.3 → 0.10.0-oauth.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.
Files changed (87) hide show
  1. package/README.md +157 -16
  2. package/dist/AccessTokens.d.ts +15 -22
  3. package/dist/AccessTokens.d.ts.map +1 -1
  4. package/dist/AccessTokens.js +57 -55
  5. package/dist/AccessTokens.js.map +1 -1
  6. package/dist/As2Transport.d.ts +7 -2
  7. package/dist/As2Transport.d.ts.map +1 -1
  8. package/dist/As2Transport.js.map +1 -1
  9. package/dist/Contract/Manifest.d.ts +58 -1
  10. package/dist/Contract/Manifest.d.ts.map +1 -1
  11. package/dist/Contract/Manifest.js +53 -0
  12. package/dist/Contract/Manifest.js.map +1 -1
  13. package/dist/Contract/RuntimeApi.d.ts +35 -29
  14. package/dist/Contract/RuntimeApi.d.ts.map +1 -1
  15. package/dist/Contract/RuntimeApi.js +59 -25
  16. package/dist/Contract/RuntimeApi.js.map +1 -1
  17. package/dist/Contract/index.d.ts +2 -2
  18. package/dist/Contract/index.d.ts.map +1 -1
  19. package/dist/Contract/index.js +2 -2
  20. package/dist/Contract/index.js.map +1 -1
  21. package/dist/HttpApiClient.d.ts +30 -0
  22. package/dist/HttpApiClient.d.ts.map +1 -0
  23. package/dist/HttpApiClient.js +142 -0
  24. package/dist/HttpApiClient.js.map +1 -0
  25. package/dist/HttpApiResource.d.ts +133 -0
  26. package/dist/HttpApiResource.d.ts.map +1 -1
  27. package/dist/HttpApiResource.js +31 -3
  28. package/dist/HttpApiResource.js.map +1 -1
  29. package/dist/Kafka.d.ts.map +1 -1
  30. package/dist/Kafka.js +6 -73
  31. package/dist/Kafka.js.map +1 -1
  32. package/dist/LogContext.d.ts +2 -0
  33. package/dist/LogContext.d.ts.map +1 -1
  34. package/dist/LogContext.js +7 -4
  35. package/dist/LogContext.js.map +1 -1
  36. package/dist/Logger.d.ts.map +1 -1
  37. package/dist/Logger.js +16 -3
  38. package/dist/Logger.js.map +1 -1
  39. package/dist/Manifest.d.ts +14 -3
  40. package/dist/Manifest.d.ts.map +1 -1
  41. package/dist/Manifest.js +98 -6
  42. package/dist/Manifest.js.map +1 -1
  43. package/dist/Middleware.d.ts.map +1 -1
  44. package/dist/Middleware.js +4 -1
  45. package/dist/Middleware.js.map +1 -1
  46. package/dist/OAuthToken.d.ts +46 -0
  47. package/dist/OAuthToken.d.ts.map +1 -0
  48. package/dist/OAuthToken.js +132 -0
  49. package/dist/OAuthToken.js.map +1 -0
  50. package/dist/Redaction.d.ts.map +1 -1
  51. package/dist/Redaction.js +1 -0
  52. package/dist/Redaction.js.map +1 -1
  53. package/dist/Resource.d.ts +3 -1
  54. package/dist/Resource.d.ts.map +1 -1
  55. package/dist/Resource.js.map +1 -1
  56. package/dist/RuntimeResources.d.ts +9 -23
  57. package/dist/RuntimeResources.d.ts.map +1 -1
  58. package/dist/RuntimeResources.js +43 -25
  59. package/dist/RuntimeResources.js.map +1 -1
  60. package/dist/Step.d.ts +63 -0
  61. package/dist/Step.d.ts.map +1 -0
  62. package/dist/Step.js +106 -0
  63. package/dist/Step.js.map +1 -0
  64. package/dist/StepCatalog.d.ts +9 -0
  65. package/dist/StepCatalog.d.ts.map +1 -0
  66. package/dist/StepCatalog.js +16 -0
  67. package/dist/StepCatalog.js.map +1 -0
  68. package/dist/StepRuns.d.ts +33 -0
  69. package/dist/StepRuns.d.ts.map +1 -0
  70. package/dist/StepRuns.js +65 -0
  71. package/dist/StepRuns.js.map +1 -0
  72. package/dist/Workflow.d.ts +7 -7
  73. package/dist/Workflow.d.ts.map +1 -1
  74. package/dist/Workflow.js +10 -11
  75. package/dist/Workflow.js.map +1 -1
  76. package/dist/cli.d.ts.map +1 -1
  77. package/dist/cli.js +9 -0
  78. package/dist/cli.js.map +1 -1
  79. package/dist/index.d.ts +4 -3
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +3 -2
  82. package/dist/index.js.map +1 -1
  83. package/dist/testing.d.ts +9 -3
  84. package/dist/testing.d.ts.map +1 -1
  85. package/dist/testing.js +64 -19
  86. package/dist/testing.js.map +1 -1
  87. package/package.json +6 -2
@@ -103,6 +103,52 @@ export const ManifestResource = Schema.Union([
103
103
  Schema.Struct({ kind: Schema.Literal('variable'), key: Schema.String }),
104
104
  Schema.Struct({ kind: Schema.Literal('resourceType'), type: Schema.String, schema: JsonSchemaObject }),
105
105
  ]);
106
+ export const FlowStepKind = Schema.Literals([
107
+ 'query',
108
+ 'http',
109
+ 'file',
110
+ 'transform',
111
+ 'ai',
112
+ 'agent',
113
+ 'review',
114
+ 'notify',
115
+ 'code',
116
+ ]);
117
+ const STEP_ID = /^[a-z][A-Za-z0-9]{0,63}$/;
118
+ /** Why `id` is not a valid step id (FLOW-2), or `undefined`. The build reports it as a step problem. */
119
+ export const stepIdProblem = (id) => STEP_ID.test(id) ? undefined : `step id "${id}" must match ${STEP_ID.source}.`;
120
+ /** One named unit of work the code runs; `id` is stable across deploys and unique in the workflow. */
121
+ export const FlowStep = Schema.Struct({
122
+ id: Schema.String,
123
+ title: Schema.String,
124
+ kind: FlowStepKind,
125
+ summary: Schema.optionalKey(Schema.String),
126
+ /** Identities of the configuration the step reads, as the endpoints' `resources` name them: `resource:<key>`. */
127
+ resources: Schema.Array(Schema.String),
128
+ });
129
+ /** The steps a workflow declares, in declaration order: the manifest's `steps` catalog (FLOW-2). */
130
+ export const WorkflowSteps = Schema.Array(FlowStep);
131
+ /**
132
+ * Reserved fields of the log lines a step writes; the API folds them into the step states of a Run.
133
+ * `path` holds the ids of the enclosing steps and the step, outermost first, joined with `/`.
134
+ * `started`, `completed`, `failed`, and `maxConcurrent` are the numbers of a `summary` line only.
135
+ */
136
+ export const STEP_LOG_FIELDS = {
137
+ step: 'temperStep',
138
+ event: 'temperStepEvent',
139
+ item: 'temperStepItem',
140
+ path: 'temperStepPath',
141
+ started: 'temperStepStarted',
142
+ completed: 'temperStepCompleted',
143
+ failed: 'temperStepFailed',
144
+ maxConcurrent: 'temperStepMaxConcurrent',
145
+ };
146
+ /** Characters of a step field value that a log line cut to its budget keeps whole. */
147
+ export const MAX_STEP_FIELD_LENGTH = 256;
148
+ /** Runs of one step path in one Run that write their started and end lines; a later run writes none (FLOW-3). */
149
+ export const STEP_DETAIL_RUNS = 20;
150
+ /** Failed lines that the later runs of one step path write in one Run, past the detailed runs (FLOW-3). */
151
+ export const STEP_EXTRA_FAILED_LINES = 20;
106
152
  export const WorkflowManifestEndpoint = Schema.Struct({
107
153
  group: Schema.String,
108
154
  name: Schema.String,
@@ -119,5 +165,12 @@ export const WorkflowManifest = Schema.Struct({
119
165
  runtimeApiVersion: Schema.Number,
120
166
  apiId: Schema.String,
121
167
  endpoints: Schema.Array(WorkflowManifestEndpoint),
168
+ // Absent when the workflow declares no step. Unknown, so a catalog shape from a later SDK cannot fail a deploy; read it with decodeWorkflowSteps.
169
+ steps: Schema.optionalKey(Schema.Unknown),
122
170
  });
171
+ /**
172
+ * The catalog of a manifest's `steps`, or `none` when it is absent or has a shape this reader does not
173
+ * know, such as a step kind of a later SDK. Readers call this instead of reading `steps`.
174
+ */
175
+ export const decodeWorkflowSteps = Schema.decodeUnknownOption(WorkflowSteps);
123
176
  //# sourceMappingURL=Manifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Manifest.js","sourceRoot":"","sources":["../../src/Contract/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGvF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAGxE,sFAAsF;AACtF,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,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AM,CAAC,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,eAAe;IACxB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;CAClG,CAAC,CAAC;AAGH,0GAA0G;AAC1G,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,iBAAiB,EAAE,MAAM,CAAC,MAAM;IAChC,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC;IACjD,kJAAkJ;IAClJ,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC;CAC1C,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,MAAM,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC"}
@@ -31,11 +31,14 @@ export declare const RuntimeInspectedResourceSchema: Schema.Struct<{
31
31
  export declare const SelectResourceRuntimeOutputSchema: Schema.Struct<{
32
32
  readonly key: Schema.String;
33
33
  }>;
34
- /** A token one VM got from a partner, kept for the other VMs of the same workflow and environment. */
35
- export declare const RuntimeAccessTokenSchema: Schema.Struct<{
34
+ /** A partner OAuth token the platform issued for the login identity the caller named. */
35
+ export declare const IssuedAccessTokenSchema: Schema.Struct<{
36
36
  readonly token: Schema.String;
37
- readonly expiresAt: Schema.Number;
37
+ readonly expiresIn: Schema.NullOr<Schema.Number>;
38
+ readonly redactionMasks: Schema.$Array<Schema.String>;
38
39
  }>;
40
+ /** The RFC 6749 section 5.2 error codes a partner refusal can name; any other code is left out. */
41
+ export declare const OAUTH_TOKEN_ERROR_CODES: readonly ['invalid_request', 'invalid_client', 'invalid_grant', 'unauthorized_client', 'unsupported_grant_type', 'invalid_scope'];
39
42
  declare const RuntimeResourcesUnauthorizedError_base: Schema.Class<RuntimeResourcesUnauthorizedError, Schema.TaggedStruct<"RuntimeResourcesUnauthorizedError", {
40
43
  readonly error: Schema.Literal<"Unauthorized">;
41
44
  }>, import("effect/Cause").YieldableError>;
@@ -51,6 +54,15 @@ declare const RuntimeResourcesNotFoundError_base: Schema.Class<RuntimeResourcesN
51
54
  }>, import("effect/Cause").YieldableError>;
52
55
  export declare class RuntimeResourcesNotFoundError extends RuntimeResourcesNotFoundError_base {
53
56
  }
57
+ declare const RuntimeResourcesRecordNotFoundError_base: Schema.Class<RuntimeResourcesRecordNotFoundError, Schema.TaggedStruct<"RuntimeResourcesRecordNotFoundError", {
58
+ readonly error: Schema.Literal<"Resource not found">;
59
+ }>, import("effect/Cause").YieldableError>;
60
+ /**
61
+ * The access-token route's 404: no record of the key in reach, or a Variable it points at is missing. Its body differs
62
+ * from the API's answer for a route it does not have, `{ error: 'Not found' }`, so a client can tell them apart.
63
+ */
64
+ export declare class RuntimeResourcesRecordNotFoundError extends RuntimeResourcesRecordNotFoundError_base {
65
+ }
54
66
  declare const RuntimeResourcesBadRequestError_base: Schema.Class<RuntimeResourcesBadRequestError, Schema.TaggedStruct<"RuntimeResourcesBadRequestError", {
55
67
  readonly error: Schema.String;
56
68
  }>, import("effect/Cause").YieldableError>;
@@ -66,6 +78,14 @@ declare const RuntimeResourcesUnavailableError_base: Schema.Class<RuntimeResourc
66
78
  }>, import("effect/Cause").YieldableError>;
67
79
  export declare class RuntimeResourcesUnavailableError extends RuntimeResourcesUnavailableError_base {
68
80
  }
81
+ declare const RuntimeResourcesPartnerLoginError_base: Schema.Class<RuntimeResourcesPartnerLoginError, Schema.TaggedStruct<"RuntimeResourcesPartnerLoginError", {
82
+ readonly error: Schema.String;
83
+ readonly partnerStatus: Schema.optionalKey<Schema.Number>;
84
+ readonly oauthError: Schema.optionalKey<Schema.Literals<readonly ["invalid_request", "invalid_client", "invalid_grant", "unauthorized_client", "unsupported_grant_type", "invalid_scope"]>>;
85
+ }>, import("effect/Cause").YieldableError>;
86
+ /** The platform's login to the partner token endpoint failed, now or inside the time its last failure still answers. */
87
+ export declare class RuntimeResourcesPartnerLoginError extends RuntimeResourcesPartnerLoginError_base {
88
+ }
69
89
  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<{
70
90
  readonly key: Schema.String;
71
91
  }>>, Schema.toCodecStringTree<Schema.Struct<{
@@ -102,28 +122,34 @@ export declare const ResourcesRuntimeApi: HttpApi.HttpApi<"resources-runtime-api
102
122
  readonly error: Schema.String;
103
123
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
104
124
  readonly error: Schema.String;
105
- }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"readAccessToken", "POST", "/api/v1/runtime/resources/access-token/read", never, never, Schema.toCodecJson<Schema.Struct<{
125
+ }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"issueAccessToken", "POST", "/api/v1/runtime/resources/access-token", never, never, Schema.toCodecJson<Schema.Struct<{
106
126
  readonly key: Schema.String;
127
+ readonly identity: Schema.String;
128
+ readonly refused: Schema.optionalKey<Schema.String>;
107
129
  }>>, Schema.toCodecStringTree<Schema.Struct<{
108
130
  readonly authorization: Schema.optionalKey<Schema.String>;
109
131
  }>>, Schema.toCodecJson<Schema.Struct<{
110
- readonly redactionMasks: Schema.optionalKey<Schema.$Array<Schema.String>>;
111
- readonly value: Schema.NullOr<Schema.Struct<{
112
- readonly token: Schema.String;
113
- readonly expiresAt: Schema.Number;
114
- }>>;
132
+ readonly token: Schema.String;
133
+ readonly expiresIn: Schema.NullOr<Schema.Number>;
134
+ readonly redactionMasks: Schema.$Array<Schema.String>;
115
135
  }>>, Schema.toCodecJson<Schema.decodeTo<typeof RuntimeResourcesUnauthorizedError, Schema.Struct<{
116
136
  readonly error: Schema.Literal<"Unauthorized">;
117
137
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesForbiddenError, Schema.Struct<{
118
138
  readonly error: Schema.Literal<"Forbidden">;
119
139
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesNotFoundError, Schema.Struct<{
120
140
  readonly error: Schema.Literal<"Not found">;
141
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesRecordNotFoundError, Schema.Struct<{
142
+ readonly error: Schema.Literal<"Resource not found">;
121
143
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesBadRequestError, Schema.Struct<{
122
144
  readonly error: Schema.String;
123
145
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesConflictError, Schema.Struct<{
124
146
  readonly error: Schema.String;
125
147
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
126
148
  readonly error: Schema.String;
149
+ }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesPartnerLoginError, Schema.Struct<{
150
+ readonly error: Schema.String;
151
+ readonly partnerStatus: Schema.optionalKey<Schema.Number>;
152
+ readonly oauthError: Schema.optionalKey<Schema.Literals<readonly ["invalid_request", "invalid_client", "invalid_grant", "unauthorized_client", "unsupported_grant_type", "invalid_scope"]>>;
127
153
  }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"resolveResource", "POST", "/api/v1/runtime/resources/resolve", never, never, Schema.toCodecJson<Schema.Struct<{
128
154
  readonly key: Schema.String;
129
155
  }>>, Schema.toCodecStringTree<Schema.Struct<{
@@ -184,26 +210,6 @@ export declare const ResourcesRuntimeApi: HttpApi.HttpApi<"resources-runtime-api
184
210
  readonly error: Schema.String;
185
211
  }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
186
212
  readonly error: Schema.String;
187
- }>, never, never>>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"writeAccessToken", "POST", "/api/v1/runtime/resources/access-token/write", never, never, Schema.toCodecJson<Schema.Struct<{
188
- readonly key: Schema.String;
189
- readonly token: Schema.String;
190
- readonly expiresAt: Schema.Number;
191
- }>>, Schema.toCodecStringTree<Schema.Struct<{
192
- readonly authorization: Schema.optionalKey<Schema.String>;
193
- }>>, Schema.toCodecJson<Schema.Struct<{
194
- readonly stored: Schema.Boolean;
195
- }>>, Schema.toCodecJson<Schema.decodeTo<typeof RuntimeResourcesUnauthorizedError, Schema.Struct<{
196
- readonly error: Schema.Literal<"Unauthorized">;
197
- }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesForbiddenError, Schema.Struct<{
198
- readonly error: Schema.Literal<"Forbidden">;
199
- }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesNotFoundError, Schema.Struct<{
200
- readonly error: Schema.Literal<"Not found">;
201
- }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesBadRequestError, Schema.Struct<{
202
- readonly error: Schema.String;
203
- }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesConflictError, Schema.Struct<{
204
- readonly error: Schema.String;
205
- }>, never, never> | Schema.decodeTo<typeof RuntimeResourcesUnavailableError, Schema.Struct<{
206
- readonly error: Schema.String;
207
213
  }>, never, never>>, never, never>, false>>;
208
214
  export {};
209
215
  //# sourceMappingURL=RuntimeApi.d.ts.map
@@ -1 +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,iBAAiB,CAAC;AAUjG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AAe,EACf,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,CACP,CAAC;;;;AASX,qBAAa,iCAAkC,SAAQ,sCAGtD;CAAG;;;;AAEJ,qBAAa,8BAA+B,SAAQ,mCAGnD;CAAG;;;;AAEJ,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;AAEJ;;;GAGG;AACH,qBAAa,mCAAoC,SAAQ,wCAGxD;CAAG;;;;AAEJ,qBAAa,+BAAgC,SAAQ,oCAGpD;CAAG;;;;AAEJ,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;AACJ,qBAAa,gCAAiC,SAAQ,qCAGrD;CAAG;;;;;;AASJ,wHAAwH;AACxH,qBAAa,iCAAkC,SAAQ,sCAGtD;CAAG;AAkIJ,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0CAA0E,CAAC"}
@@ -66,27 +66,36 @@ const SelectResourceRuntimeResponseSchema = Schema.Struct({
66
66
  value: SelectResourceRuntimeOutputSchema,
67
67
  ...redactionMasksField,
68
68
  });
69
- const AccessTokenKeyField = {
70
- key: Schema.String.annotate({ description: 'Key of the resource record whose credential issued the token.' }),
71
- };
72
- /** A token one VM got from a partner, kept for the other VMs of the same workflow and environment. */
73
- export const RuntimeAccessTokenSchema = Schema.Struct({
74
- token: Schema.String.annotate({ description: 'The credential as the workflow sends it to the partner.' }),
75
- expiresAt: Schema.Number.annotate({ description: 'Epoch milliseconds at which the partner lifetime ends.' }),
76
- });
77
- const ReadAccessTokenOutputSchema = Schema.Struct({
78
- value: Schema.NullOr(RuntimeAccessTokenSchema),
79
- ...redactionMasksField,
69
+ const IssueAccessTokenInputSchema = Schema.Struct({
70
+ key: Schema.String.annotate({ description: 'Key of the http_api record whose OAuth login issues the token.' }),
71
+ identity: Schema.String.annotate({
72
+ description: 'Login identity of the record the caller read (httpApiLoginIdentity in @temper/workflow/oauth): "v1:" and the hex SHA-256 of the JSON array [baseUrl, auth.type, tokenUrl, clientId, username or null, scope or null, audience or null, extraParams entries sorted by name, token-request header entries sorted by lowercased name]. No client secret, private key, or password. The v1 definition never changes. When the record the key names now has another identity, the answer is 409.',
73
+ }),
74
+ refused: Schema.optionalKey(Schema.String.annotate({
75
+ description: 'A token the partner refused (a 401). The platform serves it again until its login is 60 seconds old, then logs in again.',
76
+ })),
80
77
  });
81
- const WriteAccessTokenInputSchema = Schema.Struct({ ...AccessTokenKeyField, ...RuntimeAccessTokenSchema.fields });
82
- const WriteAccessTokenOutputSchema = Schema.Struct({
83
- stored: Schema.Boolean.annotate({
84
- description: 'False when the token is empty, too large, or too close to its expiry.',
78
+ /** A partner OAuth token the platform issued for the login identity the caller named. */
79
+ export const IssuedAccessTokenSchema = Schema.Struct({
80
+ token: Schema.String.annotate({ description: 'The bearer access token.' }),
81
+ expiresIn: Schema.NullOr(Schema.Number).annotate({
82
+ description: 'Whole seconds of lifetime left, counted from the start of the partner login; always positive. Null: the partner stated none, so use the token once.',
85
83
  }),
84
+ redactionMasks: Schema.Array(Schema.String),
86
85
  });
86
+ /** The RFC 6749 section 5.2 error codes a partner refusal can name; any other code is left out. */
87
+ export const OAUTH_TOKEN_ERROR_CODES = [
88
+ 'invalid_request',
89
+ 'invalid_client',
90
+ 'invalid_grant',
91
+ 'unauthorized_client',
92
+ 'unsupported_grant_type',
93
+ 'invalid_scope',
94
+ ];
87
95
  const UnauthorizedBodySchema = Schema.Struct({ error: Schema.Literal('Unauthorized') });
88
96
  const ForbiddenBodySchema = Schema.Struct({ error: Schema.Literal('Forbidden') });
89
97
  const NotFoundBodySchema = Schema.Struct({ error: Schema.Literal('Not found') });
98
+ const RecordNotFoundBodySchema = Schema.Struct({ error: Schema.Literal('Resource not found') });
90
99
  const ErrorBodySchema = Schema.Struct({ error: Schema.String });
91
100
  export class RuntimeResourcesUnauthorizedError extends Schema.TaggedError()('RuntimeResourcesUnauthorizedError', { error: Schema.Literal('Unauthorized') }) {
92
101
  }
@@ -94,12 +103,26 @@ export class RuntimeResourcesForbiddenError extends Schema.TaggedError()('Runtim
94
103
  }
95
104
  export class RuntimeResourcesNotFoundError extends Schema.TaggedError()('RuntimeResourcesNotFoundError', { error: Schema.Literal('Not found') }) {
96
105
  }
106
+ /**
107
+ * The access-token route's 404: no record of the key in reach, or a Variable it points at is missing. Its body differs
108
+ * from the API's answer for a route it does not have, `{ error: 'Not found' }`, so a client can tell them apart.
109
+ */
110
+ export class RuntimeResourcesRecordNotFoundError extends Schema.TaggedError()('RuntimeResourcesRecordNotFoundError', { error: Schema.Literal('Resource not found') }) {
111
+ }
97
112
  export class RuntimeResourcesBadRequestError extends Schema.TaggedError()('RuntimeResourcesBadRequestError', { error: Schema.String }) {
98
113
  }
99
114
  export class RuntimeResourcesConflictError extends Schema.TaggedError()('RuntimeResourcesConflictError', { error: Schema.String }) {
100
115
  }
101
116
  export class RuntimeResourcesUnavailableError extends Schema.TaggedError()('RuntimeResourcesUnavailableError', { error: Schema.String }) {
102
117
  }
118
+ const PartnerLoginBodySchema = Schema.Struct({
119
+ error: Schema.String.annotate({ description: 'A fixed message. It never holds a URL, a header, or a body.' }),
120
+ partnerStatus: Schema.optionalKey(Schema.Number.annotate({ description: 'The HTTP status the partner answered.' })),
121
+ oauthError: Schema.optionalKey(Schema.Literals(OAUTH_TOKEN_ERROR_CODES)),
122
+ });
123
+ /** The platform's login to the partner token endpoint failed, now or inside the time its last failure still answers. */
124
+ export class RuntimeResourcesPartnerLoginError extends Schema.TaggedError()('RuntimeResourcesPartnerLoginError', PartnerLoginBodySchema.fields) {
125
+ }
103
126
  const unauthorizedError = UnauthorizedBodySchema.pipe(Schema.decodeTo(RuntimeResourcesUnauthorizedError, {
104
127
  decode: SchemaGetter.transform(() => new RuntimeResourcesUnauthorizedError({ error: 'Unauthorized' })),
105
128
  encode: SchemaGetter.transform((error) => ({ error: error.error })),
@@ -112,6 +135,10 @@ const notFoundError = NotFoundBodySchema.pipe(Schema.decodeTo(RuntimeResourcesNo
112
135
  decode: SchemaGetter.transform(() => new RuntimeResourcesNotFoundError({ error: 'Not found' })),
113
136
  encode: SchemaGetter.transform((error) => ({ error: error.error })),
114
137
  }), HttpApiSchema.status(404));
138
+ const recordNotFoundError = RecordNotFoundBodySchema.pipe(Schema.decodeTo(RuntimeResourcesRecordNotFoundError, {
139
+ decode: SchemaGetter.transform(() => new RuntimeResourcesRecordNotFoundError({ error: 'Resource not found' })),
140
+ encode: SchemaGetter.transform((error) => ({ error: error.error })),
141
+ }), HttpApiSchema.status(404));
115
142
  const badRequestError = ErrorBodySchema.pipe(Schema.decodeTo(RuntimeResourcesBadRequestError, {
116
143
  decode: SchemaGetter.transform((body) => new RuntimeResourcesBadRequestError(body)),
117
144
  encode: SchemaGetter.transform((error) => ({ error: error.error })),
@@ -124,6 +151,17 @@ const unavailableError = ErrorBodySchema.pipe(Schema.decodeTo(RuntimeResourcesUn
124
151
  decode: SchemaGetter.transform((body) => new RuntimeResourcesUnavailableError(body)),
125
152
  encode: SchemaGetter.transform((error) => ({ error: error.error })),
126
153
  }), HttpApiSchema.status(503));
154
+ const partnerLoginError = PartnerLoginBodySchema.pipe(Schema.decodeTo(RuntimeResourcesPartnerLoginError, {
155
+ decode: SchemaGetter.transform((body) => new RuntimeResourcesPartnerLoginError(body)),
156
+ encode: SchemaGetter.transform(({ error, partnerStatus, oauthError }) => {
157
+ const body = { error };
158
+ if (partnerStatus !== undefined)
159
+ body.partnerStatus = partnerStatus;
160
+ if (oauthError !== undefined)
161
+ body.oauthError = oauthError;
162
+ return body;
163
+ }),
164
+ }), HttpApiSchema.status(502));
127
165
  const runtimeErrors = [
128
166
  unauthorizedError,
129
167
  forbiddenError,
@@ -157,17 +195,13 @@ const ResourcesRuntimeHttpApiGroup = HttpApiGroup.make('resourcesRuntime')
157
195
  success: SelectResourceRuntimeResponseSchema,
158
196
  error: runtimeErrors,
159
197
  }))
160
- .add(HttpApiEndpoint.post('readAccessToken', '/resources/access-token/read', {
198
+ .add(HttpApiEndpoint.post('issueAccessToken', '/resources/access-token', {
161
199
  headers: AuthorizationHeadersSchema,
162
- payload: ResolveKeyInputSchema,
163
- success: ReadAccessTokenOutputSchema,
164
- error: runtimeErrors,
165
- }))
166
- .add(HttpApiEndpoint.post('writeAccessToken', '/resources/access-token/write', {
167
- headers: AuthorizationHeadersSchema,
168
- payload: WriteAccessTokenInputSchema,
169
- success: WriteAccessTokenOutputSchema,
170
- error: runtimeErrors,
200
+ payload: IssueAccessTokenInputSchema,
201
+ success: IssuedAccessTokenSchema,
202
+ // The route answers a missing record with `recordNotFoundError`; `Not found` stays declared so a client reads an
203
+ // API without this route, which answers `{ error: 'Not found' }`.
204
+ error: [...runtimeErrors, recordNotFoundError, partnerLoginError],
171
205
  }))
172
206
  .prefix('/api/v1/runtime')
173
207
  .annotateMerge(OpenApi.annotations({
@@ -1 +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,iBAAiB,CAAC;AAEjG,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,MAAM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AI,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { ANSWER_LENGTH_HEADER, ANSWER_STATUS_HEADER, type AnswerTrailer, type AnswerTrailerError, EARLY_ANSWER_PROTOCOL_VERSION, type InvocationResponsePolicy, MAX_ANSWER_BYTES, MAX_TRAILER_BYTES, RESPONSE_POLICY_HEADER, RUN_OUTCOME_HEADER, TRAILER_LENGTH_BYTES, } from './EarlyAnswer.js';
2
2
  export type { InvocationContext, InvocationTriggerKind } from './Invocation.js';
3
- export { concurrencyProblem, DEFAULT_EARLY_TRIGGER_CONCURRENCY, declaredRunBudgetSeconds, declaredTriggerConcurrency, MAX_TRIGGER_CONCURRENCY, runBudgetProblem, ManifestResource, ResponsePolicy, TriggerKind, TriggerMetadata, WorkflowManifest, WorkflowManifestEndpoint, } from './Manifest.js';
4
- export { ResourcesRuntimeApi, RuntimeResourcesBadRequestError, RuntimeResourcesConflictError, RuntimeResourcesForbiddenError, RuntimeResourcesNotFoundError, RuntimeResourcesUnauthorizedError, RuntimeResourcesUnavailableError, SelectResourceRuntimeInputSchema, SelectResourceRuntimeOutputSchema, } from './RuntimeApi.js';
3
+ export { concurrencyProblem, DEFAULT_EARLY_TRIGGER_CONCURRENCY, declaredRunBudgetSeconds, declaredTriggerConcurrency, MAX_TRIGGER_CONCURRENCY, runBudgetProblem, type BuiltWorkflowManifest, decodeWorkflowSteps, FlowStep, FlowStepKind, ManifestResource, ResponsePolicy, TriggerKind, STEP_DETAIL_RUNS, STEP_EXTRA_FAILED_LINES, STEP_LOG_FIELDS, type StepLogEvent, TriggerMetadata, WorkflowManifest, WorkflowManifestEndpoint, WorkflowSteps, } from './Manifest.js';
4
+ export { IssuedAccessTokenSchema, OAUTH_TOKEN_ERROR_CODES, ResourcesRuntimeApi, RuntimeResourcesBadRequestError, RuntimeResourcesConflictError, RuntimeResourcesForbiddenError, RuntimeResourcesNotFoundError, RuntimeResourcesPartnerLoginError, RuntimeResourcesRecordNotFoundError, RuntimeResourcesUnauthorizedError, RuntimeResourcesUnavailableError, SelectResourceRuntimeInputSchema, SelectResourceRuntimeOutputSchema, } from './RuntimeApi.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,6BAA6B,EAC7B,KAAK,wBAAwB,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,6BAA6B,EAC7B,KAAK,wBAAwB,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,KAAK,YAAY,EACjB,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,mCAAmC,EACnC,iCAAiC,EACjC,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,iBAAiB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { ANSWER_LENGTH_HEADER, ANSWER_STATUS_HEADER, EARLY_ANSWER_PROTOCOL_VERSION, MAX_ANSWER_BYTES, MAX_TRAILER_BYTES, RESPONSE_POLICY_HEADER, RUN_OUTCOME_HEADER, TRAILER_LENGTH_BYTES, } from './EarlyAnswer.js';
2
- export { concurrencyProblem, DEFAULT_EARLY_TRIGGER_CONCURRENCY, declaredRunBudgetSeconds, declaredTriggerConcurrency, MAX_TRIGGER_CONCURRENCY, runBudgetProblem, ManifestResource, ResponsePolicy, TriggerKind, TriggerMetadata, WorkflowManifest, WorkflowManifestEndpoint, } from './Manifest.js';
3
- export { ResourcesRuntimeApi, RuntimeResourcesBadRequestError, RuntimeResourcesConflictError, RuntimeResourcesForbiddenError, RuntimeResourcesNotFoundError, RuntimeResourcesUnauthorizedError, RuntimeResourcesUnavailableError, SelectResourceRuntimeInputSchema, SelectResourceRuntimeOutputSchema, } from './RuntimeApi.js';
2
+ export { concurrencyProblem, DEFAULT_EARLY_TRIGGER_CONCURRENCY, declaredRunBudgetSeconds, declaredTriggerConcurrency, MAX_TRIGGER_CONCURRENCY, runBudgetProblem, decodeWorkflowSteps, FlowStep, FlowStepKind, ManifestResource, ResponsePolicy, TriggerKind, STEP_DETAIL_RUNS, STEP_EXTRA_FAILED_LINES, STEP_LOG_FIELDS, TriggerMetadata, WorkflowManifest, WorkflowManifestEndpoint, WorkflowSteps, } from './Manifest.js';
3
+ export { IssuedAccessTokenSchema, OAUTH_TOKEN_ERROR_CODES, ResourcesRuntimeApi, RuntimeResourcesBadRequestError, RuntimeResourcesConflictError, RuntimeResourcesForbiddenError, RuntimeResourcesNotFoundError, RuntimeResourcesPartnerLoginError, RuntimeResourcesRecordNotFoundError, RuntimeResourcesUnauthorizedError, RuntimeResourcesUnavailableError, SelectResourceRuntimeInputSchema, SelectResourceRuntimeOutputSchema, } from './RuntimeApi.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAGpB,6BAA6B,EAE7B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAGpB,6BAA6B,EAE7B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,kBAAkB,EAClB,iCAAiC,EACjC,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAEhB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EAEf,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,mCAAmC,EACnC,iCAAiC,EACjC,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,GAClC,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Context, Effect, Layer, Schema } from 'effect';
2
+ import { HttpClient } from 'effect/http';
3
+ import type { HttpApiResource } from './HttpApiResource.js';
4
+ import { RuntimeResources } from './RuntimeResources.js';
5
+ declare const UnsupportedHttpApiResourceError_base: Schema.Class<UnsupportedHttpApiResourceError, Schema.TaggedStruct<"UnsupportedHttpApiResourceError", {
6
+ readonly target: Schema.String;
7
+ readonly message: Schema.String;
8
+ }>, import("effect/Cause").YieldableError>;
9
+ /** The record names an authentication or connection setting this client cannot apply; it never sends without it. */
10
+ export declare class UnsupportedHttpApiResourceError extends UnsupportedHttpApiResourceError_base {
11
+ }
12
+ export interface HttpApiClientsService {
13
+ /**
14
+ * An `HttpClient` for the `http_api` record at `resourceKey`. Each request joins the record's `baseUrl`,
15
+ * carries its headers and authentication, and uses its TLS and proxy settings. For `oauth2_client_credentials`
16
+ * and `oauth2_password` the platform issues the token for the record's login identity; the VM reuses it until 30 s
17
+ * before it expires, and after a 401 names the refused token and sends the request once more. An OAuth record
18
+ * with TLS or proxy settings, or a token URL that is not https, fails.
19
+ */
20
+ readonly client: (resourceKey: string, record: HttpApiResource) => Effect.Effect<HttpClient.HttpClient, UnsupportedHttpApiResourceError>;
21
+ }
22
+ declare const HttpApiClients_base: Context.ServiceClass<HttpApiClients, "@temper/workflow/HttpApiClients", HttpApiClientsService>;
23
+ /** Authenticated partner clients built from `http_api` records. Contract: WFSDK-016 in docs/specs/workflow-sdk.md. */
24
+ export declare class HttpApiClients extends HttpApiClients_base {
25
+ static readonly layer: Layer.Layer<HttpApiClients, never, HttpClient.HttpClient | RuntimeResources>;
26
+ }
27
+ /** The layer for a runtime whose `fetch` does (`bun`) or does not apply `tls` and `proxy`; not exported by the package. */
28
+ export declare const httpApiClientsLayer: (bun: boolean) => Layer.Layer<HttpApiClients, never, HttpClient.HttpClient | RuntimeResources>;
29
+ export {};
30
+ //# sourceMappingURL=HttpApiClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpApiClient.d.ts","sourceRoot":"","sources":["../src/HttpApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1E,OAAO,EAAmB,UAAU,EAAsC,MAAM,aAAa,CAAC;AAG9F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAuB,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;;;;;AAE9E,oHAAoH;AACpH,qBAAa,+BAAgC,SAAQ,oCAGpD;CAAG;AA8KJ,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,CACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,eAAe,KACpB,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,+BAA+B,CAAC,CAAC;CAC5E;;AAaD,sHAAsH;AACtH,qBAAa,cAAe,SAAQ,mBAEnC;IAEC,MAAM,CAAC,QAAQ,CAAC,KAAK,+EAAkD;CACxE;AAED,2HAA2H;AAC3H,eAAO,MAAM,mBAAmB,QAAS,OAAO,iFAA4C,CAAC"}
@@ -0,0 +1,142 @@
1
+ import { Context, Effect, Layer, Option, Redacted, Schema } from 'effect';
2
+ import { FetchHttpClient, HttpClient, HttpClientError, HttpClientRequest } from 'effect/http';
3
+ import { makeAccessTokens } from './AccessTokens.js';
4
+ import { bunFetch, deliveryTransport } from './As2Transport.js';
5
+ import { httpApiLoginIdentity } from './OAuthToken.js';
6
+ import { registerSecrets } from './Redaction.js';
7
+ import { RuntimeResources } from './RuntimeResources.js';
8
+ /** The record names an authentication or connection setting this client cannot apply; it never sends without it. */
9
+ export class UnsupportedHttpApiResourceError extends Schema.TaggedError()('UnsupportedHttpApiResourceError', { target: Schema.String, message: Schema.String }) {
10
+ }
11
+ // The AS2 delivery checks name each refusal by code; the client reports the record setting behind it.
12
+ const refusedSetting = (code, bun) => {
13
+ switch (code) {
14
+ case 'TLS_REQUIRES_HTTPS':
15
+ return 'TLS settings on a plain http:// connection';
16
+ case 'INVALID_PROXY_URL':
17
+ return 'a proxy URL that is not http(s)';
18
+ case 'INSECURE_CREDENTIAL_TRANSPORT':
19
+ return 'proxy Basic auth on a plain http:// proxy';
20
+ case 'UNSUPPORTED_TRANSPORT':
21
+ return bun ? 'a proxy client certificate or SNI name' : 'TLS or proxy settings outside the Bun runtime';
22
+ default:
23
+ return `the connection setting ${code}`;
24
+ }
25
+ };
26
+ // The secrets a record's authentication sends; a log line shows a URL query, so each one is masked by value.
27
+ const secretsOf = (auth) => {
28
+ switch (auth.type) {
29
+ case 'basic':
30
+ return [Redacted.value(auth.password)];
31
+ case 'bearer':
32
+ return [Redacted.value(auth.token)];
33
+ case 'api_key':
34
+ return [Redacted.value(auth.apiKey)];
35
+ case 'oauth2_client_credentials':
36
+ case 'oauth2_password': {
37
+ const client = auth.tokenRequest.clientAuthentication;
38
+ const password = auth.type === 'oauth2_password' ? [Redacted.value(auth.password)] : [];
39
+ return client.type === 'none' || client.type === 'private_key_jwt'
40
+ ? password
41
+ : [Redacted.value(client.clientSecret), ...password];
42
+ }
43
+ default:
44
+ return [];
45
+ }
46
+ };
47
+ const clientFor = (base, reader, tokens, bun, resourceKey, record) => Effect.gen(function* () {
48
+ const unsupported = (setting) => new UnsupportedHttpApiResourceError({
49
+ target: `key ${resourceKey}`,
50
+ message: `Resource ${resourceKey} uses ${setting}, which the workflow HTTP client does not support.`,
51
+ });
52
+ const { auth } = record;
53
+ const delivery = deliveryTransport(record, new URL(record.baseUrl), bun);
54
+ if (delivery.kind === 'refused')
55
+ return yield* unsupported(refusedSetting(delivery.code, bun));
56
+ if (auth.type === 'oauth2_jwt_bearer' ||
57
+ auth.type === 'oauth1_tba' ||
58
+ auth.type === 'aws_sigv4' ||
59
+ auth.type === 'unsupported') {
60
+ return yield* unsupported(`auth type ${auth.type === 'unsupported' ? auth.variant : auth.type}`);
61
+ }
62
+ if (auth.type === 'oauth2_client_credentials' || auth.type === 'oauth2_password') {
63
+ // The platform logs in, without the record's TLS and proxy settings, and sends OAuth credentials over https only.
64
+ if (record.tls !== undefined || record.proxy !== undefined) {
65
+ return yield* unsupported('TLS or proxy settings with an OAuth login');
66
+ }
67
+ if (new URL(auth.tokenRequest.tokenUrl).protocol !== 'https:') {
68
+ return yield* unsupported('an OAuth token URL that is not https');
69
+ }
70
+ }
71
+ yield* registerSecrets(secretsOf(auth));
72
+ const transport = delivery.transport;
73
+ // SAFETY: the workflow's fetch layer reads Bun's `tls` and `proxy` from this RequestInit (`OutboundInit`).
74
+ const connection = transport;
75
+ // The record's connection settings, and `own`, join whatever the caller set, such as the redirect mode.
76
+ const execute = (request, own) => Object.keys(transport).length === 0 && own === undefined
77
+ ? base.execute(request)
78
+ : Effect.flatMap(Effect.serviceOption(FetchHttpClient.RequestInit), (init) => Effect.provideService(base.execute(request), FetchHttpClient.RequestInit, {
79
+ ...Option.getOrUndefined(init),
80
+ ...connection,
81
+ ...own,
82
+ }));
83
+ const failure = (request, description) => new HttpClientError.HttpClientError({ reason: new HttpClientError.TransportError({ request, description }) });
84
+ // The platform logs in to the partner; the VM never does. It issues only for the login identity of this record.
85
+ const issue = (identity, request) => (refused) => reader.accessToken(resourceKey, identity, refused).pipe(Effect.mapError((error) => failure(request, error.message)), Effect.flatMap((answer) => answer.expiresIn !== null && answer.expiresIn <= 0
86
+ ? Effect.fail(failure(request, `Resource ${resourceKey}: the platform issued a token with no lifetime left`))
87
+ : Effect.succeed({ token: Redacted.make(answer.token), expiresIn: answer.expiresIn })));
88
+ // The record's headers are defaults: a header the request sets itself wins.
89
+ const prepare = (request) => request.pipe(HttpClientRequest.prependUrl(record.baseUrl), HttpClientRequest.setHeaders(record.headers), HttpClientRequest.setHeaders(request.headers));
90
+ const send = (request) => {
91
+ switch (auth.type) {
92
+ case 'none':
93
+ return execute(request);
94
+ case 'basic':
95
+ return execute(HttpClientRequest.basicAuth(request, auth.username, Redacted.value(auth.password)));
96
+ case 'bearer':
97
+ return execute(HttpClientRequest.bearerToken(request, Redacted.value(auth.token)));
98
+ case 'api_key': {
99
+ const key = Redacted.value(auth.apiKey);
100
+ if (auth.placement === 'authorization_bearer')
101
+ return execute(HttpClientRequest.bearerToken(request, key));
102
+ return execute(auth.placement === 'query'
103
+ ? HttpClientRequest.setUrlParam(request, auth.name, key)
104
+ : HttpClientRequest.setHeader(request, auth.name, key));
105
+ }
106
+ default: {
107
+ const identity = httpApiLoginIdentity({ baseUrl: record.baseUrl, auth });
108
+ const tokenIssue = issue(identity, request);
109
+ // Two records read under one key, such as two tenants, have two identities and never share a token.
110
+ const login = `${resourceKey}\n${identity}`;
111
+ const attempt = (token) => execute(HttpClientRequest.bearerToken(request, Redacted.value(token)));
112
+ // A stream is consumed by the first attempt, so that request is not sent twice.
113
+ const { body } = request;
114
+ const replayable = body._tag !== 'Stream' && !(body._tag === 'Raw' && body.body instanceof ReadableStream);
115
+ // One retry: a second 401 goes to the caller, and the token stays held (WFSDK-016 bounds what follows).
116
+ return Effect.flatMap(tokens.get(login, tokenIssue), (token) => attempt(token).pipe(
117
+ // The workflow client answers a 401 as a response; a client that fails on status reports it as an error.
118
+ Effect.map((response) => ({ refused: response.status === 401, outcome: Effect.succeed(response) })), Effect.catchIf((error) => error.response?.status === 401, (error) => Effect.succeed({ refused: true, outcome: Effect.fail(error) })), Effect.flatMap(({ refused, outcome }) => refused
119
+ ? Effect.andThen(tokens.refuse(login, token), replayable ? Effect.flatMap(tokens.get(login, tokenIssue), attempt) : outcome)
120
+ : outcome)));
121
+ }
122
+ }
123
+ };
124
+ return HttpClient.makeWith((request) => Effect.flatMap(request, send), (request) => Effect.succeed(prepare(request)));
125
+ });
126
+ // One token holder per layer build, so every request the VM serves reuses the tokens it holds.
127
+ const make = (bun) => Effect.gen(function* () {
128
+ const tokens = makeAccessTokens();
129
+ const base = yield* HttpClient.HttpClient;
130
+ const reader = yield* RuntimeResources;
131
+ return {
132
+ client: (resourceKey, record) => clientFor(base, reader, tokens, bun, resourceKey, record),
133
+ };
134
+ });
135
+ /** Authenticated partner clients built from `http_api` records. Contract: WFSDK-016 in docs/specs/workflow-sdk.md. */
136
+ export class HttpApiClients extends Context.Service()('@temper/workflow/HttpApiClients') {
137
+ // Needs `HttpClient` and `RuntimeResources`, which `workflow()` provides.
138
+ static layer = Layer.effect(HttpApiClients, make(bunFetch()));
139
+ }
140
+ /** The layer for a runtime whose `fetch` does (`bun`) or does not apply `tls` and `proxy`; not exported by the package. */
141
+ export const httpApiClientsLayer = (bun) => Layer.effect(HttpApiClients, make(bun));
142
+ //# sourceMappingURL=HttpApiClient.js.map