@dxos/functions 0.8.3 → 0.8.4-main.28f8d3d
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/dist/lib/browser/bundler/index.mjs +22 -10
- package/dist/lib/browser/bundler/index.mjs.map +3 -3
- package/dist/lib/browser/chunk-M2OIFLGE.mjs +486 -0
- package/dist/lib/browser/chunk-M2OIFLGE.mjs.map +7 -0
- package/dist/lib/browser/edge/index.mjs +2 -2
- package/dist/lib/browser/edge/index.mjs.map +1 -1
- package/dist/lib/browser/index.mjs +51 -37
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +39 -8
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/bundler/index.mjs +22 -10
- package/dist/lib/node-esm/bundler/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-K7REX6H4.mjs +488 -0
- package/dist/lib/node-esm/chunk-K7REX6H4.mjs.map +7 -0
- package/dist/lib/node-esm/edge/index.mjs +2 -2
- package/dist/lib/node-esm/edge/index.mjs.map +1 -1
- package/dist/lib/node-esm/index.mjs +51 -37
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +39 -8
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/bundler/bundler.d.ts +1 -2
- package/dist/types/src/bundler/bundler.d.ts.map +1 -1
- package/dist/types/src/edge/functions.d.ts +1 -1
- package/dist/types/src/edge/functions.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts +70 -0
- package/dist/types/src/errors.d.ts.map +1 -0
- package/dist/types/src/executor/executor.d.ts +3 -0
- package/dist/types/src/executor/executor.d.ts.map +1 -1
- package/dist/types/src/handler.d.ts +16 -15
- package/dist/types/src/handler.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/schema.d.ts +5 -5
- package/dist/types/src/services/credentials.d.ts +7 -3
- package/dist/types/src/services/credentials.d.ts.map +1 -1
- package/dist/types/src/services/database.d.ts +71 -3
- package/dist/types/src/services/database.d.ts.map +1 -1
- package/dist/types/src/services/event-logger.d.ts +65 -30
- package/dist/types/src/services/event-logger.d.ts.map +1 -1
- package/dist/types/src/services/index.d.ts +2 -2
- package/dist/types/src/services/index.d.ts.map +1 -1
- package/dist/types/src/services/local-function-execution.d.ts +12 -0
- package/dist/types/src/services/local-function-execution.d.ts.map +1 -0
- package/dist/types/src/services/queues.d.ts +32 -6
- package/dist/types/src/services/queues.d.ts.map +1 -1
- package/dist/types/src/services/remote-function-execution-service.d.ts +15 -0
- package/dist/types/src/services/remote-function-execution-service.d.ts.map +1 -0
- package/dist/types/src/services/service-container.d.ts +29 -17
- package/dist/types/src/services/service-container.d.ts.map +1 -1
- package/dist/types/src/services/service-registry.d.ts +29 -0
- package/dist/types/src/services/service-registry.d.ts.map +1 -0
- package/dist/types/src/services/service-registry.test.d.ts +2 -0
- package/dist/types/src/services/service-registry.test.d.ts.map +1 -0
- package/dist/types/src/services/tracing.d.ts +13 -2
- package/dist/types/src/services/tracing.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/layer.d.ts +10 -0
- package/dist/types/src/testing/layer.d.ts.map +1 -0
- package/dist/types/src/testing/logger.d.ts +3 -3
- package/dist/types/src/testing/logger.d.ts.map +1 -1
- package/dist/types/src/testing/services.d.ts +55 -9
- package/dist/types/src/testing/services.d.ts.map +1 -1
- package/dist/types/src/trace.d.ts +3 -5
- package/dist/types/src/trace.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +9 -9
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +7 -7
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -26
- package/src/bundler/bundler.test.ts +1 -1
- package/src/bundler/bundler.ts +26 -4
- package/src/edge/functions.ts +1 -1
- package/src/errors.ts +13 -0
- package/src/executor/executor.ts +20 -13
- package/src/handler.ts +34 -25
- package/src/index.ts +1 -0
- package/src/services/credentials.ts +47 -4
- package/src/services/database.ts +91 -3
- package/src/services/event-logger.ts +68 -37
- package/src/services/index.ts +2 -2
- package/src/services/local-function-execution.ts +74 -0
- package/src/services/queues.ts +51 -11
- package/src/services/{function-call-service.ts → remote-function-execution-service.ts} +7 -5
- package/src/services/service-container.ts +47 -42
- package/src/services/service-registry.test.ts +42 -0
- package/src/services/service-registry.ts +59 -0
- package/src/services/tracing.ts +19 -2
- package/src/testing/index.ts +1 -0
- package/src/testing/layer.ts +31 -0
- package/src/testing/logger.ts +4 -4
- package/src/testing/services.ts +97 -14
- package/src/trace.ts +3 -5
- package/src/translations.ts +4 -4
- package/src/types.ts +1 -1
- package/dist/lib/browser/chunk-WEFZUEL2.mjs +0 -300
- package/dist/lib/browser/chunk-WEFZUEL2.mjs.map +0 -7
- package/dist/lib/node/bundler/index.cjs +0 -260
- package/dist/lib/node/bundler/index.cjs.map +0 -7
- package/dist/lib/node/chunk-IJAE7FZK.cjs +0 -320
- package/dist/lib/node/chunk-IJAE7FZK.cjs.map +0 -7
- package/dist/lib/node/edge/index.cjs +0 -94
- package/dist/lib/node/edge/index.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -522
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/testing/index.cjs +0 -43
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs +0 -302
- package/dist/lib/node-esm/chunk-LIYPMWNQ.mjs.map +0 -7
- package/dist/types/src/services/ai.d.ts +0 -12
- package/dist/types/src/services/ai.d.ts.map +0 -1
- package/dist/types/src/services/function-call-service.d.ts +0 -16
- package/dist/types/src/services/function-call-service.d.ts.map +0 -1
- package/src/services/ai.ts +0 -32
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Context, Effect, Layer } from 'effect';
|
|
6
|
+
import type { Schema } from 'effect';
|
|
7
|
+
|
|
8
|
+
import { EchoTestBuilder } from '@dxos/echo-db/testing';
|
|
9
|
+
import type { EchoHostIndexingConfig } from '@dxos/echo-pipeline';
|
|
10
|
+
import { accuireReleaseResource } from '@dxos/effect';
|
|
11
|
+
|
|
12
|
+
import { DatabaseService, QueueService } from '../services';
|
|
13
|
+
|
|
14
|
+
const testBuilder = accuireReleaseResource(() => new EchoTestBuilder());
|
|
15
|
+
|
|
16
|
+
export type TestDatabaseOptions = {
|
|
17
|
+
indexing?: Partial<EchoHostIndexingConfig>;
|
|
18
|
+
types?: Schema.Schema.AnyNoContext[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const TestDatabaseLayer = ({ indexing, types }: TestDatabaseOptions = {}) =>
|
|
22
|
+
Layer.scopedContext(
|
|
23
|
+
Effect.gen(function* () {
|
|
24
|
+
const builder = yield* testBuilder;
|
|
25
|
+
const { db, queues } = yield* Effect.promise(() => builder.createDatabase({ indexing, types }));
|
|
26
|
+
return Context.mergeAll(
|
|
27
|
+
Context.make(DatabaseService, DatabaseService.make(db)),
|
|
28
|
+
Context.make(QueueService, QueueService.make(queues, undefined)),
|
|
29
|
+
);
|
|
30
|
+
}),
|
|
31
|
+
);
|
package/src/testing/logger.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Context, Effect } from 'effect';
|
|
6
6
|
|
|
7
7
|
import { LogLevel } from '@dxos/log';
|
|
8
8
|
|
|
9
|
-
import { type
|
|
9
|
+
import { type ComputeEventLogger, createEventLogger } from '../services';
|
|
10
10
|
|
|
11
|
-
export const noopLogger: Context.Tag.Service<
|
|
11
|
+
export const noopLogger: Context.Tag.Service<ComputeEventLogger> = {
|
|
12
12
|
log: () => Effect.succeed(undefined),
|
|
13
13
|
nodeId: undefined,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const consoleLogger: Context.Tag.Service<
|
|
16
|
+
export const consoleLogger: Context.Tag.Service<ComputeEventLogger> = createEventLogger(LogLevel.INFO);
|
package/src/testing/services.ts
CHANGED
|
@@ -4,29 +4,112 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Context } from 'effect';
|
|
6
6
|
|
|
7
|
-
import type {
|
|
8
|
-
import type { QueueFactory } from '@dxos/echo-db';
|
|
7
|
+
import type { Space } from '@dxos/client/echo';
|
|
8
|
+
import type { EchoDatabase, QueueFactory } from '@dxos/echo-db';
|
|
9
|
+
import { assertArgument } from '@dxos/invariant';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
type ComputeEventLogger,
|
|
13
|
+
ConfiguredCredentialsService,
|
|
14
|
+
type CredentialsService,
|
|
15
|
+
DatabaseService,
|
|
16
|
+
QueueService,
|
|
17
|
+
ServiceContainer,
|
|
18
|
+
type ServiceCredential,
|
|
19
|
+
type TracingService,
|
|
20
|
+
} from '../services';
|
|
9
21
|
|
|
10
22
|
import { consoleLogger, noopLogger } from './logger';
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
|
|
24
|
+
// TODO(burdon): Factor out.
|
|
25
|
+
export type OneOf<T> = {
|
|
26
|
+
[K in keyof T]: { [P in K]: T[P] } & { [P in Exclude<keyof T, K>]?: never };
|
|
27
|
+
}[keyof T];
|
|
28
|
+
|
|
29
|
+
export type AiServiceProvider = 'dev' | 'edge' | 'ollama' | 'lmstudio';
|
|
13
30
|
|
|
14
31
|
export type TestServiceOptions = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
32
|
+
/**
|
|
33
|
+
* AI service configuration.
|
|
34
|
+
*/
|
|
35
|
+
ai?: any;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Credentials service configuration.
|
|
39
|
+
*/
|
|
40
|
+
credentials?: OneOf<{
|
|
41
|
+
/**
|
|
42
|
+
* Predefined credentials list.
|
|
43
|
+
*/
|
|
44
|
+
services?: ServiceCredential[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Custom credentials service.
|
|
48
|
+
*/
|
|
49
|
+
service?: Context.Tag.Service<CredentialsService>;
|
|
50
|
+
}>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Database configuration.
|
|
54
|
+
*/
|
|
55
|
+
db?: EchoDatabase;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Gets database and queue services from the space.
|
|
59
|
+
* Exclusive with: `db`, `queues`
|
|
60
|
+
*/
|
|
61
|
+
space?: Space;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Logging configuration.
|
|
65
|
+
*/
|
|
66
|
+
logging?: {
|
|
67
|
+
enabled?: boolean;
|
|
68
|
+
logger?: Context.Tag.Service<ComputeEventLogger>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Queue service configuration.
|
|
73
|
+
*/
|
|
74
|
+
queues?: QueueFactory;
|
|
75
|
+
|
|
76
|
+
tracing?: {
|
|
77
|
+
service?: Context.Tag.Service<TracingService>;
|
|
78
|
+
};
|
|
19
79
|
};
|
|
20
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @deprecated
|
|
83
|
+
*/
|
|
21
84
|
export const createTestServices = ({
|
|
22
85
|
ai,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
86
|
+
credentials,
|
|
87
|
+
db,
|
|
88
|
+
logging,
|
|
89
|
+
queues,
|
|
90
|
+
space,
|
|
91
|
+
tracing,
|
|
26
92
|
}: TestServiceOptions = {}): ServiceContainer => {
|
|
93
|
+
assertArgument(!(!!space && (!!db || !!queues)), 'space can be provided only if db and queues are not');
|
|
94
|
+
|
|
27
95
|
return new ServiceContainer().setServices({
|
|
28
|
-
ai:
|
|
29
|
-
|
|
30
|
-
|
|
96
|
+
// ai: createAiService(ai),
|
|
97
|
+
credentials: createCredentialsService(credentials),
|
|
98
|
+
database: space || db ? DatabaseService.make(space?.db || db!) : undefined,
|
|
99
|
+
eventLogger: (logging?.logger ?? logging?.enabled) ? consoleLogger : noopLogger,
|
|
100
|
+
queues: space || queues ? QueueService.make(space?.queues || queues!, undefined) : undefined,
|
|
101
|
+
tracing: tracing?.service,
|
|
31
102
|
});
|
|
32
103
|
};
|
|
104
|
+
|
|
105
|
+
const createCredentialsService = (
|
|
106
|
+
credentials: TestServiceOptions['credentials'] | undefined,
|
|
107
|
+
): Context.Tag.Service<CredentialsService> | undefined => {
|
|
108
|
+
if (credentials?.services) {
|
|
109
|
+
return new ConfiguredCredentialsService(credentials.services);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (credentials?.service) {
|
|
113
|
+
return credentials.service;
|
|
114
|
+
}
|
|
115
|
+
};
|
package/src/trace.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { type Ref, Type } from '@dxos/echo';
|
|
8
8
|
import { Queue } from '@dxos/echo-db';
|
|
9
9
|
import { ObjectId } from '@dxos/echo-schema';
|
|
10
10
|
import { log } from '@dxos/log';
|
|
@@ -101,10 +101,8 @@ export const TraceEvent = Schema.Struct({
|
|
|
101
101
|
// TODO(burdon): Need enum/numeric result (not string).
|
|
102
102
|
outcome: Schema.String,
|
|
103
103
|
truncated: Schema.Boolean,
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
*/
|
|
107
|
-
ingestionTimestampMs: Schema.Number,
|
|
104
|
+
/** Time when the event was persisted. */
|
|
105
|
+
ingestionTimestamp: Schema.Number,
|
|
108
106
|
logs: Schema.Array(TraceEventLog),
|
|
109
107
|
exceptions: Schema.Array(TraceEventException),
|
|
110
108
|
}).pipe(Type.Obj({ typename: 'dxos.org/type/TraceEvent', version: '0.1.0' }));
|
package/src/translations.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Resource } from 'i18next';
|
|
6
6
|
|
|
7
7
|
import { ScriptType } from './schema';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
|
-
[
|
|
12
|
+
[ScriptType.typename]: {
|
|
13
13
|
'typename label': 'Script',
|
|
14
14
|
'typename label_zero': 'Scripts',
|
|
15
15
|
'typename label_one': 'Script',
|
|
@@ -17,4 +17,4 @@ export default [
|
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
-
];
|
|
20
|
+
] as const satisfies Resource[];
|
package/src/types.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Schema, SchemaAST } from 'effect';
|
|
6
6
|
|
|
7
|
-
import { Expando, OptionsAnnotationId,
|
|
7
|
+
import { Expando, OptionsAnnotationId, RawObject, Ref, TypedObject } from '@dxos/echo-schema';
|
|
8
8
|
import { DXN } from '@dxos/keys';
|
|
9
9
|
|
|
10
10
|
import { FunctionType } from './schema';
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// packages/core/functions/src/services/ai.ts
|
|
2
|
-
import { Context, Layer } from "effect";
|
|
3
|
-
var AiService = class _AiService extends Context.Tag("AiService")() {
|
|
4
|
-
static {
|
|
5
|
-
this.make = (client) => {
|
|
6
|
-
return {
|
|
7
|
-
get client() {
|
|
8
|
-
return client;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
static {
|
|
14
|
-
this.makeLayer = (client) => Layer.succeed(_AiService, _AiService.make(client));
|
|
15
|
-
}
|
|
16
|
-
static {
|
|
17
|
-
this.notAvailable = Layer.succeed(_AiService, {
|
|
18
|
-
get client() {
|
|
19
|
-
throw new Error("AiService not available");
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// packages/core/functions/src/services/database.ts
|
|
26
|
-
import { Context as Context2, Layer as Layer2 } from "effect";
|
|
27
|
-
var DatabaseService = class _DatabaseService extends Context2.Tag("DatabaseService")() {
|
|
28
|
-
static {
|
|
29
|
-
this.notAvailable = Layer2.succeed(_DatabaseService, {
|
|
30
|
-
get db() {
|
|
31
|
-
throw new Error("Database not available");
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
static {
|
|
36
|
-
this.make = (db) => {
|
|
37
|
-
return {
|
|
38
|
-
get db() {
|
|
39
|
-
return db;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// packages/core/functions/src/services/queues.ts
|
|
47
|
-
import { Context as Context3, Layer as Layer3 } from "effect";
|
|
48
|
-
var QueueService = class _QueueService extends Context3.Tag("QueueService")() {
|
|
49
|
-
static {
|
|
50
|
-
this.notAvailable = Layer3.succeed(_QueueService, {
|
|
51
|
-
get queues() {
|
|
52
|
-
throw new Error("Queues not available");
|
|
53
|
-
},
|
|
54
|
-
contextQueue: void 0
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
static {
|
|
58
|
-
this.make = (queues, contextQueue) => {
|
|
59
|
-
return {
|
|
60
|
-
queues,
|
|
61
|
-
contextQueue
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// packages/core/functions/src/services/credentials.ts
|
|
68
|
-
import { Context as Context4 } from "effect";
|
|
69
|
-
var CredentialsService = class extends Context4.Tag("CredentialsService")() {
|
|
70
|
-
};
|
|
71
|
-
var ConfiguredCredentialsService = class {
|
|
72
|
-
constructor(credentials = []) {
|
|
73
|
-
this.credentials = credentials;
|
|
74
|
-
}
|
|
75
|
-
addCredentials(credentials) {
|
|
76
|
-
this.credentials.push(...credentials);
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
async queryCredentials(query) {
|
|
80
|
-
return this.credentials.filter((credential) => credential.service === query.service);
|
|
81
|
-
}
|
|
82
|
-
async getCredential(query) {
|
|
83
|
-
const credential = this.credentials.find((credential2) => credential2.service === query.service);
|
|
84
|
-
if (!credential) {
|
|
85
|
-
throw new Error(`Credential not found for service: ${query.service}`);
|
|
86
|
-
}
|
|
87
|
-
return credential;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// packages/core/functions/src/services/event-logger.ts
|
|
92
|
-
import { Effect, Context as Context5 } from "effect";
|
|
93
|
-
import { invariant } from "@dxos/invariant";
|
|
94
|
-
import { log, LogLevel } from "@dxos/log";
|
|
95
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/services/event-logger.ts";
|
|
96
|
-
var EventLogger = class extends Context5.Tag("EventLogger")() {
|
|
97
|
-
static {
|
|
98
|
-
this.noop = {
|
|
99
|
-
log: () => {
|
|
100
|
-
},
|
|
101
|
-
nodeId: void 0
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
var logCustomEvent = (data) => Effect.gen(function* () {
|
|
106
|
-
const logger = yield* EventLogger;
|
|
107
|
-
if (!logger.nodeId) {
|
|
108
|
-
throw new Error("logCustomEvent must be called within a node compute function");
|
|
109
|
-
}
|
|
110
|
-
logger.log({
|
|
111
|
-
type: "custom",
|
|
112
|
-
nodeId: logger.nodeId,
|
|
113
|
-
event: data
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
var createDefectLogger = () => Effect.catchAll((error) => Effect.gen(function* () {
|
|
117
|
-
log.error("unhandled effect error", {
|
|
118
|
-
error
|
|
119
|
-
}, {
|
|
120
|
-
F: __dxlog_file,
|
|
121
|
-
L: 65,
|
|
122
|
-
S: this,
|
|
123
|
-
C: (f, a) => f(...a)
|
|
124
|
-
});
|
|
125
|
-
throw error;
|
|
126
|
-
}));
|
|
127
|
-
var createEventLogger = (level, message = "event") => {
|
|
128
|
-
const logFunction = {
|
|
129
|
-
[LogLevel.WARN]: log.warn,
|
|
130
|
-
[LogLevel.VERBOSE]: log.verbose,
|
|
131
|
-
[LogLevel.DEBUG]: log.debug,
|
|
132
|
-
[LogLevel.INFO]: log.info,
|
|
133
|
-
[LogLevel.ERROR]: log.error
|
|
134
|
-
}[level];
|
|
135
|
-
invariant(logFunction, void 0, {
|
|
136
|
-
F: __dxlog_file,
|
|
137
|
-
L: 80,
|
|
138
|
-
S: void 0,
|
|
139
|
-
A: [
|
|
140
|
-
"logFunction",
|
|
141
|
-
""
|
|
142
|
-
]
|
|
143
|
-
});
|
|
144
|
-
return {
|
|
145
|
-
log: (event) => {
|
|
146
|
-
logFunction(message, event);
|
|
147
|
-
},
|
|
148
|
-
nodeId: void 0
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// packages/core/functions/src/services/function-call-service.ts
|
|
153
|
-
import { Context as Context6 } from "effect";
|
|
154
|
-
var FunctionCallService = class extends Context6.Tag("FunctionCallService")() {
|
|
155
|
-
static fromClient(baseUrl, spaceId) {
|
|
156
|
-
return {
|
|
157
|
-
callFunction: async (deployedFunctionId, input) => {
|
|
158
|
-
const url = getInvocationUrl(deployedFunctionId, baseUrl, {
|
|
159
|
-
spaceId
|
|
160
|
-
});
|
|
161
|
-
const result = await fetch(url, {
|
|
162
|
-
method: "POST",
|
|
163
|
-
headers: {
|
|
164
|
-
"Content-Type": "application/json"
|
|
165
|
-
},
|
|
166
|
-
body: JSON.stringify(input)
|
|
167
|
-
});
|
|
168
|
-
if (result.status >= 300 || result.status < 200) {
|
|
169
|
-
throw new Error("Failed to invoke function", {
|
|
170
|
-
cause: new Error(`HTTP error: ${await result.text()}`)
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
return await result.json();
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
static {
|
|
178
|
-
this.mock = () => {
|
|
179
|
-
return {
|
|
180
|
-
callFunction: async (deployedFunctionId, input) => {
|
|
181
|
-
return input;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
var getInvocationUrl = (functionUrl, edgeUrl, options = {}) => {
|
|
188
|
-
const baseUrl = new URL("functions/", edgeUrl);
|
|
189
|
-
const relativeUrl = functionUrl.replace(/^\//, "");
|
|
190
|
-
const url = new URL(`./${relativeUrl}`, baseUrl.toString());
|
|
191
|
-
options.spaceId && url.searchParams.set("spaceId", options.spaceId);
|
|
192
|
-
options.subjectId && url.searchParams.set("subjectId", options.subjectId);
|
|
193
|
-
url.protocol = isSecure(url.protocol) ? "https" : "http";
|
|
194
|
-
return url.toString();
|
|
195
|
-
};
|
|
196
|
-
var isSecure = (protocol) => {
|
|
197
|
-
return protocol === "https:" || protocol === "wss:";
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// packages/core/functions/src/services/tracing.ts
|
|
201
|
-
import { Context as Context7 } from "effect";
|
|
202
|
-
var TracingService = class extends Context7.Tag("TracingService")() {
|
|
203
|
-
static {
|
|
204
|
-
this.noop = {
|
|
205
|
-
write: () => {
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
static {
|
|
210
|
-
this.console = {
|
|
211
|
-
write: (event) => {
|
|
212
|
-
console.log(event);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
// packages/core/functions/src/services/service-container.ts
|
|
219
|
-
import { Layer as Layer4 } from "effect";
|
|
220
|
-
var SERVICE_MAPPING = {
|
|
221
|
-
[AiService.key]: "ai",
|
|
222
|
-
[CredentialsService.key]: "credentials",
|
|
223
|
-
[DatabaseService.key]: "database",
|
|
224
|
-
[EventLogger.key]: "eventLogger",
|
|
225
|
-
[FunctionCallService.key]: "functionCallService",
|
|
226
|
-
[QueueService.key]: "queues",
|
|
227
|
-
[TracingService.key]: "tracing"
|
|
228
|
-
};
|
|
229
|
-
var SERVICE_TAGS = [
|
|
230
|
-
AiService,
|
|
231
|
-
CredentialsService,
|
|
232
|
-
DatabaseService,
|
|
233
|
-
EventLogger,
|
|
234
|
-
FunctionCallService,
|
|
235
|
-
TracingService,
|
|
236
|
-
QueueService
|
|
237
|
-
];
|
|
238
|
-
var DEFAULT_SERVICES = {
|
|
239
|
-
tracing: TracingService.noop
|
|
240
|
-
};
|
|
241
|
-
var ServiceContainer = class _ServiceContainer {
|
|
242
|
-
constructor() {
|
|
243
|
-
this._services = {
|
|
244
|
-
...DEFAULT_SERVICES
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Set services.
|
|
249
|
-
* @param services - Services to set.
|
|
250
|
-
* @returns The container instance.
|
|
251
|
-
*/
|
|
252
|
-
setServices(services) {
|
|
253
|
-
this._services = {
|
|
254
|
-
...this._services,
|
|
255
|
-
...services
|
|
256
|
-
};
|
|
257
|
-
return this;
|
|
258
|
-
}
|
|
259
|
-
getService(tag) {
|
|
260
|
-
const serviceKey = SERVICE_MAPPING[tag.key];
|
|
261
|
-
const service = serviceKey != null ? this._services[serviceKey] : void 0;
|
|
262
|
-
if (!service) {
|
|
263
|
-
throw new Error(`Service not available: ${tag.key}`);
|
|
264
|
-
}
|
|
265
|
-
return service;
|
|
266
|
-
}
|
|
267
|
-
clone() {
|
|
268
|
-
return new _ServiceContainer().setServices({
|
|
269
|
-
...this._services
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
// TODO(dmaretskyi): `getService` is designed to error at runtime if the service is not available, but layer forces us to provide all services and makes stubs for the ones that are not available.
|
|
273
|
-
createLayer() {
|
|
274
|
-
const ai = this._services.ai != null ? Layer4.succeed(AiService, this._services.ai) : AiService.notAvailable;
|
|
275
|
-
const credentials = Layer4.succeed(CredentialsService, new ConfiguredCredentialsService());
|
|
276
|
-
const database = this._services.database != null ? Layer4.succeed(DatabaseService, this._services.database) : DatabaseService.notAvailable;
|
|
277
|
-
const queues = this._services.queues != null ? Layer4.succeed(QueueService, this._services.queues) : QueueService.notAvailable;
|
|
278
|
-
const tracing = Layer4.succeed(TracingService, this._services.tracing ?? TracingService.noop);
|
|
279
|
-
const eventLogger = Layer4.succeed(EventLogger, this._services.eventLogger ?? EventLogger.noop);
|
|
280
|
-
const functionCallService = Layer4.succeed(FunctionCallService, this._services.functionCallService ?? FunctionCallService.mock());
|
|
281
|
-
return Layer4.mergeAll(ai, credentials, database, queues, tracing, eventLogger, functionCallService);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
export {
|
|
286
|
-
AiService,
|
|
287
|
-
DatabaseService,
|
|
288
|
-
QueueService,
|
|
289
|
-
CredentialsService,
|
|
290
|
-
ConfiguredCredentialsService,
|
|
291
|
-
EventLogger,
|
|
292
|
-
logCustomEvent,
|
|
293
|
-
createDefectLogger,
|
|
294
|
-
createEventLogger,
|
|
295
|
-
FunctionCallService,
|
|
296
|
-
TracingService,
|
|
297
|
-
SERVICE_TAGS,
|
|
298
|
-
ServiceContainer
|
|
299
|
-
};
|
|
300
|
-
//# sourceMappingURL=chunk-WEFZUEL2.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/services/ai.ts", "../../../src/services/database.ts", "../../../src/services/queues.ts", "../../../src/services/credentials.ts", "../../../src/services/event-logger.ts", "../../../src/services/function-call-service.ts", "../../../src/services/tracing.ts", "../../../src/services/service-container.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Layer } from 'effect';\n\nimport type { AiServiceClient } from '@dxos/ai';\n\n// TODO(burdon): Move to @dxos/ai.\nexport class AiService extends Context.Tag('AiService')<\n AiService,\n {\n readonly client: AiServiceClient;\n }\n>() {\n static make = (client: AiServiceClient): Context.Tag.Service<AiService> => {\n return {\n get client() {\n return client;\n },\n };\n };\n\n static makeLayer = (client: AiServiceClient): Layer.Layer<AiService> =>\n Layer.succeed(AiService, AiService.make(client));\n\n static notAvailable = Layer.succeed(AiService, {\n get client(): AiServiceClient {\n throw new Error('AiService not available');\n },\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Layer } from 'effect';\n\nimport type { EchoDatabase } from '@dxos/echo-db';\n\nexport class DatabaseService extends Context.Tag('DatabaseService')<\n DatabaseService,\n {\n readonly db: EchoDatabase;\n }\n>() {\n static notAvailable = Layer.succeed(DatabaseService, {\n get db(): EchoDatabase {\n throw new Error('Database not available');\n },\n });\n\n static make = (db: EchoDatabase): Context.Tag.Service<DatabaseService> => {\n return {\n get db() {\n return db;\n },\n };\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context, Layer } from 'effect';\n\nimport type { Queue, QueueFactory } from '@dxos/echo-db';\n\nexport class QueueService extends Context.Tag('QueueService')<\n QueueService,\n {\n /**\n * API to access the queues.\n */\n readonly queues: QueueFactory;\n\n /**\n * The queue that is used to store the context of the current research.\n */\n // TODO(dmaretskyi): Is this really part of the queue service?\n readonly contextQueue: Queue | undefined;\n }\n>() {\n static notAvailable = Layer.succeed(QueueService, {\n get queues(): QueueFactory {\n throw new Error('Queues not available');\n },\n contextQueue: undefined,\n });\n\n static make = (queues: QueueFactory, contextQueue: Queue | undefined): Context.Tag.Service<QueueService> => {\n return {\n queues,\n contextQueue,\n };\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\ntype CredentialQuery = {\n service?: string;\n};\n\n// TODO(dmaretskyi): Unify with other apis.\n// packages/sdk/schema/src/common/access-token.ts\ntype ServiceCredential = {\n service: string;\n\n // TODO(dmaretskyi): Build out.\n apiKey?: string;\n};\n\nexport class CredentialsService extends Context.Tag('CredentialsService')<\n CredentialsService,\n {\n /**\n * Query all.\n */\n queryCredentials: (query: CredentialQuery) => Promise<ServiceCredential[]>;\n\n /**\n * Get a single credential.\n * @throws {Error} If no credential is found.\n */\n getCredential: (query: CredentialQuery) => Promise<ServiceCredential>;\n }\n>() {}\n\nexport class ConfiguredCredentialsService implements Context.Tag.Service<CredentialsService> {\n constructor(private readonly credentials: ServiceCredential[] = []) {}\n\n addCredentials(credentials: ServiceCredential[]): ConfiguredCredentialsService {\n this.credentials.push(...credentials);\n return this;\n }\n\n async queryCredentials(query: CredentialQuery): Promise<ServiceCredential[]> {\n return this.credentials.filter((credential) => credential.service === query.service);\n }\n\n async getCredential(query: CredentialQuery): Promise<ServiceCredential> {\n const credential = this.credentials.find((credential) => credential.service === query.service);\n if (!credential) {\n throw new Error(`Credential not found for service: ${query.service}`);\n }\n return credential;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect, Context } from 'effect';\n\nimport { invariant } from '@dxos/invariant';\nimport { log, LogLevel } from '@dxos/log';\n\nexport type ComputeEvent =\n | {\n type: 'begin-compute';\n nodeId: string;\n inputs: Record<string, any>;\n }\n | {\n type: 'end-compute';\n nodeId: string;\n outputs: Record<string, any>;\n }\n | {\n type: 'compute-input';\n nodeId: string;\n property: string;\n value: any;\n }\n | {\n type: 'compute-output';\n nodeId: string;\n property: string;\n value: any;\n }\n | {\n type: 'custom';\n nodeId: string;\n event: any;\n };\n\nexport class EventLogger extends Context.Tag('EventLogger')<\n EventLogger,\n { readonly log: (event: ComputeEvent) => void; readonly nodeId: string | undefined }\n>() {\n static noop: Context.Tag.Service<EventLogger> = {\n log: () => {},\n nodeId: undefined,\n };\n}\n\nexport const logCustomEvent = (data: any) =>\n Effect.gen(function* () {\n const logger = yield* EventLogger;\n if (!logger.nodeId) {\n throw new Error('logCustomEvent must be called within a node compute function');\n }\n logger.log({\n type: 'custom',\n nodeId: logger.nodeId,\n event: data,\n });\n });\n\nexport const createDefectLogger = <A, E, R>(): ((self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>) =>\n Effect.catchAll((error) =>\n Effect.gen(function* () {\n log.error('unhandled effect error', { error });\n throw error;\n }),\n );\n\nexport const createEventLogger = (level: LogLevel, message: string = 'event'): Context.Tag.Service<EventLogger> => {\n const logFunction = (\n {\n [LogLevel.WARN]: log.warn,\n [LogLevel.VERBOSE]: log.verbose,\n [LogLevel.DEBUG]: log.debug,\n [LogLevel.INFO]: log.info,\n [LogLevel.ERROR]: log.error,\n } as any\n )[level];\n invariant(logFunction);\n return {\n log: (event: ComputeEvent) => {\n logFunction(message, event);\n },\n nodeId: undefined,\n };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { SpaceId } from '@dxos/keys';\n\n/**\n * Allows calling into other functions.\n */\nexport class FunctionCallService extends Context.Tag('FunctionCallService')<\n FunctionCallService,\n {\n callFunction(deployedFunctionId: string, input: any, spaceId?: SpaceId): Promise<any>;\n }\n>() {\n static fromClient(baseUrl: string, spaceId: SpaceId): Context.Tag.Service<FunctionCallService> {\n return {\n callFunction: async (deployedFunctionId: string, input: any) => {\n const url = getInvocationUrl(deployedFunctionId, baseUrl, { spaceId });\n const result = await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(input),\n });\n if (result.status >= 300 || result.status < 200) {\n throw new Error('Failed to invoke function', { cause: new Error(`HTTP error: ${await result.text()}`) });\n }\n return await result.json();\n },\n };\n }\n\n static mock = () => {\n return {\n callFunction: async (deployedFunctionId: string, input: any) => {\n return input;\n },\n };\n };\n}\n\n// TODO(dmaretskyi): Reconcile with `getInvocationUrl` in `@dxos/functions/edge`.\nconst getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {\n const baseUrl = new URL('functions/', edgeUrl);\n\n // Leading slashes cause the URL to be treated as an absolute path.\n const relativeUrl = functionUrl.replace(/^\\//, '');\n const url = new URL(`./${relativeUrl}`, baseUrl.toString());\n options.spaceId && url.searchParams.set('spaceId', options.spaceId);\n options.subjectId && url.searchParams.set('subjectId', options.subjectId);\n url.protocol = isSecure(url.protocol) ? 'https' : 'http';\n return url.toString();\n};\n\nconst isSecure = (protocol: string) => {\n return protocol === 'https:' || protocol === 'wss:';\n};\n\ntype InvocationOptions = {\n spaceId?: SpaceId;\n subjectId?: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Context } from 'effect';\n\nimport type { AnyEchoObject } from '@dxos/echo-schema';\n\nexport class TracingService extends Context.Tag('TracingService')<\n TracingService,\n {\n /**\n * Write an event to the tracing queue.\n * @param event - The event to write. Must be an a typed object.\n */\n write(event: AnyEchoObject): void;\n }\n>() {\n static noop: Context.Tag.Service<TracingService> = { write: () => {} };\n\n static console: Context.Tag.Service<TracingService> = {\n write: (event) => {\n // eslint-disable-next-line no-console\n console.log(event);\n },\n };\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Layer, type Context } from 'effect';\n\nimport { AiService } from './ai';\nimport { ConfiguredCredentialsService, CredentialsService } from './credentials';\nimport { DatabaseService } from './database';\nimport { EventLogger } from './event-logger';\nimport { FunctionCallService } from './function-call-service';\nimport { QueueService } from './queues';\nimport { TracingService } from './tracing';\n\n/**\n * List of all service tags and their names.\n */\nexport interface ServiceTagRecord {\n ai: AiService;\n credentials: CredentialsService;\n database: DatabaseService;\n eventLogger: EventLogger;\n functionCallService: FunctionCallService;\n tracing: TracingService;\n queues: QueueService;\n}\n\n/**\n * List of all services and their runtime types.\n */\nexport type ServiceRecord = {\n [K in keyof ServiceTagRecord]: Context.Tag.Service<ServiceTagRecord[K]>;\n};\n\n/**\n * Union of all services.\n */\nexport type Services = ServiceTagRecord[keyof ServiceTagRecord];\n\nconst SERVICE_MAPPING: Record<string, keyof ServiceRecord> = {\n [AiService.key]: 'ai',\n [CredentialsService.key]: 'credentials',\n [DatabaseService.key]: 'database',\n [EventLogger.key]: 'eventLogger',\n [FunctionCallService.key]: 'functionCallService',\n [QueueService.key]: 'queues',\n [TracingService.key]: 'tracing',\n};\n\nexport const SERVICE_TAGS: Context.Tag<any, any>[] = [\n AiService,\n CredentialsService,\n DatabaseService,\n EventLogger,\n FunctionCallService,\n TracingService,\n QueueService,\n];\n\nconst DEFAULT_SERVICES: Partial<ServiceRecord> = {\n tracing: TracingService.noop,\n};\n\nexport class ServiceContainer {\n private _services: Partial<ServiceRecord> = { ...DEFAULT_SERVICES };\n\n /**\n * Set services.\n * @param services - Services to set.\n * @returns The container instance.\n */\n setServices(services: Partial<ServiceRecord>): this {\n this._services = { ...this._services, ...services };\n return this;\n }\n\n getService<T extends Context.Tag<any, any>>(tag: T): Context.Tag.Service<T> {\n const serviceKey = SERVICE_MAPPING[tag.key];\n const service = serviceKey != null ? this._services[serviceKey] : undefined;\n if (!service) {\n throw new Error(`Service not available: ${tag.key}`);\n }\n return service as Context.Tag.Service<T>;\n }\n\n clone(): ServiceContainer {\n return new ServiceContainer().setServices({ ...this._services });\n }\n\n // TODO(dmaretskyi): `getService` is designed to error at runtime if the service is not available, but layer forces us to provide all services and makes stubs for the ones that are not available.\n createLayer(): Layer.Layer<Services> {\n const ai = this._services.ai != null ? Layer.succeed(AiService, this._services.ai) : AiService.notAvailable;\n const credentials = Layer.succeed(CredentialsService, new ConfiguredCredentialsService());\n const database =\n this._services.database != null\n ? Layer.succeed(DatabaseService, this._services.database)\n : DatabaseService.notAvailable;\n const queues =\n this._services.queues != null ? Layer.succeed(QueueService, this._services.queues) : QueueService.notAvailable;\n const tracing = Layer.succeed(TracingService, this._services.tracing ?? TracingService.noop);\n const eventLogger = Layer.succeed(EventLogger, this._services.eventLogger ?? EventLogger.noop);\n const functionCallService = Layer.succeed(\n FunctionCallService,\n this._services.functionCallService ?? FunctionCallService.mock(),\n );\n\n return Layer.mergeAll(ai, credentials, database, queues, tracing, eventLogger, functionCallService);\n }\n}\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,SAASC,aAAa;AAKxB,IAAMC,YAAN,MAAMA,mBAAkBC,QAAQC,IAAI,WAAA,EAAA,EAAA;EAMzC;SAAOC,OAAO,CAACC,WAAAA;AACb,aAAO;QACL,IAAIA,SAAS;AACX,iBAAOA;QACT;MACF;IACF;;EAEA;SAAOC,YAAY,CAACD,WAClBE,MAAMC,QAAQP,YAAWA,WAAUG,KAAKC,MAAAA,CAAAA;;EAE1C;SAAOI,eAAeF,MAAMC,QAAQP,YAAW;MAC7C,IAAII,SAA0B;AAC5B,cAAM,IAAIK,MAAM,yBAAA;MAClB;IACF,CAAA;;AACF;;;AC3BA,SAASC,WAAAA,UAASC,SAAAA,cAAa;AAIxB,IAAMC,kBAAN,MAAMA,yBAAwBC,SAAQC,IAAI,iBAAA,EAAA,EAAA;EAM/C;SAAOC,eAAeC,OAAMC,QAAQL,kBAAiB;MACnD,IAAIM,KAAmB;AACrB,cAAM,IAAIC,MAAM,wBAAA;MAClB;IACF,CAAA;;EAEA;SAAOC,OAAO,CAACF,OAAAA;AACb,aAAO;QACL,IAAIA,KAAK;AACP,iBAAOA;QACT;MACF;IACF;;AACF;;;ACvBA,SAASG,WAAAA,UAASC,SAAAA,cAAa;AAIxB,IAAMC,eAAN,MAAMA,sBAAqBC,SAAQC,IAAI,cAAA,EAAA,EAAA;EAe5C;SAAOC,eAAeC,OAAMC,QAAQL,eAAc;MAChD,IAAIM,SAAuB;AACzB,cAAM,IAAIC,MAAM,sBAAA;MAClB;MACAC,cAAcC;IAChB,CAAA;;EAEA;SAAOC,OAAO,CAACJ,QAAsBE,iBAAAA;AACnC,aAAO;QACLF;QACAE;MACF;IACF;;AACF;;;AChCA,SAASG,WAAAA,gBAAe;AAejB,IAAMC,qBAAN,cAAiCC,SAAQC,IAAI,oBAAA,EAAA,EAAA;AAc/C;AAEE,IAAMC,+BAAN,MAAMA;EACX,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AAUD,cAAc,OAAO,KAAKL,UAAUK,UAAAA,IAAcE;AAClE,QAAI,CAACD,SAAS;AACZ,YAAM,IAAIE,MAAM,0BAA0BJ,IAAIhB,GAAG,EAAE;IACrD;AACA,WAAOkB;EACT;EAEAG,QAA0B;AACxB,WAAO,IAAIV,kBAAAA,EAAmBE,YAAY;MAAE,GAAG,KAAKD;IAAU,CAAA;EAChE;;EAGAU,cAAqC;AACnC,UAAMC,KAAK,KAAKX,UAAUW,MAAM,OAAOC,OAAMC,QAAQ1B,WAAW,KAAKa,UAAUW,EAAE,IAAIxB,UAAU2B;AAC/F,UAAMC,cAAcH,OAAMC,QAAQxB,oBAAoB,IAAI2B,6BAAAA,CAAAA;AAC1D,UAAMC,WACJ,KAAKjB,UAAUiB,YAAY,OACvBL,OAAMC,QAAQvB,iBAAiB,KAAKU,UAAUiB,QAAQ,IACtD3B,gBAAgBwB;AACtB,UAAMI,SACJ,KAAKlB,UAAUkB,UAAU,OAAON,OAAMC,QAAQpB,cAAc,KAAKO,UAAUkB,MAAM,IAAIzB,aAAaqB;AACpG,UAAMjB,UAAUe,OAAMC,QAAQnB,gBAAgB,KAAKM,UAAUH,WAAWH,eAAeI,IAAI;AAC3F,UAAMqB,cAAcP,OAAMC,QAAQtB,aAAa,KAAKS,UAAUmB,eAAe5B,YAAYO,IAAI;AAC7F,UAAMsB,sBAAsBR,OAAMC,QAChCrB,qBACA,KAAKQ,UAAUoB,uBAAuB5B,oBAAoB6B,KAAI,CAAA;AAGhE,WAAOT,OAAMU,SAASX,IAAII,aAAaE,UAAUC,QAAQrB,SAASsB,aAAaC,mBAAAA;EACjF;AACF;",
|
|
6
|
-
"names": ["Context", "Layer", "AiService", "Context", "Tag", "make", "client", "makeLayer", "Layer", "succeed", "notAvailable", "Error", "Context", "Layer", "DatabaseService", "Context", "Tag", "notAvailable", "Layer", "succeed", "db", "Error", "make", "Context", "Layer", "QueueService", "Context", "Tag", "notAvailable", "Layer", "succeed", "queues", "Error", "contextQueue", "undefined", "make", "Context", "CredentialsService", "Context", "Tag", "ConfiguredCredentialsService", "credentials", "addCredentials", "push", "queryCredentials", "query", "filter", "credential", "service", "getCredential", "find", "Error", "Effect", "Context", "invariant", "log", "LogLevel", "EventLogger", "Tag", "noop", "nodeId", "undefined", "logCustomEvent", "data", "gen", "logger", "Error", "type", "event", "createDefectLogger", "catchAll", "error", "createEventLogger", "level", "message", "logFunction", "WARN", "warn", "VERBOSE", "verbose", "DEBUG", "debug", "INFO", "info", "ERROR", "Context", "FunctionCallService", "Context", "Tag", "fromClient", "baseUrl", "spaceId", "callFunction", "deployedFunctionId", "input", "url", "getInvocationUrl", "result", "fetch", "method", "headers", "body", "JSON", "stringify", "status", "Error", "cause", "text", "json", "mock", "functionUrl", "edgeUrl", "options", "URL", "relativeUrl", "replace", "toString", "searchParams", "set", "subjectId", "protocol", "isSecure", "Context", "TracingService", "Context", "Tag", "noop", "write", "console", "event", "log", "Layer", "SERVICE_MAPPING", "AiService", "key", "CredentialsService", "DatabaseService", "EventLogger", "FunctionCallService", "QueueService", "TracingService", "SERVICE_TAGS", "DEFAULT_SERVICES", "tracing", "noop", "ServiceContainer", "_services", "setServices", "services", "getService", "tag", "serviceKey", "service", "undefined", "Error", "clone", "createLayer", "ai", "Layer", "succeed", "notAvailable", "credentials", "ConfiguredCredentialsService", "database", "queues", "eventLogger", "functionCallService", "mock", "mergeAll"]
|
|
7
|
-
}
|