@sequenceholdings/managed-functions 0.4.5 → 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.
Files changed (71) hide show
  1. package/README.md +147 -12
  2. package/dist/abrigo-contract.d.ts +2 -92
  3. package/dist/abrigo-contract.js +12 -53
  4. package/dist/abrigo-response.d.ts +1 -6
  5. package/dist/abrigo-response.js +3 -25
  6. package/dist/abrigo.d.ts +5 -5
  7. package/dist/abrigo.js +66 -92
  8. package/dist/agent-evidence.d.ts +5 -5
  9. package/dist/agent-evidence.js +58 -48
  10. package/dist/agent-source-evidence-contract.d.ts +2 -1197
  11. package/dist/agent-source-evidence-contract.js +24 -94
  12. package/dist/agents-contract.d.ts +2 -99
  13. package/dist/agents-contract.js +13 -67
  14. package/dist/agents.d.ts +5 -5
  15. package/dist/agents.js +79 -44
  16. package/dist/capabilities.d.ts +1 -1
  17. package/dist/capabilities.js +1 -1
  18. package/dist/config.d.ts +1 -0
  19. package/dist/config.js +4 -1
  20. package/dist/directory-config.d.ts +1 -23
  21. package/dist/directory-config.js +8 -20
  22. package/dist/directory-contract.d.ts +2 -68
  23. package/dist/directory-contract.js +13 -55
  24. package/dist/directory-roster-contract.d.ts +2 -22
  25. package/dist/directory-roster-contract.js +7 -22
  26. package/dist/directory.d.ts +4 -8
  27. package/dist/directory.js +15 -33
  28. package/dist/group-roster-access.d.ts +7 -0
  29. package/dist/group-roster-access.js +8 -0
  30. package/dist/index.d.ts +49 -46
  31. package/dist/index.js +8 -1
  32. package/dist/invocation-client.d.ts +4 -4
  33. package/dist/invocation-client.js +32 -60
  34. package/dist/invocation-contract.d.ts +2 -59
  35. package/dist/invocation-contract.js +10 -61
  36. package/dist/invocation.d.ts +4 -4
  37. package/dist/invocation.js +42 -63
  38. package/dist/lattice-provenance-contract.d.ts +2 -607
  39. package/dist/lattice-provenance-contract.js +14 -154
  40. package/dist/lattice-provenance.d.ts +3 -3
  41. package/dist/lattice-provenance.js +46 -97
  42. package/dist/monitoring-annotations.d.ts +2 -53
  43. package/dist/monitoring-annotations.js +2 -51
  44. package/dist/monitoring-contract.d.ts +5 -460
  45. package/dist/monitoring-contract.js +37 -77
  46. package/dist/monitoring-events.d.ts +2 -252
  47. package/dist/monitoring-events.js +15 -125
  48. package/dist/monitoring.d.ts +3 -3
  49. package/dist/monitoring.js +41 -41
  50. package/dist/orm.d.ts +10 -1
  51. package/dist/orm.js +27 -7
  52. package/dist/platform-client.d.ts +27 -0
  53. package/dist/platform-client.js +79 -0
  54. package/dist/platform-domains.d.ts +1671 -0
  55. package/dist/platform-domains.js +77 -0
  56. package/dist/processes-contract.d.ts +2 -149
  57. package/dist/processes-contract.js +17 -100
  58. package/dist/processes.d.ts +3 -3
  59. package/dist/processes.js +64 -49
  60. package/dist/runtime.cjs +4251 -1666
  61. package/dist/service-directory-roster.d.ts +12 -3
  62. package/dist/service-directory-roster.js +11 -17
  63. package/dist/service-directory.d.ts +4 -8
  64. package/dist/service-directory.js +16 -67
  65. package/dist/storage.d.ts +36 -35
  66. package/dist/storage.js +12 -5
  67. package/dist/workflow-source-contract.d.ts +2 -524
  68. package/dist/workflow-source-contract.js +16 -56
  69. package/dist/workflow-source.d.ts +3 -3
  70. package/dist/workflow-source.js +106 -43
  71. package/package.json +4 -3
