@sequenceholdings/managed-functions 0.4.4 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -12
- package/dist/abrigo-contract.d.ts +2 -92
- package/dist/abrigo-contract.js +12 -53
- package/dist/abrigo-response.d.ts +1 -6
- package/dist/abrigo-response.js +3 -25
- package/dist/abrigo.d.ts +5 -5
- package/dist/abrigo.js +66 -92
- package/dist/agent-evidence.d.ts +5 -5
- package/dist/agent-evidence.js +58 -48
- package/dist/agent-source-evidence-contract.d.ts +2 -1197
- package/dist/agent-source-evidence-contract.js +24 -94
- package/dist/agents-contract.d.ts +2 -99
- package/dist/agents-contract.js +13 -67
- package/dist/agents.d.ts +5 -5
- package/dist/agents.js +79 -44
- package/dist/capabilities.d.ts +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +4 -1
- package/dist/directory-config.d.ts +1 -23
- package/dist/directory-config.js +8 -20
- package/dist/directory-contract.d.ts +2 -68
- package/dist/directory-contract.js +13 -55
- package/dist/directory-roster-contract.d.ts +2 -22
- package/dist/directory-roster-contract.js +7 -22
- package/dist/directory.d.ts +4 -8
- package/dist/directory.js +15 -33
- package/dist/group-roster-access.d.ts +7 -0
- package/dist/group-roster-access.js +8 -0
- package/dist/index.d.ts +49 -46
- package/dist/index.js +8 -1
- package/dist/invocation-client.d.ts +4 -4
- package/dist/invocation-client.js +32 -60
- package/dist/invocation-contract.d.ts +2 -59
- package/dist/invocation-contract.js +10 -61
- package/dist/invocation.d.ts +4 -4
- package/dist/invocation.js +42 -63
- package/dist/lattice-provenance-contract.d.ts +2 -607
- package/dist/lattice-provenance-contract.js +14 -154
- package/dist/lattice-provenance.d.ts +3 -3
- package/dist/lattice-provenance.js +46 -97
- package/dist/monitoring-annotations.d.ts +2 -53
- package/dist/monitoring-annotations.js +2 -51
- package/dist/monitoring-contract.d.ts +5 -460
- package/dist/monitoring-contract.js +37 -77
- package/dist/monitoring-events.d.ts +2 -252
- package/dist/monitoring-events.js +15 -125
- package/dist/monitoring.d.ts +3 -3
- package/dist/monitoring.js +41 -41
- package/dist/orm.d.ts +10 -1
- package/dist/orm.js +27 -7
- package/dist/platform-client.d.ts +27 -0
- package/dist/platform-client.js +79 -0
- package/dist/platform-domains.d.ts +1671 -0
- package/dist/platform-domains.js +77 -0
- package/dist/processes-contract.d.ts +2 -149
- package/dist/processes-contract.js +17 -100
- package/dist/processes.d.ts +3 -3
- package/dist/processes.js +64 -49
- package/dist/runtime.cjs +4257 -1667
- package/dist/service-directory-roster.d.ts +12 -3
- package/dist/service-directory-roster.js +11 -17
- package/dist/service-directory.d.ts +4 -8
- package/dist/service-directory.js +16 -67
- package/dist/storage.d.ts +70 -35
- package/dist/storage.js +12 -5
- package/dist/workflow-source-contract.d.ts +2 -524
- package/dist/workflow-source-contract.js +16 -56
- package/dist/workflow-source.d.ts +3 -3
- package/dist/workflow-source.js +106 -43
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# `@sequenceholdings/managed-functions`
|
|
2
2
|
|
|
3
|
+
## Unified invocation client (prepared 0.5.1)
|
|
4
|
+
|
|
5
|
+
Create one client inside each invocation. The bootstrap snapshots only delivered
|
|
6
|
+
platform credential headers; it never derives authority from a user payload or
|
|
7
|
+
forwards the incoming bearer. Each domain initializes on its first call, so a
|
|
8
|
+
directory-only invocation works without process or execution credentials.
|
|
9
|
+
Unavailable domains fail closed with their existing typed errors before sending.
|
|
10
|
+
Do not cache this client across invocations.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { createFunctionPlatformClient } from "@sequenceholdings/managed-functions";
|
|
14
|
+
|
|
15
|
+
const platform = createFunctionPlatformClient({ request, baseUrl: platformOrigin });
|
|
16
|
+
const page = await platform.directory.listGroupMembers({ tenant, groupId, limit: 50 });
|
|
17
|
+
const run = await platform.lattice.runs.get({ process, runId });
|
|
18
|
+
const runs = await platform.lattice.runs.listPage({ process, limit: 50 });
|
|
19
|
+
// These require a delivered Lattice execution credential with matching bindings.
|
|
20
|
+
const execution = await platform.lattice.execution.getContext();
|
|
21
|
+
const completion = await platform.lattice.execution.getHumanCompletion({ nodeId: "reminder" });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| Namespace | Authority and behavior |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `directory.resolve/listGroupMembers` | Attached service account's dedicated directory credential; exact lookups and live roster pages |
|
|
27
|
+
| `lattice.runs.get/listPage` | Dedicated process-read credential; manifest-declared processes and current Viewer grants |
|
|
28
|
+
| `lattice.completedNodes.get` | Same process-read credential; exact completed run/process/node selection |
|
|
29
|
+
| `lattice.getCompletedAgentReference` | Both process-read and separate agent-read credentials; bounded recovery reference |
|
|
30
|
+
| `lattice.execution.getContext/getRunCreatorAccess/getHumanCompletion/getHumanCompletions/getParallelSnapshot` | Dedicated execution credential; verified invocation, execution and causal-receipt bindings |
|
|
31
|
+
| `invocation.getInvocationContext/getCallerCapabilities` | Dedicated invocation-identity credential; actual caller and attached account remain separate |
|
|
32
|
+
|
|
33
|
+
Directory and process reads use the shared platform contracts, clients and bounded
|
|
34
|
+
transport. Specialized execution/human-proof and invocation-identity verification
|
|
35
|
+
remain primitive adapters. Each request sends only its own credential; the
|
|
36
|
+
completed-agent reference is the explicit two-credential exception. Local envelope
|
|
37
|
+
and expiry checks never replace Atlas signature, active-invocation and live-grant
|
|
38
|
+
checks. No operator administration or Lattice run-start capability is implied.
|
|
39
|
+
Preserve empty pages with a non-null cursor and continue until null. Process pages
|
|
40
|
+
reject mismatched selectors, duplicate runs, repeated/oversized cursors and excess
|
|
41
|
+
rows; run summaries exclude authored state, outputs, metadata and error details.
|
|
42
|
+
|
|
43
|
+
The same bootstrap covers the existing runtime domains:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const files = platform.storage.service.workspace(workspaceId);
|
|
47
|
+
const members = await platform.directory.caller.resolveMembers({ groupId, subs });
|
|
48
|
+
const response = await platform.agents.getCompletedRun({ agent, runId });
|
|
49
|
+
const source = await platform.workflows.captureCompletedRun({ workflow, runId });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Caller/service Storage are explicit as `platform.storage.caller` and `.service`.
|
|
53
|
+
Agent source/conversation verification lives in `platform.agents.evidence`;
|
|
54
|
+
workflow verification in `platform.workflows.evidence`; monitoring publish/get/
|
|
55
|
+
catalog in `.monitoring`; bounded actual-human Abrigo reads in `.abrigo.read`.
|
|
56
|
+
All legacy factories remain compatibility adapters over shared domain contracts,
|
|
57
|
+
selection/receipt validation and the same bounded HTTP engine. Credentials,
|
|
58
|
+
receiver binding prechecks and runtime provenance bootstrap remain primitive-owned.
|
|
59
|
+
ORM remains a separate primitive. Continue using generated operation clients and
|
|
60
|
+
`@sequenceholdings/managed-functions/orm` for caller/service ORM execution; this
|
|
61
|
+
bootstrap does not expose a data executor.
|
|
62
|
+
|
|
63
|
+
For separately provisioned OAuth process dispatch, use the Platform server
|
|
64
|
+
`createServiceAccountTokenProvider` and `createServicePlatformClient` bootstrap.
|
|
65
|
+
It never uses an invocation credential as process-start authority. Provider
|
|
66
|
+
Slack calls and application-owned business policies remain application-owned.
|
|
67
|
+
|
|
68
|
+
Existing `createFunctionServiceDirectoryClient`,
|
|
69
|
+
`createFunctionServiceProcessesClient`, `createFunctionLatticeClient` and
|
|
70
|
+
`createFunctionInvocationClient` remain supported with the same error identities.
|
|
71
|
+
This release is prepared and unpublished. Consumers pinned to older releases must
|
|
72
|
+
keep their current factories until the coordinated Platform/Storage/primitive releases are
|
|
73
|
+
published; do not update an app's source ahead of its resolvable lockfile.
|
|
74
|
+
|
|
75
|
+
|
|
3
76
|
## Group-member directory lookup (internal rollout)
|
|
4
77
|
|
|
5
78
|
Functions can resolve selected members of existing Atlas groups to active,
|
|
@@ -131,13 +204,15 @@ or server rollout; the registered-operation workflow below remains supported.
|
|
|
131
204
|
|
|
132
205
|
Available in SDK **0.2.0 and later**. Install the SDK in the function package;
|
|
133
206
|
the separate ORM authoring/compiler package is not needed in the deployed
|
|
134
|
-
function.
|
|
135
|
-
|
|
207
|
+
function. From SDK **0.5.0**, call operations by name: the platform resolves the
|
|
208
|
+
name against the namespace's active version on every call, so the function
|
|
209
|
+
keeps working when a schema change rehashes every operation, and it needs no
|
|
210
|
+
copy of `operations.manifest.json`. A namespace re-apply that keeps the
|
|
211
|
+
operation's name and variables needs no function redeploy.
|
|
136
212
|
|
|
137
213
|
```ts
|
|
138
214
|
import type { Request, Response } from '@google-cloud/functions-framework'
|
|
139
215
|
import { createFunctionOrmExecutor, FunctionOrmError } from '@sequenceholdings/managed-functions/orm'
|
|
140
|
-
import manifest from './operations.manifest.json'
|
|
141
216
|
|
|
142
217
|
// Nonsecret configuration: use your deployment's URL, never request input.
|
|
143
218
|
const platformOrigin = 'https://your-environment.example.com'
|
|
@@ -149,7 +224,6 @@ export async function handler(request: Request, response: Response) {
|
|
|
149
224
|
request,
|
|
150
225
|
baseUrl: platformOrigin,
|
|
151
226
|
namespace: 'directory',
|
|
152
|
-
manifest,
|
|
153
227
|
})
|
|
154
228
|
const profile = await orm.execute('GetMyProfile', {})
|
|
155
229
|
response.json(profile)
|
|
@@ -164,11 +238,19 @@ export async function handler(request: Request, response: Response) {
|
|
|
164
238
|
}
|
|
165
239
|
```
|
|
166
240
|
|
|
167
|
-
The manifest declares the
|
|
168
|
-
|
|
241
|
+
The manifest declares the data scope. Acting on behalf of the caller (this
|
|
242
|
+
example) needs no service account. To also act as the function itself
|
|
243
|
+
(`createFunctionServiceOrmExecutor`, system-runner invocations), name a
|
|
244
|
+
`service_account` you hold the actor role on. With a `service_account` named, the account acts in every declared namespace,
|
|
245
|
+
unless you mark specific namespaces with `service: true` (which requires an
|
|
246
|
+
account): then only those. The account's token and namespace floor cover only
|
|
247
|
+
those service-mode namespaces.
|
|
248
|
+
A deploy that needs an account and names none is refused with how to create or
|
|
249
|
+
pick one.
|
|
250
|
+
Replace these illustrative names with your namespace, relations and mutation
|
|
251
|
+
names:
|
|
169
252
|
|
|
170
253
|
```yaml
|
|
171
|
-
service_account: directory-runtime
|
|
172
254
|
capabilities:
|
|
173
255
|
data:
|
|
174
256
|
directory:
|
|
@@ -177,7 +259,7 @@ capabilities:
|
|
|
177
259
|
query: false
|
|
178
260
|
```
|
|
179
261
|
|
|
180
|
-
|
|
262
|
+
Binding a named account needs the deployer's permission to act as it. The human caller
|
|
181
263
|
needs function invocation access plus the namespace runtime grants and operation
|
|
182
264
|
capabilities. `tables` covers read relations, including linked selections and
|
|
183
265
|
policy dependencies; `operations` contains persisted mutation names. These
|
|
@@ -185,9 +267,14 @@ declarations restrict access; they do not grant the caller access. Apply matchin
|
|
|
185
267
|
namespace operations before deploying consumers. Open the Managed Functions guide at `/docs/managed-functions/overview` on
|
|
186
268
|
your administrator-supplied platform URL for provisioning, grants and deployment.
|
|
187
269
|
|
|
188
|
-
`createFunctionOrmExecutor({ request, baseUrl, namespace, manifest
|
|
270
|
+
`createFunctionOrmExecutor({ request, baseUrl, namespace, manifest?, operationSelection?, fetchImpl? })`
|
|
189
271
|
returns an isolated executor with `execute(operationName, variables?)`. It sends
|
|
190
|
-
only
|
|
272
|
+
only an operation name (or hash) and variables, never document text.
|
|
273
|
+
`operationSelection` defaults to `'name'`. A `manifest` is optional: functions
|
|
274
|
+
that already pass one keep working, and it is used only as a one-time fallback
|
|
275
|
+
when the platform predates name selectors. `operationSelection: 'hash'` pins the
|
|
276
|
+
exact generated contract from `manifest` instead, and fails once a schema
|
|
277
|
+
change retires that version. The optional `fetchImpl` is for
|
|
191
278
|
testing or an application-owned transport; it must honor `redirect: 'error'`.
|
|
192
279
|
It never retries requests, follows redirects, reads credentials from a request
|
|
193
280
|
body, substitutes a service token, or configures process-wide ORM state. Reuse
|
|
@@ -838,8 +925,11 @@ do {
|
|
|
838
925
|
|
|
839
926
|
The manifest permits at most 16 concrete group IDs. It does not grant access:
|
|
840
927
|
the attached service account independently needs the tenant directory's Reader
|
|
841
|
-
relation and the group's
|
|
842
|
-
|
|
928
|
+
relation and the group's roster Reader relation. An explicit group Reader grant
|
|
929
|
+
does not confer membership, group management, or access to resources shared with
|
|
930
|
+
that group. Existing members and owners inherit roster Reader, so their existing
|
|
931
|
+
access is preserved. New service accounts should receive Reader, not membership.
|
|
932
|
+
Organization or application administration is not a runtime fallback. The
|
|
843
933
|
actual attached account is checked on every page; the invoking human/system
|
|
844
934
|
identity never supplies its grants. No user-mode directory API gains service mode.
|
|
845
935
|
|
|
@@ -854,3 +944,48 @@ Pagination scans membership positions, so a page may have zero members and a
|
|
|
854
944
|
non-null `nextCursor`; continue until the cursor is null. Cursors expire after an
|
|
855
945
|
hour and bind the tenant, group, function, immutable version and service account.
|
|
856
946
|
They cannot be moved to another read scope. Access can be revoked between pages.
|
|
947
|
+
|
|
948
|
+
Platform operators manage roster Reader grants separately from membership. Only
|
|
949
|
+
verified human group owners or Sequence operators may grant/revoke them, and
|
|
950
|
+
granting a service account additionally requires Actor on that account. Public
|
|
951
|
+
and group-principal roster grants are not supported. The shared FGA model and
|
|
952
|
+
Atlas host must both contain roster Reader support before granting it; older
|
|
953
|
+
hosts still require membership. During host-first rollout, the new host checks
|
|
954
|
+
existing Member access first and checks Reader only after a Member denial, so
|
|
955
|
+
existing members remain usable while the model and client pins converge. Errors
|
|
956
|
+
in authorization still fail closed. This is a host permission change, not a new SDK
|
|
957
|
+
method or a reason to add a machine to a staff group.
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
### Provisioning group roster access
|
|
961
|
+
|
|
962
|
+
Platform SDK **0.1.0**, Managed Functions **0.5.1** and Studio CLI **0.8.2**
|
|
963
|
+
prepare typed roster provisioning; these packages await separate publication.
|
|
964
|
+
The host's existing group roster governance and Reader model must be available.
|
|
965
|
+
An upgrade alone grants nothing.
|
|
966
|
+
|
|
967
|
+
```sh
|
|
968
|
+
seq-studio access grant group <group-id> --key roster-reader --principal-type user --principal-id 'service-account|<account-id>' -e <env>
|
|
969
|
+
seq-studio access revoke group <group-id> --key roster-reader --principal-type user --principal-id 'service-account|<account-id>' -e <env>
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
The CLI uses `createOperatorPlatformClient` from `@sequenceholdings/platform/server`
|
|
973
|
+
with its current control-plane login. `groups.rosterAccess.grant` and `revoke`
|
|
974
|
+
send atomic deltas through the existing permission surface. They validate mutation
|
|
975
|
+
counts, then read the complete direct-grant receipt and confirm the exact target
|
|
976
|
+
and direct Reader state. They never replace other principals or remove membership.
|
|
977
|
+
A failed or concurrent confirmation is surfaced without replaying the mutation.
|
|
978
|
+
|
|
979
|
+
The shared transport owns origin validation, redirect refusal, deadlines, bounded
|
|
980
|
+
responses and structured errors; the CLI supplies only its current session and
|
|
981
|
+
host-scoped edge credentials. Atlas requires a verified human group owner or
|
|
982
|
+
platform operator, plus service-account Actor standing for grants, and revalidates
|
|
983
|
+
the target identity after writing. Revocation does not require Actor. An unavailable
|
|
984
|
+
or unauthorized group fails closed. Directory Reader and the exact declared roster
|
|
985
|
+
allowlist remain separate runtime gates.
|
|
986
|
+
|
|
987
|
+
`createFunctionServiceDirectoryClient` retains its signature and dedicated header,
|
|
988
|
+
but delegates to the shared directory client through an invocation transport.
|
|
989
|
+
The legacy administrative export accepts a typed operator transport. No invocation
|
|
990
|
+
credential becomes a governance credential and no SDK HTTP route becomes a direct
|
|
991
|
+
public contract. See [the shared SDK architecture](../platform/README.md).
|
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare const FUNCTION_ABRIGO_READ_PATH = "/api/managed-functions/abrigo/read";
|
|
4
|
-
export declare const FUNCTION_ABRIGO_READ_AUDIENCE = "atlas-managed-function-abrigo-read";
|
|
5
|
-
export declare const ABRIGO_READ_MAX_RESPONSE_BYTES: number;
|
|
6
|
-
export declare const ABRIGO_READ_TIMEOUT_MS = 30000;
|
|
7
|
-
export declare const abrigoReadOperationSchema: z.ZodEnum<{
|
|
8
|
-
workflow: "workflow";
|
|
9
|
-
entity: "entity";
|
|
10
|
-
entityGroupSummary: "entityGroupSummary";
|
|
11
|
-
loanRoles: "loanRoles";
|
|
12
|
-
relatedLoanRoles: "relatedLoanRoles";
|
|
13
|
-
workflowLoanMappings: "workflowLoanMappings";
|
|
14
|
-
workflowDocuments: "workflowDocuments";
|
|
15
|
-
customerDocuments: "customerDocuments";
|
|
16
|
-
reviewWorkflow: "reviewWorkflow";
|
|
17
|
-
reviewWorkflowDocuments: "reviewWorkflowDocuments";
|
|
18
|
-
reviewWorkflowCustomerDocuments: "reviewWorkflowCustomerDocuments";
|
|
19
|
-
}>;
|
|
20
|
-
export type FunctionAbrigoReadOperation = z.infer<typeof abrigoReadOperationSchema>;
|
|
21
|
-
export type AbrigoReadOperation = FunctionAbrigoReadOperation;
|
|
22
|
-
export declare const functionAbrigoReadRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
23
|
-
operation: z.ZodLiteral<"workflow">;
|
|
24
|
-
workflowId: z.ZodNumber;
|
|
25
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
-
operation: z.ZodLiteral<"entity">;
|
|
27
|
-
entityId: z.ZodNumber;
|
|
28
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
29
|
-
operation: z.ZodLiteral<"entityGroupSummary">;
|
|
30
|
-
entityId: z.ZodNumber;
|
|
31
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
32
|
-
operation: z.ZodLiteral<"loanRoles">;
|
|
33
|
-
proposedLoanId: z.ZodNumber;
|
|
34
|
-
page: z.ZodNumber;
|
|
35
|
-
perPage: z.ZodNumber;
|
|
36
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
37
|
-
operation: z.ZodLiteral<"relatedLoanRoles">;
|
|
38
|
-
proposedLoanId: z.ZodNumber;
|
|
39
|
-
page: z.ZodNumber;
|
|
40
|
-
perPage: z.ZodNumber;
|
|
41
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
42
|
-
operation: z.ZodLiteral<"workflowLoanMappings">;
|
|
43
|
-
workflowId: z.ZodNumber;
|
|
44
|
-
page: z.ZodNumber;
|
|
45
|
-
perPage: z.ZodNumber;
|
|
46
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
-
operation: z.ZodLiteral<"workflowDocuments">;
|
|
48
|
-
workflowId: z.ZodNumber;
|
|
49
|
-
page: z.ZodNumber;
|
|
50
|
-
perPage: z.ZodNumber;
|
|
51
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
52
|
-
operation: z.ZodLiteral<"customerDocuments">;
|
|
53
|
-
customerId: z.ZodNumber;
|
|
54
|
-
page: z.ZodNumber;
|
|
55
|
-
perPage: z.ZodNumber;
|
|
56
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
57
|
-
operation: z.ZodLiteral<"reviewWorkflow">;
|
|
58
|
-
workflowId: z.ZodNumber;
|
|
59
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
-
operation: z.ZodLiteral<"reviewWorkflowDocuments">;
|
|
61
|
-
workflowId: z.ZodNumber;
|
|
62
|
-
page: z.ZodNumber;
|
|
63
|
-
perPage: z.ZodNumber;
|
|
64
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
65
|
-
operation: z.ZodLiteral<"reviewWorkflowCustomerDocuments">;
|
|
66
|
-
workflowId: z.ZodNumber;
|
|
67
|
-
page: z.ZodNumber;
|
|
68
|
-
perPage: z.ZodNumber;
|
|
69
|
-
}, z.core.$strict>], "operation">;
|
|
70
|
-
export type FunctionAbrigoReadRequest = z.infer<typeof functionAbrigoReadRequestSchema>;
|
|
71
|
-
export declare const functionAbrigoReadScopesSchema: z.ZodObject<{
|
|
72
|
-
read: z.ZodArray<z.ZodEnum<{
|
|
73
|
-
workflow: "workflow";
|
|
74
|
-
entity: "entity";
|
|
75
|
-
entityGroupSummary: "entityGroupSummary";
|
|
76
|
-
loanRoles: "loanRoles";
|
|
77
|
-
relatedLoanRoles: "relatedLoanRoles";
|
|
78
|
-
workflowLoanMappings: "workflowLoanMappings";
|
|
79
|
-
workflowDocuments: "workflowDocuments";
|
|
80
|
-
customerDocuments: "customerDocuments";
|
|
81
|
-
reviewWorkflow: "reviewWorkflow";
|
|
82
|
-
reviewWorkflowDocuments: "reviewWorkflowDocuments";
|
|
83
|
-
reviewWorkflowCustomerDocuments: "reviewWorkflowCustomerDocuments";
|
|
84
|
-
}>>;
|
|
85
|
-
}, z.core.$strict>;
|
|
86
|
-
export declare function readFunctionAbrigoReadScopes(manifest: unknown): FunctionAbrigoReadOperation[];
|
|
87
|
-
export declare class FunctionAbrigoReadError extends Error {
|
|
88
|
-
readonly status: number;
|
|
89
|
-
readonly code: string;
|
|
90
|
-
readonly name = "FunctionAbrigoReadError";
|
|
91
|
-
constructor(status: number, code: string, message: string);
|
|
92
|
-
}
|
|
1
|
+
export { FUNCTION_ABRIGO_READ_TOKEN_HEADER, FUNCTION_ABRIGO_READ_PATH, FUNCTION_ABRIGO_READ_AUDIENCE, ABRIGO_READ_MAX_RESPONSE_BYTES, ABRIGO_READ_TIMEOUT_MS, abrigoReadOperationSchema, functionAbrigoReadRequestSchema, functionAbrigoReadScopesSchema, readFunctionAbrigoReadScopes, FunctionAbrigoReadError, } from "@sequenceholdings/platform/contracts";
|
|
2
|
+
export type { FunctionAbrigoReadOperation, AbrigoReadOperation, FunctionAbrigoReadRequest, } from "@sequenceholdings/platform/contracts";
|
package/dist/abrigo-contract.js
CHANGED
|
@@ -1,55 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FunctionAbrigoReadError = exports.functionAbrigoReadScopesSchema = exports.functionAbrigoReadRequestSchema = exports.abrigoReadOperationSchema = exports.ABRIGO_READ_TIMEOUT_MS = exports.ABRIGO_READ_MAX_RESPONSE_BYTES = exports.FUNCTION_ABRIGO_READ_AUDIENCE = exports.FUNCTION_ABRIGO_READ_PATH = exports.FUNCTION_ABRIGO_READ_TOKEN_HEADER = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports
|
|
9
|
-
exports
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
]);
|
|
16
|
-
const id = zod_1.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
17
|
-
const page = zod_1.z.number().int().min(1).max(100);
|
|
18
|
-
const perPage = zod_1.z.number().int().min(1).max(500);
|
|
19
|
-
exports.functionAbrigoReadRequestSchema = zod_1.z.discriminatedUnion('operation', [
|
|
20
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('workflow'), workflowId: id }),
|
|
21
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('entity'), entityId: id }),
|
|
22
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('entityGroupSummary'), entityId: id }),
|
|
23
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('loanRoles'), proposedLoanId: id, page, perPage }),
|
|
24
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('relatedLoanRoles'), proposedLoanId: id, page, perPage }),
|
|
25
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('workflowLoanMappings'), workflowId: id, page, perPage }),
|
|
26
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('workflowDocuments'), workflowId: id, page, perPage }),
|
|
27
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('customerDocuments'), customerId: id, page, perPage }),
|
|
28
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('reviewWorkflow'), workflowId: id }),
|
|
29
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('reviewWorkflowDocuments'), workflowId: id, page, perPage }),
|
|
30
|
-
zod_1.z.strictObject({ operation: zod_1.z.literal('reviewWorkflowCustomerDocuments'), workflowId: id, page, perPage }),
|
|
31
|
-
]);
|
|
32
|
-
exports.functionAbrigoReadScopesSchema = zod_1.z.strictObject({
|
|
33
|
-
read: zod_1.z.array(exports.abrigoReadOperationSchema).min(1).max(11)
|
|
34
|
-
.refine((operations) => new Set(operations).size === operations.length, 'Abrigo read operations must be distinct'),
|
|
35
|
-
});
|
|
36
|
-
function readFunctionAbrigoReadScopes(manifest) {
|
|
37
|
-
if (typeof manifest !== 'object' || manifest === null)
|
|
38
|
-
return [];
|
|
39
|
-
const capabilities = Reflect.get(manifest, 'capabilities');
|
|
40
|
-
if (typeof capabilities !== 'object' || capabilities === null)
|
|
41
|
-
return [];
|
|
42
|
-
const abrigo = Reflect.get(capabilities, 'abrigo');
|
|
43
|
-
return abrigo === undefined ? [] : exports.functionAbrigoReadScopesSchema.parse(abrigo).read;
|
|
44
|
-
}
|
|
45
|
-
class FunctionAbrigoReadError extends Error {
|
|
46
|
-
status;
|
|
47
|
-
code;
|
|
48
|
-
name = 'FunctionAbrigoReadError';
|
|
49
|
-
constructor(status, code, message) {
|
|
50
|
-
super(message);
|
|
51
|
-
this.status = status;
|
|
52
|
-
this.code = code;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.FunctionAbrigoReadError = FunctionAbrigoReadError;
|
|
3
|
+
exports.FunctionAbrigoReadError = exports.readFunctionAbrigoReadScopes = exports.functionAbrigoReadScopesSchema = exports.functionAbrigoReadRequestSchema = exports.abrigoReadOperationSchema = exports.ABRIGO_READ_TIMEOUT_MS = exports.ABRIGO_READ_MAX_RESPONSE_BYTES = exports.FUNCTION_ABRIGO_READ_AUDIENCE = exports.FUNCTION_ABRIGO_READ_PATH = exports.FUNCTION_ABRIGO_READ_TOKEN_HEADER = void 0;
|
|
4
|
+
var contracts_1 = require("@sequenceholdings/platform/contracts");
|
|
5
|
+
Object.defineProperty(exports, "FUNCTION_ABRIGO_READ_TOKEN_HEADER", { enumerable: true, get: function () { return contracts_1.FUNCTION_ABRIGO_READ_TOKEN_HEADER; } });
|
|
6
|
+
Object.defineProperty(exports, "FUNCTION_ABRIGO_READ_PATH", { enumerable: true, get: function () { return contracts_1.FUNCTION_ABRIGO_READ_PATH; } });
|
|
7
|
+
Object.defineProperty(exports, "FUNCTION_ABRIGO_READ_AUDIENCE", { enumerable: true, get: function () { return contracts_1.FUNCTION_ABRIGO_READ_AUDIENCE; } });
|
|
8
|
+
Object.defineProperty(exports, "ABRIGO_READ_MAX_RESPONSE_BYTES", { enumerable: true, get: function () { return contracts_1.ABRIGO_READ_MAX_RESPONSE_BYTES; } });
|
|
9
|
+
Object.defineProperty(exports, "ABRIGO_READ_TIMEOUT_MS", { enumerable: true, get: function () { return contracts_1.ABRIGO_READ_TIMEOUT_MS; } });
|
|
10
|
+
Object.defineProperty(exports, "abrigoReadOperationSchema", { enumerable: true, get: function () { return contracts_1.abrigoReadOperationSchema; } });
|
|
11
|
+
Object.defineProperty(exports, "functionAbrigoReadRequestSchema", { enumerable: true, get: function () { return contracts_1.functionAbrigoReadRequestSchema; } });
|
|
12
|
+
Object.defineProperty(exports, "functionAbrigoReadScopesSchema", { enumerable: true, get: function () { return contracts_1.functionAbrigoReadScopesSchema; } });
|
|
13
|
+
Object.defineProperty(exports, "readFunctionAbrigoReadScopes", { enumerable: true, get: function () { return contracts_1.readFunctionAbrigoReadScopes; } });
|
|
14
|
+
Object.defineProperty(exports, "FunctionAbrigoReadError", { enumerable: true, get: function () { return contracts_1.FunctionAbrigoReadError; } });
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type FunctionAbrigoReadRequest } from './abrigo-contract';
|
|
3
|
-
export declare function validateAbrigoReviewResponse({ query, body }: {
|
|
4
|
-
query: FunctionAbrigoReadRequest;
|
|
5
|
-
body: JsonValue;
|
|
6
|
-
}): void;
|
|
1
|
+
export { validateAbrigoReviewResponse } from "@sequenceholdings/platform/adapters";
|
package/dist/abrigo-response.js
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateAbrigoReviewResponse =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const positiveId = zod_1.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
7
|
-
const reviewWorkflowSchema = zod_1.z.strictObject({ id: positiveId, customerId: positiveId });
|
|
8
|
-
const reviewDocumentsSchema = zod_1.z.object({ items: zod_1.z.array(zod_1.z.unknown()).max(500) }).passthrough();
|
|
9
|
-
const reviewCustomerDocumentsSchema = reviewDocumentsSchema.extend({ workflowId: positiveId, customerId: positiveId });
|
|
10
|
-
function validateAbrigoReviewResponse({ query, body }) {
|
|
11
|
-
const invalid = () => new abrigo_contract_1.FunctionAbrigoReadError(502, 'malformed_response', 'Atlas returned an invalid workflow document review response');
|
|
12
|
-
if (query.operation === 'reviewWorkflow') {
|
|
13
|
-
const parsed = reviewWorkflowSchema.safeParse(body);
|
|
14
|
-
if (!parsed.success || parsed.data.id !== query.workflowId)
|
|
15
|
-
throw invalid();
|
|
16
|
-
}
|
|
17
|
-
else if (query.operation === 'reviewWorkflowDocuments') {
|
|
18
|
-
const parsed = reviewDocumentsSchema.safeParse(body);
|
|
19
|
-
if (!parsed.success || parsed.data.items.length > query.perPage)
|
|
20
|
-
throw invalid();
|
|
21
|
-
}
|
|
22
|
-
else if (query.operation === 'reviewWorkflowCustomerDocuments') {
|
|
23
|
-
const parsed = reviewCustomerDocumentsSchema.safeParse(body);
|
|
24
|
-
if (!parsed.success || parsed.data.workflowId !== query.workflowId || parsed.data.items.length > query.perPage)
|
|
25
|
-
throw invalid();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
3
|
+
exports.validateAbrigoReviewResponse = void 0;
|
|
4
|
+
var adapters_1 = require("@sequenceholdings/platform/adapters");
|
|
5
|
+
Object.defineProperty(exports, "validateAbrigoReviewResponse", { enumerable: true, get: function () { return adapters_1.validateAbrigoReviewResponse; } });
|
package/dist/abrigo.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { JsonValue } from
|
|
2
|
-
import { type FunctionAbrigoReadRequest } from
|
|
3
|
-
export * from
|
|
1
|
+
import type { JsonValue } from "./cache";
|
|
2
|
+
import { type FunctionAbrigoReadRequest } from "./abrigo-contract";
|
|
3
|
+
export * from "./abrigo-contract";
|
|
4
4
|
export interface FunctionCallerAbrigoOptions {
|
|
5
5
|
request: {
|
|
6
|
-
headers: Pick<Headers,
|
|
6
|
+
headers: Pick<Headers, "get"> | Readonly<Record<string, string | readonly string[] | undefined>>;
|
|
7
7
|
};
|
|
8
8
|
baseUrl: string;
|
|
9
9
|
fetchImpl?: typeof globalThis.fetch;
|
|
@@ -11,4 +11,4 @@ export interface FunctionCallerAbrigoOptions {
|
|
|
11
11
|
export interface FunctionCallerAbrigoClient {
|
|
12
12
|
read(query: FunctionAbrigoReadRequest): Promise<JsonValue>;
|
|
13
13
|
}
|
|
14
|
-
export declare function createFunctionCallerAbrigoClient({ request, baseUrl, fetchImpl }: FunctionCallerAbrigoOptions): FunctionCallerAbrigoClient;
|
|
14
|
+
export declare function createFunctionCallerAbrigoClient({ request, baseUrl, fetchImpl, }: FunctionCallerAbrigoOptions): FunctionCallerAbrigoClient;
|