@dxos/functions 0.8.2-main.2f9c567 → 0.8.2-main.30e4dbb

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.
@@ -6,7 +6,7 @@ export declare const setUserFunctionUrlInMetadata: (meta: ObjectMeta, functionUr
6
6
  /**
7
7
  * NOTE: functionId is backend ID, not ECHO object id.
8
8
  */
9
- export declare const makeFunctionUrl: (spaceId: SpaceId, fn: {
9
+ export declare const makeFunctionUrl: (fn: {
10
10
  functionId: string;
11
11
  }) => string;
12
12
  export declare const getInvocationUrl: (functionUrl: string, edgeUrl: string, options?: InvocationOptions) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAM5E,eAAO,MAAM,4BAA4B,SAAU,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,UAAU,eAAe,MAAM,SASjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,OAAO,MAAM;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,WAAmC,CAAC;AAEhH,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WAAW,MAAM,YAAW,iBAAiB,WAUhG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/url.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAK1C,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAM5E,eAAO,MAAM,4BAA4B,GAAI,MAAM,UAAU,uBAE5D,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,MAAM,UAAU,EAAE,aAAa,MAAM,SASjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,WAAwB,CAAC;AAEnF,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,EAAE,SAAS,MAAM,EAAE,UAAS,iBAAsB,WAUrG,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":"5.7.3"}
1
+ {"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/functions",
3
- "version": "0.8.2-main.2f9c567",
3
+ "version": "0.8.2-main.30e4dbb",
4
4
  "description": "Functions API and runtime.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -51,28 +51,28 @@
51
51
  "get-port-please": "^3.1.1",
52
52
  "iso-did": "^1.6.0",
53
53
  "ws": "^8.14.2",
54
- "@dxos/assistant": "0.8.2-main.2f9c567",
55
- "@dxos/async": "0.8.2-main.2f9c567",
56
- "@dxos/client": "0.8.2-main.2f9c567",
57
- "@dxos/context": "0.8.2-main.2f9c567",
58
- "@dxos/echo-db": "0.8.2-main.2f9c567",
59
- "@dxos/echo-schema": "0.8.2-main.2f9c567",
60
- "@dxos/echo-protocol": "0.8.2-main.2f9c567",
61
- "@dxos/edge-client": "0.8.2-main.2f9c567",
62
- "@dxos/crypto": "0.8.2-main.2f9c567",
63
- "@dxos/invariant": "0.8.2-main.2f9c567",
64
- "@dxos/keys": "0.8.2-main.2f9c567",
65
- "@dxos/log": "0.8.2-main.2f9c567",
66
- "@dxos/node-std": "0.8.2-main.2f9c567",
67
- "@dxos/live-object": "0.8.2-main.2f9c567",
68
- "@dxos/protocols": "0.8.2-main.2f9c567",
69
- "@dxos/schema": "0.8.2-main.2f9c567",
70
- "@dxos/util": "0.8.2-main.2f9c567"
54
+ "@dxos/assistant": "0.8.2-main.30e4dbb",
55
+ "@dxos/client": "0.8.2-main.30e4dbb",
56
+ "@dxos/context": "0.8.2-main.30e4dbb",
57
+ "@dxos/async": "0.8.2-main.30e4dbb",
58
+ "@dxos/echo-db": "0.8.2-main.30e4dbb",
59
+ "@dxos/crypto": "0.8.2-main.30e4dbb",
60
+ "@dxos/echo-protocol": "0.8.2-main.30e4dbb",
61
+ "@dxos/echo-schema": "0.8.2-main.30e4dbb",
62
+ "@dxos/invariant": "0.8.2-main.30e4dbb",
63
+ "@dxos/live-object": "0.8.2-main.30e4dbb",
64
+ "@dxos/edge-client": "0.8.2-main.30e4dbb",
65
+ "@dxos/keys": "0.8.2-main.30e4dbb",
66
+ "@dxos/log": "0.8.2-main.30e4dbb",
67
+ "@dxos/node-std": "0.8.2-main.30e4dbb",
68
+ "@dxos/protocols": "0.8.2-main.30e4dbb",
69
+ "@dxos/schema": "0.8.2-main.30e4dbb",
70
+ "@dxos/util": "0.8.2-main.30e4dbb"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/express": "^4.17.17",
74
74
  "@types/ws": "^7.4.0",
75
- "@dxos/agent": "0.8.2-main.2f9c567"
75
+ "@dxos/agent": "0.8.2-main.30e4dbb"
76
76
  },
77
77
  "publishConfig": {
78
78
  "access": "public"
@@ -8,13 +8,12 @@ import { type Client } from '@dxos/client';
8
8
  import { createEdgeIdentity } from '@dxos/client/edge';
9
9
  import { EdgeHttpClient } from '@dxos/edge-client';
10
10
  import { invariant } from '@dxos/invariant';
11
- import type { PublicKey, SpaceId } from '@dxos/keys';
11
+ import type { PublicKey } from '@dxos/keys';
12
12
  import { log } from '@dxos/log';
13
13
  import { type UploadFunctionResponseBody } from '@dxos/protocols';
14
14
 
15
15
  export type UploadWorkerArgs = {
16
16
  client: Client;
17
- spaceId: SpaceId;
18
17
  source: string;
19
18
  version: string;
20
19
  name?: string;
@@ -23,7 +22,6 @@ export type UploadWorkerArgs = {
23
22
 
24
23
  export const uploadWorkerFunction = async ({
25
24
  client,
26
- spaceId,
27
25
  version,
28
26
  source,
29
27
  name,
@@ -34,7 +32,7 @@ export const uploadWorkerFunction = async ({
34
32
  const edgeClient = new EdgeHttpClient(edgeUrl);
35
33
  const edgeIdentity = createEdgeIdentity(client);
36
34
  edgeClient.setIdentity(edgeIdentity);
37
- const response = await edgeClient.uploadFunction({ spaceId, functionId }, { name, version, script: source });
35
+ const response = await edgeClient.uploadFunction({ functionId }, { name, version, script: source });
38
36
 
39
37
  // TODO(burdon): Edge service log.
40
38
  log.info('Uploaded', {
package/src/handler.ts CHANGED
@@ -2,10 +2,11 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S } from 'effect';
5
+ import { Schema } from 'effect';
6
6
  import { type Effect } from 'effect';
7
7
 
8
8
  import { type AIServiceClient } from '@dxos/assistant';
9
+ // import { type Space } from '@dxos/client/echo';
9
10
  import type { CoreDatabase, EchoDatabase } from '@dxos/echo-db';
10
11
  import { type HasId } from '@dxos/echo-schema';
11
12
  import { type SpaceId, type DXN } from '@dxos/keys';
@@ -77,20 +78,21 @@ export interface SpaceAPI {
77
78
  get queues(): QueuesAPI;
78
79
  }
79
80
 
81
+ // TODO(wittjosiah): Queues are incompatible.
80
82
  const __assertFunctionSpaceIsCompatibleWithTheClientSpace = () => {
81
- const _: SpaceAPI = {} as SpaceAPI;
83
+ // const _: SpaceAPI = {} as Space;
82
84
  };
83
85
 
84
86
  export type FunctionDefinition<T = {}, O = any> = {
85
87
  description?: string;
86
- inputSchema: S.Schema<T, any>;
87
- outputSchema?: S.Schema<O, any>;
88
+ inputSchema: Schema.Schema<T, any>;
89
+ outputSchema?: Schema.Schema<O, any>;
88
90
  handler: FunctionHandler<T, O>;
89
91
  };
90
92
 
91
93
  // TODO(dmaretskyi): Bind input type to function handler.
92
94
  export const defineFunction = <T, O>(params: FunctionDefinition<T, O>): FunctionDefinition<T, O> => {
93
- if (!S.isSchema(params.inputSchema)) {
95
+ if (!Schema.isSchema(params.inputSchema)) {
94
96
  throw new Error('Input schema must be a valid schema');
95
97
  }
96
98
  if (typeof params.handler !== 'function') {
@@ -100,7 +102,7 @@ export const defineFunction = <T, O>(params: FunctionDefinition<T, O>): Function
100
102
  return {
101
103
  description: params.description,
102
104
  inputSchema: params.inputSchema,
103
- outputSchema: params.outputSchema ?? S.Any,
105
+ outputSchema: params.outputSchema ?? Schema.Any,
104
106
  handler: params.handler,
105
107
  };
106
108
  };
package/src/types.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema as S, SchemaAST } from 'effect';
5
+ import { Schema, SchemaAST } from 'effect';
6
6
 
7
7
  import { Expando, OptionsAnnotationId, TypedObject, DXN, Ref, RawObject } from '@dxos/echo-schema';
8
8
 
@@ -21,84 +21,78 @@ export enum TriggerKind {
21
21
  Queue = 'queue',
22
22
  }
23
23
 
24
- // TODO(burdon): Rename prop kind.
25
- const typeLiteralAnnotations = { [SchemaAST.TitleAnnotationId]: 'Type' };
24
+ const kindLiteralAnnotations = { [SchemaAST.TitleAnnotationId]: 'Kind' };
26
25
 
27
26
  /**
28
27
  * Cron timer.
29
28
  */
30
- const TimerTriggerSchema = S.Struct({
31
- type: S.Literal(TriggerKind.Timer).annotations(typeLiteralAnnotations),
32
- cron: S.String.annotations({
29
+ const TimerTriggerSchema = Schema.Struct({
30
+ kind: Schema.Literal(TriggerKind.Timer).annotations(kindLiteralAnnotations),
31
+ cron: Schema.String.annotations({
33
32
  [SchemaAST.TitleAnnotationId]: 'Cron',
34
33
  [SchemaAST.ExamplesAnnotationId]: ['0 0 * * *'],
35
34
  }),
36
- }).pipe(S.mutable);
35
+ }).pipe(Schema.mutable);
36
+ export type TimerTrigger = Schema.Schema.Type<typeof TimerTriggerSchema>;
37
37
 
38
- export type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;
38
+ const EmailTriggerSchema = Schema.Struct({
39
+ kind: Schema.Literal(TriggerKind.Email).annotations(kindLiteralAnnotations),
40
+ }).pipe(Schema.mutable);
41
+ export type EmailTrigger = Schema.Schema.Type<typeof EmailTriggerSchema>;
39
42
 
40
- const EmailTriggerSchema = S.Struct({
41
- type: S.Literal(TriggerKind.Email).annotations(typeLiteralAnnotations),
42
- }).pipe(S.mutable);
43
-
44
- export type EmailTrigger = S.Schema.Type<typeof EmailTriggerSchema>;
45
-
46
- const QueueTriggerSchema = S.Struct({
47
- type: S.Literal(TriggerKind.Queue).annotations(typeLiteralAnnotations),
43
+ const QueueTriggerSchema = Schema.Struct({
44
+ kind: Schema.Literal(TriggerKind.Queue).annotations(kindLiteralAnnotations),
48
45
  queue: DXN,
49
- }).pipe(S.mutable);
50
-
51
- export type QueueTrigger = S.Schema.Type<typeof QueueTriggerSchema>;
46
+ }).pipe(Schema.mutable);
47
+ export type QueueTrigger = Schema.Schema.Type<typeof QueueTriggerSchema>;
52
48
 
53
49
  /**
54
50
  * Webhook.
55
51
  */
56
- const WebhookTriggerSchema = S.Struct({
57
- type: S.Literal(TriggerKind.Webhook).annotations(typeLiteralAnnotations),
58
- method: S.optional(
59
- S.String.annotations({
52
+ const WebhookTriggerSchema = Schema.Struct({
53
+ kind: Schema.Literal(TriggerKind.Webhook).annotations(kindLiteralAnnotations),
54
+ method: Schema.optional(
55
+ Schema.String.annotations({
60
56
  [SchemaAST.TitleAnnotationId]: 'Method',
61
57
  [OptionsAnnotationId]: ['GET', 'POST'],
62
58
  }),
63
59
  ),
64
- port: S.optional(
65
- S.Number.annotations({
60
+ port: Schema.optional(
61
+ Schema.Number.annotations({
66
62
  [SchemaAST.TitleAnnotationId]: 'Port',
67
63
  }),
68
64
  ),
69
- }).pipe(S.mutable);
70
-
71
- export type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;
65
+ }).pipe(Schema.mutable);
66
+ export type WebhookTrigger = Schema.Schema.Type<typeof WebhookTriggerSchema>;
72
67
 
73
68
  // TODO(burdon): Use ECHO definition (from https://github.com/dxos/dxos/pull/8233).
74
- const QuerySchema = S.Struct({
75
- type: S.optional(S.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Type' })),
76
- props: S.optional(S.Record({ key: S.String, value: S.Any })),
69
+ const QuerySchema = Schema.Struct({
70
+ type: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Type' })),
71
+ props: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
77
72
  }).annotations({ [SchemaAST.TitleAnnotationId]: 'Query' });
78
73
 
79
74
  /**
80
75
  * Subscription.
81
76
  */
82
- const SubscriptionTriggerSchema = S.Struct({
83
- type: S.Literal(TriggerKind.Subscription).annotations(typeLiteralAnnotations),
77
+ const SubscriptionTriggerSchema = Schema.Struct({
78
+ kind: Schema.Literal(TriggerKind.Subscription).annotations(kindLiteralAnnotations),
84
79
  // TODO(burdon): Define query DSL (from ECHO). Reconcile with Table.Query.
85
80
  filter: QuerySchema,
86
- options: S.optional(
87
- S.Struct({
81
+ options: Schema.optional(
82
+ Schema.Struct({
88
83
  // Watch changes to object (not just creation).
89
- deep: S.optional(S.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Nested' })),
84
+ deep: Schema.optional(Schema.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Nested' })),
90
85
  // Debounce changes (delay in ms).
91
- delay: S.optional(S.Number.annotations({ [SchemaAST.TitleAnnotationId]: 'Delay' })),
86
+ delay: Schema.optional(Schema.Number.annotations({ [SchemaAST.TitleAnnotationId]: 'Delay' })),
92
87
  }).annotations({ [SchemaAST.TitleAnnotationId]: 'Options' }),
93
88
  ),
94
- }).pipe(S.mutable);
95
-
96
- export type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;
89
+ }).pipe(Schema.mutable);
90
+ export type SubscriptionTrigger = Schema.Schema.Type<typeof SubscriptionTriggerSchema>;
97
91
 
98
92
  /**
99
93
  * Trigger schema (discriminated union).
100
94
  */
101
- export const TriggerSchema = S.Union(
95
+ export const TriggerSchema = Schema.Union(
102
96
  TimerTriggerSchema,
103
97
  WebhookTriggerSchema,
104
98
  SubscriptionTriggerSchema,
@@ -107,7 +101,7 @@ export const TriggerSchema = S.Union(
107
101
  ).annotations({
108
102
  [SchemaAST.TitleAnnotationId]: 'Trigger',
109
103
  });
110
- export type TriggerType = S.Schema.Type<typeof TriggerSchema>;
104
+ export type TriggerType = Schema.Schema.Type<typeof TriggerSchema>;
111
105
 
112
106
  export type EventType =
113
107
  | EmailTriggerOutput
@@ -117,64 +111,66 @@ export type EventType =
117
111
  | TimerTriggerOutput;
118
112
 
119
113
  // TODO(burdon): Reuse trigger schema from @dxos/functions (TriggerType).
120
- export const EmailTriggerOutput = S.mutable(
121
- S.Struct({
122
- from: S.String,
123
- to: S.String,
124
- subject: S.String,
125
- created: S.String,
126
- body: S.String,
114
+ export const EmailTriggerOutput = Schema.mutable(
115
+ Schema.Struct({
116
+ from: Schema.String,
117
+ to: Schema.String,
118
+ subject: Schema.String,
119
+ created: Schema.String,
120
+ body: Schema.String,
127
121
  }),
128
122
  );
129
- export type EmailTriggerOutput = S.Schema.Type<typeof EmailTriggerOutput>;
130
-
131
- export const WebhookTriggerOutput = S.mutable(
132
- S.Struct({
133
- url: S.String,
134
- method: S.Literal('GET', 'POST'),
135
- headers: S.Record({ key: S.String, value: S.String }),
136
- bodyText: S.String,
123
+ export type EmailTriggerOutput = Schema.Schema.Type<typeof EmailTriggerOutput>;
124
+
125
+ export const WebhookTriggerOutput = Schema.mutable(
126
+ Schema.Struct({
127
+ url: Schema.String,
128
+ method: Schema.Literal('GET', 'POST'),
129
+ headers: Schema.Record({ key: Schema.String, value: Schema.String }),
130
+ bodyText: Schema.String,
137
131
  }),
138
132
  );
139
- export type WebhookTriggerOutput = S.Schema.Type<typeof WebhookTriggerOutput>;
133
+ export type WebhookTriggerOutput = Schema.Schema.Type<typeof WebhookTriggerOutput>;
140
134
 
141
- export const QueueTriggerOutput = S.mutable(
142
- S.Struct({
135
+ export const QueueTriggerOutput = Schema.mutable(
136
+ Schema.Struct({
143
137
  queue: DXN,
144
- item: S.Any,
145
- cursor: S.String,
138
+ item: Schema.Any,
139
+ cursor: Schema.String,
146
140
  }),
147
141
  );
148
- export type QueueTriggerOutput = S.Schema.Type<typeof QueueTriggerOutput>;
142
+ export type QueueTriggerOutput = Schema.Schema.Type<typeof QueueTriggerOutput>;
149
143
 
150
- export const SubscriptionTriggerOutput = S.mutable(S.Struct({ type: S.String, changedObjectId: S.String }));
151
- export type SubscriptionTriggerOutput = S.Schema.Type<typeof SubscriptionTriggerOutput>;
144
+ export const SubscriptionTriggerOutput = Schema.mutable(
145
+ Schema.Struct({ type: Schema.String, changedObjectId: Schema.String }),
146
+ );
147
+ export type SubscriptionTriggerOutput = Schema.Schema.Type<typeof SubscriptionTriggerOutput>;
152
148
 
153
- export const TimerTriggerOutput = S.mutable(S.Struct({ tick: S.Number }));
154
- export type TimerTriggerOutput = S.Schema.Type<typeof TimerTriggerOutput>;
149
+ export const TimerTriggerOutput = Schema.mutable(Schema.Struct({ tick: Schema.Number }));
150
+ export type TimerTriggerOutput = Schema.Schema.Type<typeof TimerTriggerOutput>;
155
151
 
156
152
  /**
157
153
  * Function trigger.
158
154
  * Function is invoked with the `payload` passed as input data.
159
155
  * The event that triggers the function is available in the function context.
160
156
  */
161
- export const FunctionTriggerSchema = S.Struct({
157
+ export const FunctionTriggerSchema = Schema.Struct({
162
158
  /**
163
159
  * Function or workflow to invoke.
164
160
  */
165
161
  // TODO(dmaretskyi): Can be a Ref(FunctionType) or Ref(ComputeGraphType).
166
- function: S.optional(Ref(Expando).annotations({ [SchemaAST.TitleAnnotationId]: 'Function' })),
162
+ function: Schema.optional(Ref(Expando).annotations({ [SchemaAST.TitleAnnotationId]: 'Function' })),
167
163
 
168
164
  /**
169
- * Only used for workflows.
165
+ * Only used for workflowSchema.
170
166
  * Specifies the input node in the circuit.
171
- * @deprecated Remove and enforce a single input node in all compute graphs.
167
+ * @deprecated Remove and enforce a single input node in all compute graphSchema.
172
168
  */
173
- inputNodeId: S.optional(S.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Input Node ID' })),
169
+ inputNodeId: Schema.optional(Schema.String.annotations({ [SchemaAST.TitleAnnotationId]: 'Input Node ID' })),
174
170
 
175
- enabled: S.optional(S.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Enabled' })),
171
+ enabled: Schema.optional(Schema.Boolean.annotations({ [SchemaAST.TitleAnnotationId]: 'Enabled' })),
176
172
 
177
- spec: S.optional(TriggerSchema),
173
+ spec: Schema.optional(TriggerSchema),
178
174
 
179
175
  /**
180
176
  * Passed as the input data to the function.
@@ -187,17 +183,17 @@ export const FunctionTriggerSchema = S.Struct({
187
183
  * mailbox: { '/': 'dxn:echo:AAA:ZZZ' }
188
184
  * }
189
185
  */
190
- input: S.optional(S.mutable(S.Record({ key: S.String, value: S.Any }))),
186
+ input: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any }))),
191
187
  });
192
188
 
193
- export type FunctionTriggerType = S.Schema.Type<typeof FunctionTriggerSchema>;
189
+ export type FunctionTriggerType = Schema.Schema.Type<typeof FunctionTriggerSchema>;
194
190
 
195
191
  /**
196
192
  * Function trigger.
197
193
  */
198
194
  export class FunctionTrigger extends TypedObject({
199
195
  typename: 'dxos.org/type/FunctionTrigger',
200
- version: '0.1.0',
196
+ version: '0.2.0',
201
197
  })(FunctionTriggerSchema.fields) {}
202
198
 
203
199
  // TODO(wittjosiah): Remove?
@@ -205,10 +201,10 @@ export class FunctionTrigger extends TypedObject({
205
201
  /**
206
202
  * Function manifest file.
207
203
  */
208
- export const FunctionManifestSchema = S.Struct({
209
- functions: S.optional(S.mutable(S.Array(RawObject(FunctionType)))),
210
- triggers: S.optional(S.mutable(S.Array(RawObject(FunctionTrigger)))),
204
+ export const FunctionManifestSchema = Schema.Struct({
205
+ functions: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionType)))),
206
+ triggers: Schema.optional(Schema.mutable(Schema.Array(RawObject(FunctionTrigger)))),
211
207
  });
212
- export type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;
208
+ export type FunctionManifest = Schema.Schema.Type<typeof FunctionManifestSchema>;
213
209
 
214
210
  export const FUNCTION_TYPES = [FunctionType, FunctionTrigger];
package/src/url.ts CHANGED
@@ -32,7 +32,7 @@ export const setUserFunctionUrlInMetadata = (meta: ObjectMeta, functionUrl: stri
32
32
  /**
33
33
  * NOTE: functionId is backend ID, not ECHO object id.
34
34
  */
35
- export const makeFunctionUrl = (spaceId: SpaceId, fn: { functionId: string }) => `/${spaceId}/${fn.functionId}`;
35
+ export const makeFunctionUrl = (fn: { functionId: string }) => `/${fn.functionId}`;
36
36
 
37
37
  export const getInvocationUrl = (functionUrl: string, edgeUrl: string, options: InvocationOptions = {}) => {
38
38
  const baseUrl = new URL('functions/', edgeUrl);