@@ -0,0 +1,27 @@
1
+ import { type FunctionPlatformDomains } from "./platform-domains";
2
+ import { type FunctionServiceDirectoryClient } from "./service-directory";
3
+ import { type FunctionServiceProcessesClient } from "./processes";
4
+ import { type FunctionLatticeClient } from "./lattice-provenance";
5
+ import { type FunctionInvocationClient } from "./invocation";
6
+ import type { FunctionInvocationClientOptions } from "./invocation-client";
7
+ export type FunctionPlatformClientOptions = FunctionInvocationClientOptions;
8
+ export interface FunctionPlatformClient extends Omit<FunctionPlatformDomains, "callerDirectory"> {
9
+ directory: FunctionServiceDirectoryClient & {
10
+ caller: FunctionPlatformDomains["callerDirectory"];
11
+ };
12
+ lattice: {
13
+ runs: {
14
+ get: FunctionServiceProcessesClient["getRun"];
15
+ listPage: FunctionServiceProcessesClient["listRunsPage"];
16
+ };
17
+ completedNodes: {
18
+ get: FunctionServiceProcessesClient["getCompletedNode"];
19
+ };
20
+ getCompletedAgentReference: FunctionServiceProcessesClient["getCompletedAgentReference"];
21
+ execution: Omit<FunctionLatticeClient, "getExecutionContext"> & {
22
+ getContext: FunctionLatticeClient["getExecutionContext"];
23
+ };
24
+ };
25
+ invocation: FunctionInvocationClient;
26
+ }
27
+ export declare function createFunctionPlatformClient(options: FunctionPlatformClientOptions): FunctionPlatformClient;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFunctionPlatformClient = createFunctionPlatformClient;
4
+ const platform_domains_1 = require("./platform-domains");
5
+ const browser_1 = require("@sequenceholdings/platform/browser");
6
+ const service_directory_1 = require("./service-directory");
7
+ const directory_contract_1 = require("./directory-contract");
8
+ const processes_1 = require("./processes");
9
+ const agents_contract_1 = require("./agents-contract");
10
+ const lattice_provenance_1 = require("./lattice-provenance");
11
+ const invocation_1 = require("./invocation");
12
+ function lazy(create) {
13
+ let value;
14
+ return () => (value ??= create());
15
+ }
16
+ function createFunctionPlatformClient(options) {
17
+ const baseUrl = (0, browser_1.trustedPlatformOrigin)({ baseUrl: options.baseUrl });
18
+ const allowed = new Set([
19
+ directory_contract_1.FUNCTION_DIRECTORY_TOKEN_HEADER,
20
+ processes_1.FUNCTION_PROCESS_TOKEN_HEADER,
21
+ agents_contract_1.FUNCTION_AGENT_TOKEN_HEADER,
22
+ lattice_provenance_1.FUNCTION_LATTICE_EXECUTION_TOKEN_HEADER,
23
+ invocation_1.FUNCTION_INVOCATION_IDENTITY_TOKEN_HEADER,
24
+ ...platform_domains_1.FUNCTION_PLATFORM_DOMAIN_HEADERS,
25
+ ]);
26
+ const source = options.request.headers;
27
+ const headers = {};
28
+ if (typeof source.get === "function") {
29
+ for (const name of allowed) {
30
+ const value = source.get(name);
31
+ if (value !== null)
32
+ headers[name] = value;
33
+ }
34
+ }
35
+ else {
36
+ for (const [name, value] of Object.entries(source))
37
+ if (allowed.has(name.toLowerCase()))
38
+ headers[name] = Array.isArray(value) ? [...value] : value;
39
+ }
40
+ const context = {
41
+ request: { headers },
42
+ baseUrl,
43
+ fetchImpl: options.fetchImpl,
44
+ };
45
+ const directory = lazy(() => (0, service_directory_1.createFunctionServiceDirectoryClient)(context));
46
+ const processes = lazy(() => (0, processes_1.createFunctionServiceProcessesClient)(context));
47
+ const execution = lazy(() => (0, lattice_provenance_1.createFunctionLatticeClient)(context));
48
+ const invocation = lazy(() => (0, invocation_1.createFunctionInvocationClient)(context));
49
+ const { callerDirectory, ...domains } = (0, platform_domains_1.createFunctionPlatformDomains)(context);
50
+ return {
51
+ ...domains,
52
+ directory: {
53
+ caller: callerDirectory,
54
+ resolve: async (query) => directory().resolve(query),
55
+ listGroupMembers: async (query) => directory().listGroupMembers(query),
56
+ },
57
+ lattice: {
58
+ runs: {
59
+ get: async (query) => processes().getRun(query),
60
+ listPage: async (query) => processes().listRunsPage(query),
61
+ },
62
+ completedNodes: {
63
+ get: async (query) => processes().getCompletedNode(query),
64
+ },
65
+ getCompletedAgentReference: async (query) => processes().getCompletedAgentReference(query),
66
+ execution: {
67
+ getContext: async () => execution().getExecutionContext(),
68
+ getRunCreatorAccess: async () => execution().getRunCreatorAccess(),
69
+ getHumanCompletion: async (query) => execution().getHumanCompletion(query),
70
+ getHumanCompletions: async (query) => execution().getHumanCompletions(query),
71
+ getParallelSnapshot: async (query) => execution().getParallelSnapshot(query),
72
+ },
73
+ },
74
+ invocation: {
75
+ getInvocationContext: async () => invocation().getInvocationContext(),
76
+ getCallerCapabilities: async () => invocation().getCallerCapabilities(),
77
+ },
78
+ };
79
+ }