@sequenceholdings/managed-functions 0.4.0 → 0.4.2
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 +444 -2
- package/dist/abrigo-contract.d.ts +92 -0
- package/dist/abrigo-contract.js +55 -0
- package/dist/abrigo-response.d.ts +6 -0
- package/dist/abrigo-response.js +27 -0
- package/dist/abrigo.d.ts +14 -0
- package/dist/abrigo.js +150 -0
- package/dist/agent-evidence.d.ts +9 -0
- package/dist/agent-evidence.js +84 -0
- package/dist/agent-source-evidence-contract.d.ts +1197 -0
- package/dist/agent-source-evidence-contract.js +96 -0
- package/dist/agents-contract.d.ts +99 -0
- package/dist/agents-contract.js +69 -0
- package/dist/agents.d.ts +15 -0
- package/dist/agents.js +121 -0
- package/dist/capabilities.d.ts +165 -0
- package/dist/capabilities.js +61 -1
- package/dist/config.d.ts +18 -2
- package/dist/config.js +62 -1
- package/dist/deployed-policy.js +102 -0
- package/dist/directory-config.d.ts +23 -0
- package/dist/directory-config.js +22 -0
- package/dist/directory-contract.d.ts +68 -0
- package/dist/directory-contract.js +57 -0
- package/dist/directory-manifest.d.ts +5 -0
- package/dist/directory-manifest.js +10 -0
- package/dist/directory.d.ts +15 -0
- package/dist/directory.js +65 -0
- package/dist/http-tracing.js +3 -0
- package/dist/immutable-release-contract.d.ts +3 -0
- package/dist/immutable-release-contract.js +12 -0
- package/dist/index.d.ts +40 -1
- package/dist/index.js +75 -1
- package/dist/invocation-client.d.ts +45 -0
- package/dist/invocation-client.js +90 -0
- package/dist/invocation-contract.d.ts +36 -0
- package/dist/invocation-contract.js +48 -0
- package/dist/invocation.d.ts +8 -0
- package/dist/invocation.js +134 -0
- package/dist/lattice-capability.d.ts +5 -0
- package/dist/lattice-capability.js +16 -0
- package/dist/lattice-provenance-contract.d.ts +519 -0
- package/dist/lattice-provenance-contract.js +148 -0
- package/dist/lattice-provenance.d.ts +16 -0
- package/dist/lattice-provenance.js +167 -0
- package/dist/monitoring-annotations.d.ts +53 -0
- package/dist/monitoring-annotations.js +54 -0
- package/dist/monitoring-contract.d.ts +463 -0
- package/dist/monitoring-contract.js +89 -0
- package/dist/monitoring-events.d.ts +257 -0
- package/dist/monitoring-events.js +136 -0
- package/dist/monitoring.d.ts +14 -0
- package/dist/monitoring.js +78 -0
- package/dist/orm-contract.d.ts +1 -0
- package/dist/orm-contract.js +4 -0
- package/dist/orm.d.ts +19 -3
- package/dist/orm.js +93 -13
- package/dist/preflight-abrigo.d.ts +10 -0
- package/dist/preflight-abrigo.js +26 -0
- package/dist/preflight-agents.d.ts +10 -0
- package/dist/preflight-agents.js +51 -0
- package/dist/preflight-directory.d.ts +10 -0
- package/dist/preflight-directory.js +36 -0
- package/dist/preflight-immutable-release.d.ts +10 -0
- package/dist/preflight-immutable-release.js +34 -0
- package/dist/preflight-invocation.d.ts +10 -0
- package/dist/preflight-invocation.js +40 -0
- package/dist/preflight-lattice.d.ts +10 -0
- package/dist/preflight-lattice.js +40 -0
- package/dist/preflight-monitoring.d.ts +10 -0
- package/dist/preflight-monitoring.js +46 -0
- package/dist/preflight-service-directory.d.ts +10 -0
- package/dist/preflight-service-directory.js +26 -0
- package/dist/preflight-workflows.d.ts +10 -0
- package/dist/preflight-workflows.js +38 -0
- package/dist/preflight.js +50 -2
- package/dist/processes-contract.d.ts +20 -0
- package/dist/processes-contract.js +8 -1
- package/dist/processes.d.ts +4 -8
- package/dist/processes.js +52 -83
- package/dist/runtime.cjs +3387 -259
- package/dist/sdk-range.d.ts +1 -0
- package/dist/sdk-range.js +25 -0
- package/dist/service-directory.d.ts +12 -0
- package/dist/service-directory.js +72 -0
- package/dist/workflow-scopes-contract.d.ts +8 -0
- package/dist/workflow-scopes-contract.js +29 -0
- package/dist/workflow-source-contract.d.ts +524 -0
- package/dist/workflow-source-contract.js +59 -0
- package/dist/workflow-source.d.ts +12 -0
- package/dist/workflow-source.js +93 -0
- package/package.json +2 -2
package/dist/capabilities.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.MANAGED_FUNCTION_CAPABILITIES = exports.MANAGED_FUNCTION_SDK_PACKAGE = e
|
|
|
4
4
|
exports.versionIsOlder = versionIsOlder;
|
|
5
5
|
exports.sdkVersionLowerBound = sdkVersionLowerBound;
|
|
6
6
|
exports.sdkVersionFromPackageJson = sdkVersionFromPackageJson;
|
|
7
|
+
exports.sdkSpecFromPackageJson = sdkSpecFromPackageJson;
|
|
7
8
|
exports.isPostgresEgress = isPostgresEgress;
|
|
8
9
|
exports.formatValidationDetail = formatValidationDetail;
|
|
9
10
|
const sdk_range_1 = require("./sdk-range");
|
|
@@ -15,6 +16,61 @@ exports.MANAGED_FUNCTION_CAPABILITIES = {
|
|
|
15
16
|
sdk: { package: exports.MANAGED_FUNCTION_SDK_PACKAGE, min: '0.3.0' },
|
|
16
17
|
},
|
|
17
18
|
features: {
|
|
19
|
+
directory_members: {
|
|
20
|
+
field: 'capabilities.directory.groups', supported: true,
|
|
21
|
+
limit: '1 to 16 concrete groups; resolve 1 to 50 selected active members per call',
|
|
22
|
+
min_cli: '0.5.2', min_sdk: '0.4.1',
|
|
23
|
+
},
|
|
24
|
+
abrigo_read: {
|
|
25
|
+
field: 'capabilities.abrigo.read', supported: true,
|
|
26
|
+
limit: 'eleven fixed human reads: eight integration reads and three workflow-scoped document-review reads; pages 1 to 100 with 1 to 500 rows; 1 MiB JSON responses',
|
|
27
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
28
|
+
},
|
|
29
|
+
immutable_release: {
|
|
30
|
+
field: 'function.immutable_release', supported: true,
|
|
31
|
+
limit: 'a fresh function identity whose runtime cannot be redeployed after first activation',
|
|
32
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
33
|
+
},
|
|
34
|
+
invocation_identity: {
|
|
35
|
+
field: 'capabilities.invocation.identity', supported: true,
|
|
36
|
+
limit: 'verified receiver and actual caller for this exact active invocation only',
|
|
37
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
38
|
+
},
|
|
39
|
+
directory_resolve: {
|
|
40
|
+
field: 'capabilities.directory.resolve', supported: true,
|
|
41
|
+
limit: '1 to 16 exact tenant scopes; at most 50 exact active human principal lookups',
|
|
42
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
43
|
+
},
|
|
44
|
+
lattice_context: {
|
|
45
|
+
field: 'capabilities.lattice.context', supported: true,
|
|
46
|
+
limit: 'verified context and causal human completion for the receiving Lattice step only',
|
|
47
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
48
|
+
},
|
|
49
|
+
agents_read: {
|
|
50
|
+
field: 'capabilities.agents.read', supported: true,
|
|
51
|
+
limit: '1 to 64 exact agent ids; completed owned or verified upstream responses only',
|
|
52
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
53
|
+
},
|
|
54
|
+
agents_evidence_verify: {
|
|
55
|
+
field: 'capabilities.agents.evidence', supported: true,
|
|
56
|
+
limit: '1 to 64 exact agent ids; verify bounded supplied historical source evidence only',
|
|
57
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
58
|
+
},
|
|
59
|
+
workflows_read: {
|
|
60
|
+
field: 'capabilities.workflows.read', supported: true,
|
|
61
|
+
limit: '1 to 64 exact workflow ids; completed owned root outputs only',
|
|
62
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
63
|
+
},
|
|
64
|
+
workflows_evidence_verify: {
|
|
65
|
+
field: 'capabilities.workflows.evidence', supported: true,
|
|
66
|
+
limit: '1 to 64 exact workflow ids; verify bounded supplied historical root-output evidence only',
|
|
67
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
68
|
+
},
|
|
69
|
+
monitoring_deliveries: {
|
|
70
|
+
field: 'capabilities.monitoring.producers', supported: true,
|
|
71
|
+
limit: '1 to 16 producer namespaces; immutable publish and receipt lookup',
|
|
72
|
+
min_cli: '0.5.5', min_sdk: '0.4.2',
|
|
73
|
+
},
|
|
18
74
|
processes_read: {
|
|
19
75
|
field: 'capabilities.processes.read',
|
|
20
76
|
supported: true,
|
|
@@ -69,6 +125,9 @@ function sdkVersionLowerBound(spec) {
|
|
|
69
125
|
return (0, sdk_range_1.concreteOrStaleSdkSpec)(spec, minimum);
|
|
70
126
|
}
|
|
71
127
|
function sdkVersionFromPackageJson(raw) {
|
|
128
|
+
return sdkVersionLowerBound(sdkSpecFromPackageJson(raw) ?? undefined);
|
|
129
|
+
}
|
|
130
|
+
function sdkSpecFromPackageJson(raw) {
|
|
72
131
|
let parsed;
|
|
73
132
|
try {
|
|
74
133
|
parsed = JSON.parse(raw);
|
|
@@ -80,7 +139,8 @@ function sdkVersionFromPackageJson(raw) {
|
|
|
80
139
|
return null;
|
|
81
140
|
const dependencies = Reflect.get(parsed, 'dependencies');
|
|
82
141
|
const devDependencies = Reflect.get(parsed, 'devDependencies');
|
|
83
|
-
|
|
142
|
+
const spec = dependencySpec(dependencies) ?? dependencySpec(devDependencies);
|
|
143
|
+
return spec?.trim() || null;
|
|
84
144
|
}
|
|
85
145
|
function dependencySpec(block) {
|
|
86
146
|
if (!block || typeof block !== 'object')
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DIRECTORY_TOKEN_HEADER, directoryGroupIdSchema, directoryScopesSchema, directoryMembersInput, directoryMembersResponse, readDirectoryGroups } from './directory-config';
|
|
2
|
+
export { functionDirectoryManifestSchema } from './directory-manifest';
|
|
3
|
+
export { functionLatticeContextCapabilitySchema, readFunctionLatticeContextCapability } from './lattice-capability';
|
|
4
|
+
export * from './invocation-contract';
|
|
5
|
+
export { FUNCTION_PROCESS_TOKEN_HEADER, FUNCTION_PROCESS_READ_PATH, functionProcessReadScopesSchema, readFunctionProcessScopes, functionProcessReadRequestSchema, functionProcessRunSummarySchema, functionProcessCompletedAgentReferenceSchema, functionProcessCompletedAgentReferenceQuerySchema } from './processes-contract';
|
|
6
|
+
export { FUNCTION_AGENT_TOKEN_HEADER, FUNCTION_AGENT_READ_PATH, functionAgentReadScopesSchema, readFunctionAgentScopes, functionAgentReadRequestSchema, functionAgentCompletedRunQuerySchema, functionAgentCompletedRunSchema } from './agents-contract';
|
|
7
|
+
export * from './agent-source-evidence-contract';
|
|
8
|
+
export * from './workflow-source-contract';
|
|
9
|
+
export { functionWorkflowScopesSchema, readFunctionWorkflowScopes, readFunctionWorkflowEvidenceScopes } from './workflow-scopes-contract';
|
|
10
|
+
export type { FunctionWorkflowScopes } from './workflow-scopes-contract';
|
|
11
|
+
export * from './monitoring-events';
|
|
12
|
+
export * from './monitoring-contract';
|
|
13
|
+
export * from './monitoring-annotations';
|
|
14
|
+
export { FUNCTION_CALLER_DATA_TOKEN_HEADER } from './orm-contract';
|
|
15
|
+
export { FUNCTION_DIRECTORY_TOKEN_HEADER, FUNCTION_DIRECTORY_RESOLVE_PATH, functionDirectoryScopesSchema, readFunctionDirectoryScopes, directoryPrincipalResolveRequestSchema, directoryPrincipalResolutionSchema } from './directory-contract';
|
|
16
|
+
export * from './abrigo-contract';
|
|
2
17
|
export { shouldReportAtlasHttp } from './http-tracing';
|
|
18
|
+
export { functionImmutableReleaseSchema, readFunctionImmutableRelease } from './immutable-release-contract';
|
|
3
19
|
import { z } from 'zod';
|
|
4
20
|
export { MANAGED_FUNCTION_LIMITS, MF_LIMITS_CAPS, MF_LIMITS_DEFAULTS, managedFunctionWorkloadLimitsSchema } from './limits';
|
|
5
21
|
export type { ManagedFunctionLimitCatalog } from './limits';
|
|
6
|
-
export { MANAGED_FUNCTION_CAPABILITIES, MANAGED_FUNCTION_CLI_PACKAGE, MANAGED_FUNCTION_SDK_PACKAGE, formatValidationDetail, isPostgresEgress, sdkVersionFromPackageJson, sdkVersionLowerBound, versionIsOlder, } from './capabilities';
|
|
22
|
+
export { MANAGED_FUNCTION_CAPABILITIES, MANAGED_FUNCTION_CLI_PACKAGE, MANAGED_FUNCTION_SDK_PACKAGE, formatValidationDetail, isPostgresEgress, sdkVersionFromPackageJson, sdkSpecFromPackageJson, sdkVersionLowerBound, versionIsOlder, } from './capabilities';
|
|
7
23
|
export type { DeployedPolicy, ManagedFunctionCapabilities, PreflightIssue, PreflightManifest, } from './capabilities';
|
|
8
24
|
export { parseDeployedPolicy } from './deployed-policy';
|
|
9
25
|
export { preflightManagedFunction } from './preflight';
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
17
|
+
exports.versionIsOlder = exports.sdkVersionLowerBound = exports.sdkSpecFromPackageJson = exports.sdkVersionFromPackageJson = exports.isPostgresEgress = exports.formatValidationDetail = exports.MANAGED_FUNCTION_SDK_PACKAGE = exports.MANAGED_FUNCTION_CLI_PACKAGE = exports.MANAGED_FUNCTION_CAPABILITIES = exports.managedFunctionWorkloadLimitsSchema = exports.MF_LIMITS_DEFAULTS = exports.MF_LIMITS_CAPS = exports.MANAGED_FUNCTION_LIMITS = exports.readFunctionImmutableRelease = exports.functionImmutableReleaseSchema = exports.shouldReportAtlasHttp = exports.directoryPrincipalResolutionSchema = exports.directoryPrincipalResolveRequestSchema = exports.readFunctionDirectoryScopes = exports.functionDirectoryScopesSchema = exports.FUNCTION_DIRECTORY_RESOLVE_PATH = exports.FUNCTION_DIRECTORY_TOKEN_HEADER = exports.FUNCTION_CALLER_DATA_TOKEN_HEADER = exports.readFunctionWorkflowEvidenceScopes = exports.readFunctionWorkflowScopes = exports.functionWorkflowScopesSchema = exports.functionAgentCompletedRunSchema = exports.functionAgentCompletedRunQuerySchema = exports.functionAgentReadRequestSchema = exports.readFunctionAgentScopes = exports.functionAgentReadScopesSchema = exports.FUNCTION_AGENT_READ_PATH = exports.FUNCTION_AGENT_TOKEN_HEADER = exports.functionProcessCompletedAgentReferenceQuerySchema = exports.functionProcessCompletedAgentReferenceSchema = exports.functionProcessRunSummarySchema = exports.functionProcessReadRequestSchema = exports.readFunctionProcessScopes = exports.functionProcessReadScopesSchema = exports.FUNCTION_PROCESS_READ_PATH = exports.FUNCTION_PROCESS_TOKEN_HEADER = exports.readFunctionLatticeContextCapability = exports.functionLatticeContextCapabilitySchema = exports.functionDirectoryManifestSchema = exports.readDirectoryGroups = exports.directoryMembersResponse = exports.directoryMembersInput = exports.directoryScopesSchema = exports.directoryGroupIdSchema = exports.DIRECTORY_TOKEN_HEADER = void 0;
|
|
18
|
+
exports.cacheManifestSchema = exports.CACHE_MAX_TTL_SECONDS = exports.preflightManagedFunction = exports.parseDeployedPolicy = void 0;
|
|
4
19
|
exports.readCacheConfiguration = readCacheConfiguration;
|
|
20
|
+
var directory_config_1 = require("./directory-config");
|
|
21
|
+
Object.defineProperty(exports, "DIRECTORY_TOKEN_HEADER", { enumerable: true, get: function () { return directory_config_1.DIRECTORY_TOKEN_HEADER; } });
|
|
22
|
+
Object.defineProperty(exports, "directoryGroupIdSchema", { enumerable: true, get: function () { return directory_config_1.directoryGroupIdSchema; } });
|
|
23
|
+
Object.defineProperty(exports, "directoryScopesSchema", { enumerable: true, get: function () { return directory_config_1.directoryScopesSchema; } });
|
|
24
|
+
Object.defineProperty(exports, "directoryMembersInput", { enumerable: true, get: function () { return directory_config_1.directoryMembersInput; } });
|
|
25
|
+
Object.defineProperty(exports, "directoryMembersResponse", { enumerable: true, get: function () { return directory_config_1.directoryMembersResponse; } });
|
|
26
|
+
Object.defineProperty(exports, "readDirectoryGroups", { enumerable: true, get: function () { return directory_config_1.readDirectoryGroups; } });
|
|
27
|
+
var directory_manifest_1 = require("./directory-manifest");
|
|
28
|
+
Object.defineProperty(exports, "functionDirectoryManifestSchema", { enumerable: true, get: function () { return directory_manifest_1.functionDirectoryManifestSchema; } });
|
|
29
|
+
var lattice_capability_1 = require("./lattice-capability");
|
|
30
|
+
Object.defineProperty(exports, "functionLatticeContextCapabilitySchema", { enumerable: true, get: function () { return lattice_capability_1.functionLatticeContextCapabilitySchema; } });
|
|
31
|
+
Object.defineProperty(exports, "readFunctionLatticeContextCapability", { enumerable: true, get: function () { return lattice_capability_1.readFunctionLatticeContextCapability; } });
|
|
32
|
+
__exportStar(require("./invocation-contract"), exports);
|
|
5
33
|
var processes_contract_1 = require("./processes-contract");
|
|
6
34
|
Object.defineProperty(exports, "FUNCTION_PROCESS_TOKEN_HEADER", { enumerable: true, get: function () { return processes_contract_1.FUNCTION_PROCESS_TOKEN_HEADER; } });
|
|
7
35
|
Object.defineProperty(exports, "FUNCTION_PROCESS_READ_PATH", { enumerable: true, get: function () { return processes_contract_1.FUNCTION_PROCESS_READ_PATH; } });
|
|
@@ -9,8 +37,40 @@ Object.defineProperty(exports, "functionProcessReadScopesSchema", { enumerable:
|
|
|
9
37
|
Object.defineProperty(exports, "readFunctionProcessScopes", { enumerable: true, get: function () { return processes_contract_1.readFunctionProcessScopes; } });
|
|
10
38
|
Object.defineProperty(exports, "functionProcessReadRequestSchema", { enumerable: true, get: function () { return processes_contract_1.functionProcessReadRequestSchema; } });
|
|
11
39
|
Object.defineProperty(exports, "functionProcessRunSummarySchema", { enumerable: true, get: function () { return processes_contract_1.functionProcessRunSummarySchema; } });
|
|
40
|
+
Object.defineProperty(exports, "functionProcessCompletedAgentReferenceSchema", { enumerable: true, get: function () { return processes_contract_1.functionProcessCompletedAgentReferenceSchema; } });
|
|
41
|
+
Object.defineProperty(exports, "functionProcessCompletedAgentReferenceQuerySchema", { enumerable: true, get: function () { return processes_contract_1.functionProcessCompletedAgentReferenceQuerySchema; } });
|
|
42
|
+
var agents_contract_1 = require("./agents-contract");
|
|
43
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_TOKEN_HEADER", { enumerable: true, get: function () { return agents_contract_1.FUNCTION_AGENT_TOKEN_HEADER; } });
|
|
44
|
+
Object.defineProperty(exports, "FUNCTION_AGENT_READ_PATH", { enumerable: true, get: function () { return agents_contract_1.FUNCTION_AGENT_READ_PATH; } });
|
|
45
|
+
Object.defineProperty(exports, "functionAgentReadScopesSchema", { enumerable: true, get: function () { return agents_contract_1.functionAgentReadScopesSchema; } });
|
|
46
|
+
Object.defineProperty(exports, "readFunctionAgentScopes", { enumerable: true, get: function () { return agents_contract_1.readFunctionAgentScopes; } });
|
|
47
|
+
Object.defineProperty(exports, "functionAgentReadRequestSchema", { enumerable: true, get: function () { return agents_contract_1.functionAgentReadRequestSchema; } });
|
|
48
|
+
Object.defineProperty(exports, "functionAgentCompletedRunQuerySchema", { enumerable: true, get: function () { return agents_contract_1.functionAgentCompletedRunQuerySchema; } });
|
|
49
|
+
Object.defineProperty(exports, "functionAgentCompletedRunSchema", { enumerable: true, get: function () { return agents_contract_1.functionAgentCompletedRunSchema; } });
|
|
50
|
+
__exportStar(require("./agent-source-evidence-contract"), exports);
|
|
51
|
+
__exportStar(require("./workflow-source-contract"), exports);
|
|
52
|
+
var workflow_scopes_contract_1 = require("./workflow-scopes-contract");
|
|
53
|
+
Object.defineProperty(exports, "functionWorkflowScopesSchema", { enumerable: true, get: function () { return workflow_scopes_contract_1.functionWorkflowScopesSchema; } });
|
|
54
|
+
Object.defineProperty(exports, "readFunctionWorkflowScopes", { enumerable: true, get: function () { return workflow_scopes_contract_1.readFunctionWorkflowScopes; } });
|
|
55
|
+
Object.defineProperty(exports, "readFunctionWorkflowEvidenceScopes", { enumerable: true, get: function () { return workflow_scopes_contract_1.readFunctionWorkflowEvidenceScopes; } });
|
|
56
|
+
__exportStar(require("./monitoring-events"), exports);
|
|
57
|
+
__exportStar(require("./monitoring-contract"), exports);
|
|
58
|
+
__exportStar(require("./monitoring-annotations"), exports);
|
|
59
|
+
var orm_contract_1 = require("./orm-contract");
|
|
60
|
+
Object.defineProperty(exports, "FUNCTION_CALLER_DATA_TOKEN_HEADER", { enumerable: true, get: function () { return orm_contract_1.FUNCTION_CALLER_DATA_TOKEN_HEADER; } });
|
|
61
|
+
var directory_contract_1 = require("./directory-contract");
|
|
62
|
+
Object.defineProperty(exports, "FUNCTION_DIRECTORY_TOKEN_HEADER", { enumerable: true, get: function () { return directory_contract_1.FUNCTION_DIRECTORY_TOKEN_HEADER; } });
|
|
63
|
+
Object.defineProperty(exports, "FUNCTION_DIRECTORY_RESOLVE_PATH", { enumerable: true, get: function () { return directory_contract_1.FUNCTION_DIRECTORY_RESOLVE_PATH; } });
|
|
64
|
+
Object.defineProperty(exports, "functionDirectoryScopesSchema", { enumerable: true, get: function () { return directory_contract_1.functionDirectoryScopesSchema; } });
|
|
65
|
+
Object.defineProperty(exports, "readFunctionDirectoryScopes", { enumerable: true, get: function () { return directory_contract_1.readFunctionDirectoryScopes; } });
|
|
66
|
+
Object.defineProperty(exports, "directoryPrincipalResolveRequestSchema", { enumerable: true, get: function () { return directory_contract_1.directoryPrincipalResolveRequestSchema; } });
|
|
67
|
+
Object.defineProperty(exports, "directoryPrincipalResolutionSchema", { enumerable: true, get: function () { return directory_contract_1.directoryPrincipalResolutionSchema; } });
|
|
68
|
+
__exportStar(require("./abrigo-contract"), exports);
|
|
12
69
|
var http_tracing_1 = require("./http-tracing");
|
|
13
70
|
Object.defineProperty(exports, "shouldReportAtlasHttp", { enumerable: true, get: function () { return http_tracing_1.shouldReportAtlasHttp; } });
|
|
71
|
+
var immutable_release_contract_1 = require("./immutable-release-contract");
|
|
72
|
+
Object.defineProperty(exports, "functionImmutableReleaseSchema", { enumerable: true, get: function () { return immutable_release_contract_1.functionImmutableReleaseSchema; } });
|
|
73
|
+
Object.defineProperty(exports, "readFunctionImmutableRelease", { enumerable: true, get: function () { return immutable_release_contract_1.readFunctionImmutableRelease; } });
|
|
14
74
|
const zod_1 = require("zod");
|
|
15
75
|
const limits_1 = require("./limits");
|
|
16
76
|
var limits_2 = require("./limits");
|
|
@@ -25,6 +85,7 @@ Object.defineProperty(exports, "MANAGED_FUNCTION_SDK_PACKAGE", { enumerable: tru
|
|
|
25
85
|
Object.defineProperty(exports, "formatValidationDetail", { enumerable: true, get: function () { return capabilities_1.formatValidationDetail; } });
|
|
26
86
|
Object.defineProperty(exports, "isPostgresEgress", { enumerable: true, get: function () { return capabilities_1.isPostgresEgress; } });
|
|
27
87
|
Object.defineProperty(exports, "sdkVersionFromPackageJson", { enumerable: true, get: function () { return capabilities_1.sdkVersionFromPackageJson; } });
|
|
88
|
+
Object.defineProperty(exports, "sdkSpecFromPackageJson", { enumerable: true, get: function () { return capabilities_1.sdkSpecFromPackageJson; } });
|
|
28
89
|
Object.defineProperty(exports, "sdkVersionLowerBound", { enumerable: true, get: function () { return capabilities_1.sdkVersionLowerBound; } });
|
|
29
90
|
Object.defineProperty(exports, "versionIsOlder", { enumerable: true, get: function () { return capabilities_1.versionIsOlder; } });
|
|
30
91
|
var deployed_policy_1 = require("./deployed-policy");
|
package/dist/deployed-policy.js
CHANGED
|
@@ -38,13 +38,87 @@ function normalizeCapabilities(value) {
|
|
|
38
38
|
return {
|
|
39
39
|
tooling: value.tooling,
|
|
40
40
|
features: {
|
|
41
|
+
immutable_release: normalizeImmutableRelease(features.immutable_release),
|
|
42
|
+
invocation_identity: normalizeInvocationIdentity(features.invocation_identity),
|
|
43
|
+
directory_members: normalizeDirectoryMembers(features.directory_members),
|
|
44
|
+
directory_resolve: normalizeDirectory(features.directory_resolve),
|
|
45
|
+
abrigo_read: normalizeAbrigo(features.abrigo_read),
|
|
46
|
+
lattice_context: normalizeLatticeContext(features.lattice_context),
|
|
41
47
|
postgres_egress: normalizePostgres(features.postgres_egress),
|
|
42
48
|
http_headers: normalizeHeaders(features.http_headers),
|
|
43
49
|
invoke_timeout: normalizeTimeout(features.invoke_timeout),
|
|
44
50
|
processes_read: normalizeProcesses(features.processes_read),
|
|
51
|
+
agents_read: normalizeAgents(features.agents_read),
|
|
52
|
+
agents_evidence_verify: normalizeAgentEvidence(features.agents_evidence_verify),
|
|
53
|
+
workflows_read: normalizeWorkflowRead(features.workflows_read),
|
|
54
|
+
workflows_evidence_verify: normalizeWorkflowEvidence(features.workflows_evidence_verify),
|
|
55
|
+
monitoring_deliveries: normalizeMonitoring(features.monitoring_deliveries),
|
|
45
56
|
},
|
|
46
57
|
};
|
|
47
58
|
}
|
|
59
|
+
function normalizeImmutableRelease(value) {
|
|
60
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
61
|
+
return undefined;
|
|
62
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
63
|
+
return undefined;
|
|
64
|
+
return {
|
|
65
|
+
field: typeof value.field === 'string' ? value.field : 'function.immutable_release',
|
|
66
|
+
supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function normalizeDirectoryMembers(value) {
|
|
70
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
71
|
+
return undefined;
|
|
72
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
73
|
+
return undefined;
|
|
74
|
+
return {
|
|
75
|
+
field: typeof value.field === 'string' ? value.field : 'capabilities.directory.groups',
|
|
76
|
+
supported: value.supported,
|
|
77
|
+
limit: value.limit,
|
|
78
|
+
min_cli: value.min_cli,
|
|
79
|
+
min_sdk: value.min_sdk,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function normalizeDirectory(value) {
|
|
83
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string' || typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
84
|
+
return undefined;
|
|
85
|
+
return { field: typeof value.field === 'string' ? value.field : 'capabilities.directory.resolve', supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
|
|
86
|
+
}
|
|
87
|
+
function normalizeAbrigo(value) {
|
|
88
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string' || typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
89
|
+
return undefined;
|
|
90
|
+
return { field: typeof value.field === 'string' ? value.field : 'capabilities.abrigo.read', supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
|
|
91
|
+
}
|
|
92
|
+
function normalizeInvocationIdentity(value) {
|
|
93
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
94
|
+
return undefined;
|
|
95
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
96
|
+
return undefined;
|
|
97
|
+
return {
|
|
98
|
+
field: typeof value.field === 'string' ? value.field : 'capabilities.invocation.identity',
|
|
99
|
+
supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function normalizeLatticeContext(value) {
|
|
103
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
104
|
+
return undefined;
|
|
105
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
106
|
+
return undefined;
|
|
107
|
+
return {
|
|
108
|
+
field: typeof value.field === 'string' ? value.field : 'capabilities.lattice.context',
|
|
109
|
+
supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function normalizeMonitoring(value) {
|
|
113
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
114
|
+
return undefined;
|
|
115
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
116
|
+
return undefined;
|
|
117
|
+
return {
|
|
118
|
+
field: typeof value.field === 'string' ? value.field : 'capabilities.monitoring.producers',
|
|
119
|
+
supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
48
122
|
function normalizeProcesses(value) {
|
|
49
123
|
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
50
124
|
return undefined;
|
|
@@ -58,6 +132,34 @@ function normalizeProcesses(value) {
|
|
|
58
132
|
min_sdk: value.min_sdk,
|
|
59
133
|
};
|
|
60
134
|
}
|
|
135
|
+
function normalizeAgents(value) {
|
|
136
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
137
|
+
return undefined;
|
|
138
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
139
|
+
return undefined;
|
|
140
|
+
return { field: typeof value.field === 'string' ? value.field : 'capabilities.agents.read', supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
|
|
141
|
+
}
|
|
142
|
+
function normalizeAgentEvidence(value) {
|
|
143
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
144
|
+
return undefined;
|
|
145
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
146
|
+
return undefined;
|
|
147
|
+
return { field: typeof value.field === 'string' ? value.field : 'capabilities.agents.evidence', supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
|
|
148
|
+
}
|
|
149
|
+
function normalizeWorkflowRead(value) {
|
|
150
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
151
|
+
return undefined;
|
|
152
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
153
|
+
return undefined;
|
|
154
|
+
return { field: typeof value.field === 'string' ? value.field : 'capabilities.workflows.read', supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
|
|
155
|
+
}
|
|
156
|
+
function normalizeWorkflowEvidence(value) {
|
|
157
|
+
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
158
|
+
return undefined;
|
|
159
|
+
if (typeof value.min_cli !== 'string' || typeof value.min_sdk !== 'string')
|
|
160
|
+
return undefined;
|
|
161
|
+
return { field: typeof value.field === 'string' ? value.field : 'capabilities.workflows.evidence', supported: value.supported, limit: value.limit, min_cli: value.min_cli, min_sdk: value.min_sdk };
|
|
162
|
+
}
|
|
61
163
|
function normalizePostgres(value) {
|
|
62
164
|
if (!value || typeof value.supported !== 'boolean' || typeof value.limit !== 'string')
|
|
63
165
|
return undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DIRECTORY_TOKEN_HEADER = "x-sequence-directory-token";
|
|
3
|
+
export declare const directoryGroupIdSchema: z.ZodString;
|
|
4
|
+
export declare const directoryScopesSchema: z.ZodObject<{
|
|
5
|
+
groups: z.ZodArray<z.ZodString>;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export declare const directoryMembersInput: z.ZodUnion<readonly [z.ZodObject<{
|
|
8
|
+
groupId: z.ZodString;
|
|
9
|
+
userIds: z.ZodArray<z.ZodString>;
|
|
10
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
11
|
+
groupId: z.ZodString;
|
|
12
|
+
subs: z.ZodArray<z.ZodString>;
|
|
13
|
+
}, z.core.$strict>]>;
|
|
14
|
+
export declare const directoryMembersResponse: z.ZodObject<{
|
|
15
|
+
members: z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
sub: z.ZodString;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
email: z.ZodString;
|
|
20
|
+
deactivated: z.ZodLiteral<false>;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare function readDirectoryGroups(manifest: unknown): string[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.directoryMembersResponse = exports.directoryMembersInput = exports.directoryScopesSchema = exports.directoryGroupIdSchema = exports.DIRECTORY_TOKEN_HEADER = void 0;
|
|
4
|
+
exports.readDirectoryGroups = readDirectoryGroups;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.DIRECTORY_TOKEN_HEADER = 'x-sequence-directory-token';
|
|
7
|
+
exports.directoryGroupIdSchema = zod_1.z.string().regex(/^(?:[a-f0-9]{24}|[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})$/i);
|
|
8
|
+
exports.directoryScopesSchema = zod_1.z.object({
|
|
9
|
+
groups: zod_1.z.array(exports.directoryGroupIdSchema).min(1).max(16),
|
|
10
|
+
}).strict();
|
|
11
|
+
const identity = zod_1.z.string().min(1).max(256).regex(/^[^\x00-\x1f\x7f]+$/);
|
|
12
|
+
exports.directoryMembersInput = zod_1.z.union([
|
|
13
|
+
zod_1.z.object({ groupId: exports.directoryGroupIdSchema, userIds: zod_1.z.array(identity).min(1).max(50) }).strict(),
|
|
14
|
+
zod_1.z.object({ groupId: exports.directoryGroupIdSchema, subs: zod_1.z.array(identity).min(1).max(50) }).strict(),
|
|
15
|
+
]);
|
|
16
|
+
exports.directoryMembersResponse = zod_1.z.object({ members: zod_1.z.array(zod_1.z.object({
|
|
17
|
+
id: zod_1.z.string(), sub: identity, name: zod_1.z.string(), email: zod_1.z.string(), deactivated: zod_1.z.literal(false),
|
|
18
|
+
}).strict()).max(50) }).strict();
|
|
19
|
+
function readDirectoryGroups(manifest) {
|
|
20
|
+
const parsed = zod_1.z.object({ capabilities: zod_1.z.object({ directory: zod_1.z.object({ groups: exports.directoryScopesSchema.shape.groups.optional() }).optional() }).optional() }).safeParse(manifest);
|
|
21
|
+
return parsed.success ? parsed.data.capabilities?.directory?.groups ?? [] : [];
|
|
22
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const FUNCTION_DIRECTORY_TOKEN_HEADER = "x-sequence-directory-service-token";
|
|
3
|
+
export declare const FUNCTION_DIRECTORY_RESOLVE_PATH = "/api/managed-functions/directory/resolve";
|
|
4
|
+
export declare const DIRECTORY_PRINCIPALS_PER_REQUEST = 50;
|
|
5
|
+
export declare const directoryTenantSchema: z.ZodString;
|
|
6
|
+
export declare const directoryPrincipalLookupSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
7
|
+
type: z.ZodLiteral<"email">;
|
|
8
|
+
value: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
|
|
9
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"sub">;
|
|
11
|
+
value: z.ZodString;
|
|
12
|
+
}, z.core.$strict>], "type">;
|
|
13
|
+
export type DirectoryPrincipalLookup = z.infer<typeof directoryPrincipalLookupSchema>;
|
|
14
|
+
export declare const directoryPrincipalResolveRequestSchema: z.ZodObject<{
|
|
15
|
+
tenant: z.ZodString;
|
|
16
|
+
lookups: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<"email">;
|
|
18
|
+
value: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
|
|
19
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"sub">;
|
|
21
|
+
value: z.ZodString;
|
|
22
|
+
}, z.core.$strict>], "type">>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type DirectoryPrincipalResolveRequest = z.infer<typeof directoryPrincipalResolveRequestSchema>;
|
|
25
|
+
export declare const directoryResolvedPrincipalSchema: z.ZodObject<{
|
|
26
|
+
lookup: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"email">;
|
|
28
|
+
value: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
|
|
29
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"sub">;
|
|
31
|
+
value: z.ZodString;
|
|
32
|
+
}, z.core.$strict>], "type">;
|
|
33
|
+
sub: z.ZodString;
|
|
34
|
+
email: z.ZodUnion<readonly [z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>, z.ZodLiteral<"">]>;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
export declare const directoryPrincipalResolutionSchema: z.ZodObject<{
|
|
38
|
+
resolved: z.ZodArray<z.ZodObject<{
|
|
39
|
+
lookup: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"email">;
|
|
41
|
+
value: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
|
|
42
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"sub">;
|
|
44
|
+
value: z.ZodString;
|
|
45
|
+
}, z.core.$strict>], "type">;
|
|
46
|
+
sub: z.ZodString;
|
|
47
|
+
email: z.ZodUnion<readonly [z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>, z.ZodLiteral<"">]>;
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
unresolved: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"email">;
|
|
52
|
+
value: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
|
|
53
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"sub">;
|
|
55
|
+
value: z.ZodString;
|
|
56
|
+
}, z.core.$strict>], "type">>;
|
|
57
|
+
}, z.core.$strict>;
|
|
58
|
+
export type DirectoryPrincipalResolution = z.infer<typeof directoryPrincipalResolutionSchema>;
|
|
59
|
+
export declare const functionDirectoryScopesSchema: z.ZodObject<{
|
|
60
|
+
resolve: z.ZodArray<z.ZodString>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
export declare function readFunctionDirectoryScopes(manifest: unknown): string[];
|
|
63
|
+
export declare class DirectoryPrincipalResolveError extends Error {
|
|
64
|
+
readonly status: number;
|
|
65
|
+
readonly code: string;
|
|
66
|
+
readonly name = "DirectoryPrincipalResolveError";
|
|
67
|
+
constructor(status: number, code: string, message: string);
|
|
68
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DirectoryPrincipalResolveError = exports.functionDirectoryScopesSchema = exports.directoryPrincipalResolutionSchema = exports.directoryResolvedPrincipalSchema = exports.directoryPrincipalResolveRequestSchema = exports.directoryPrincipalLookupSchema = exports.directoryTenantSchema = exports.DIRECTORY_PRINCIPALS_PER_REQUEST = exports.FUNCTION_DIRECTORY_RESOLVE_PATH = exports.FUNCTION_DIRECTORY_TOKEN_HEADER = void 0;
|
|
4
|
+
exports.readFunctionDirectoryScopes = readFunctionDirectoryScopes;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.FUNCTION_DIRECTORY_TOKEN_HEADER = 'x-sequence-directory-service-token';
|
|
7
|
+
exports.FUNCTION_DIRECTORY_RESOLVE_PATH = '/api/managed-functions/directory/resolve';
|
|
8
|
+
exports.DIRECTORY_PRINCIPALS_PER_REQUEST = 50;
|
|
9
|
+
exports.directoryTenantSchema = zod_1.z.string().min(1).max(32).regex(/^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/);
|
|
10
|
+
const subject = zod_1.z.string().min(3).max(255).regex(/^[^\s:#]+\|[^\s:#]+$/);
|
|
11
|
+
const email = zod_1.z.email().max(255).transform((value) => value.trim().toLowerCase());
|
|
12
|
+
exports.directoryPrincipalLookupSchema = zod_1.z.discriminatedUnion('type', [
|
|
13
|
+
zod_1.z.strictObject({ type: zod_1.z.literal('email'), value: email }),
|
|
14
|
+
zod_1.z.strictObject({ type: zod_1.z.literal('sub'), value: subject }),
|
|
15
|
+
]);
|
|
16
|
+
exports.directoryPrincipalResolveRequestSchema = zod_1.z.strictObject({
|
|
17
|
+
tenant: exports.directoryTenantSchema,
|
|
18
|
+
lookups: zod_1.z.array(exports.directoryPrincipalLookupSchema).min(1).max(exports.DIRECTORY_PRINCIPALS_PER_REQUEST)
|
|
19
|
+
.refine((values) => new Set(values.map((value) => `${value.type}:${value.value}`)).size === values.length, 'Lookups must be distinct'),
|
|
20
|
+
});
|
|
21
|
+
exports.directoryResolvedPrincipalSchema = zod_1.z.strictObject({
|
|
22
|
+
lookup: exports.directoryPrincipalLookupSchema,
|
|
23
|
+
sub: subject.refine((value) => !value.startsWith('service-account|') && !value.startsWith('managed-function|') && !value.endsWith('@clients') && value !== 'google-apps|sequence.agent@seqholdings.com', 'Only human directory principals can resolve'),
|
|
24
|
+
email: zod_1.z.union([email, zod_1.z.literal('')]),
|
|
25
|
+
name: zod_1.z.string().max(255),
|
|
26
|
+
});
|
|
27
|
+
exports.directoryPrincipalResolutionSchema = zod_1.z.strictObject({
|
|
28
|
+
resolved: zod_1.z.array(exports.directoryResolvedPrincipalSchema).max(exports.DIRECTORY_PRINCIPALS_PER_REQUEST),
|
|
29
|
+
unresolved: zod_1.z.array(exports.directoryPrincipalLookupSchema).max(exports.DIRECTORY_PRINCIPALS_PER_REQUEST),
|
|
30
|
+
});
|
|
31
|
+
exports.functionDirectoryScopesSchema = zod_1.z.strictObject({
|
|
32
|
+
resolve: zod_1.z.array(exports.directoryTenantSchema).min(1).max(16)
|
|
33
|
+
.refine((values) => new Set(values).size === values.length, 'Tenant scopes must be distinct'),
|
|
34
|
+
});
|
|
35
|
+
function readFunctionDirectoryScopes(manifest) {
|
|
36
|
+
if (typeof manifest !== 'object' || manifest === null)
|
|
37
|
+
return [];
|
|
38
|
+
const capabilities = Reflect.get(manifest, 'capabilities');
|
|
39
|
+
if (typeof capabilities !== 'object' || capabilities === null)
|
|
40
|
+
return [];
|
|
41
|
+
const directory = Reflect.get(capabilities, 'directory');
|
|
42
|
+
if (typeof directory !== 'object' || directory === null)
|
|
43
|
+
return [];
|
|
44
|
+
const resolve = Reflect.get(directory, 'resolve');
|
|
45
|
+
return resolve === undefined ? [] : exports.functionDirectoryScopesSchema.parse({ resolve }).resolve;
|
|
46
|
+
}
|
|
47
|
+
class DirectoryPrincipalResolveError extends Error {
|
|
48
|
+
status;
|
|
49
|
+
code;
|
|
50
|
+
name = 'DirectoryPrincipalResolveError';
|
|
51
|
+
constructor(status, code, message) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.status = status;
|
|
54
|
+
this.code = code;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.DirectoryPrincipalResolveError = DirectoryPrincipalResolveError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionDirectoryManifestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const directory_config_1 = require("./directory-config");
|
|
6
|
+
const directory_contract_1 = require("./directory-contract");
|
|
7
|
+
exports.functionDirectoryManifestSchema = zod_1.z.strictObject({
|
|
8
|
+
groups: directory_config_1.directoryScopesSchema.shape.groups.optional(),
|
|
9
|
+
resolve: directory_contract_1.functionDirectoryScopesSchema.shape.resolve.optional(),
|
|
10
|
+
}).refine((value) => value.groups !== undefined || value.resolve !== undefined, 'Declare directory groups, tenant resolution scopes, or both');
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { directoryMembersInput, directoryMembersResponse } from './directory-config';
|
|
3
|
+
import { type FunctionInvocationClientOptions } from './invocation-client';
|
|
4
|
+
export type FunctionDirectoryOptions = FunctionInvocationClientOptions;
|
|
5
|
+
export type FunctionDirectoryMembersQuery = z.infer<typeof directoryMembersInput>;
|
|
6
|
+
export type FunctionDirectoryMembers = z.infer<typeof directoryMembersResponse>;
|
|
7
|
+
export interface FunctionDirectoryClient {
|
|
8
|
+
resolveMembers(input: FunctionDirectoryMembersQuery): Promise<FunctionDirectoryMembers>;
|
|
9
|
+
}
|
|
10
|
+
export declare class FunctionDirectoryReadError extends Error {
|
|
11
|
+
readonly status: number;
|
|
12
|
+
readonly code: string;
|
|
13
|
+
constructor(status: number, code: string, message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare function createFunctionDirectoryClient({ request, baseUrl, fetchImpl, }: FunctionDirectoryOptions): FunctionDirectoryClient;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FunctionDirectoryReadError = void 0;
|
|
4
|
+
exports.createFunctionDirectoryClient = createFunctionDirectoryClient;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const directory_config_1 = require("./directory-config");
|
|
7
|
+
const invocation_client_1 = require("./invocation-client");
|
|
8
|
+
class FunctionDirectoryReadError extends Error {
|
|
9
|
+
status;
|
|
10
|
+
code;
|
|
11
|
+
constructor(status, code, message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.status = status;
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.name = 'FunctionDirectoryReadError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.FunctionDirectoryReadError = FunctionDirectoryReadError;
|
|
19
|
+
function createFunctionDirectoryClient({ request, baseUrl, fetchImpl, }) {
|
|
20
|
+
const credential = (0, invocation_client_1.readInvocationCredential)({
|
|
21
|
+
request,
|
|
22
|
+
header: directory_config_1.DIRECTORY_TOKEN_HEADER,
|
|
23
|
+
maxBytes: 8192,
|
|
24
|
+
invalidContext: () => new FunctionDirectoryReadError(401, 'invalid_context', 'This invocation has no valid directory-read credential'),
|
|
25
|
+
claimsSchema: zod_1.z.object({
|
|
26
|
+
audience: zod_1.z.literal('atlas-function-group-directory-v1'),
|
|
27
|
+
sub: zod_1.z
|
|
28
|
+
.string()
|
|
29
|
+
.min(1)
|
|
30
|
+
.max(256)
|
|
31
|
+
.refine((sub) => sub.includes('|') &&
|
|
32
|
+
!sub.startsWith('service-account|') &&
|
|
33
|
+
!sub.endsWith('@clients')),
|
|
34
|
+
functionId: zod_1.z.string().min(1),
|
|
35
|
+
invocationId: zod_1.z.string().min(1),
|
|
36
|
+
exp: zod_1.z.number().int(),
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
const read = (0, invocation_client_1.createInvocationReadTransport)({
|
|
40
|
+
baseUrl,
|
|
41
|
+
fetchImpl,
|
|
42
|
+
path: '/api/managed-functions/directory/members',
|
|
43
|
+
header: directory_config_1.DIRECTORY_TOKEN_HEADER,
|
|
44
|
+
credential,
|
|
45
|
+
timeoutMs: 10_000,
|
|
46
|
+
error: (status, code, message) => new FunctionDirectoryReadError(status, code, message),
|
|
47
|
+
failure: {
|
|
48
|
+
code: 'directory_read_failed',
|
|
49
|
+
message: 'Directory read failed',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
async resolveMembers(input) {
|
|
54
|
+
const body = directory_config_1.directoryMembersInput.parse(input);
|
|
55
|
+
const result = await read({ body, schema: directory_config_1.directoryMembersResponse });
|
|
56
|
+
const selectors = new Set('userIds' in body ? body.userIds : body.subs);
|
|
57
|
+
const returned = result.members.map((member) => 'userIds' in body ? member.id : member.sub);
|
|
58
|
+
if (new Set(returned).size !== returned.length ||
|
|
59
|
+
returned.some((value) => !selectors.has(value))) {
|
|
60
|
+
throw new FunctionDirectoryReadError(502, 'malformed_response', 'Atlas returned duplicate or unrequested directory members');
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
package/dist/http-tracing.js
CHANGED
|
@@ -20,5 +20,8 @@ function shouldReportAtlasHttp(pathname, method) {
|
|
|
20
20
|
if (method === 'POST' &&
|
|
21
21
|
/^\/api\/lattice\/(runs|processes\/[^/]+\/runs)\/?$/.test(pathname))
|
|
22
22
|
return false;
|
|
23
|
+
if (method === 'POST' &&
|
|
24
|
+
/^\/api\/external-systems\/call\/?$/.test(pathname))
|
|
25
|
+
return false;
|
|
23
26
|
return true;
|
|
24
27
|
}
|