@dxos/functions 0.5.3-main.a3ea5f1 → 0.5.3-main.ac34611

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/lib/browser/{chunk-366QG6IX.mjs → chunk-HRU7VDYL.mjs} +14 -8
  2. package/dist/lib/browser/chunk-HRU7VDYL.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +85 -49
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/types.mjs +3 -1
  7. package/dist/lib/node/{chunk-3VSJ57ZZ.cjs → chunk-R5JUDLSN.cjs} +17 -10
  8. package/dist/lib/node/chunk-R5JUDLSN.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +100 -60
  10. package/dist/lib/node/index.cjs.map +4 -4
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/types.cjs +6 -4
  13. package/dist/lib/node/types.cjs.map +2 -2
  14. package/dist/types/src/browser/index.d.ts +2 -0
  15. package/dist/types/src/browser/index.d.ts.map +1 -0
  16. package/dist/types/src/function/function-registry.d.ts.map +1 -1
  17. package/dist/types/src/handler.d.ts.map +1 -1
  18. package/dist/types/src/runtime/scheduler.d.ts +1 -1
  19. package/dist/types/src/runtime/scheduler.d.ts.map +1 -1
  20. package/dist/types/src/trigger/trigger-registry.d.ts.map +1 -1
  21. package/dist/types/src/types.d.ts +34 -30
  22. package/dist/types/src/types.d.ts.map +1 -1
  23. package/package.json +14 -14
  24. package/src/browser/index.ts +5 -0
  25. package/src/function/function-registry.ts +5 -5
  26. package/src/runtime/scheduler.ts +7 -2
  27. package/src/trigger/trigger-registry.ts +23 -11
  28. package/src/types.ts +37 -27
  29. package/dist/lib/browser/chunk-366QG6IX.mjs.map +0 -7
  30. package/dist/lib/node/chunk-3VSJ57ZZ.cjs.map +0 -7
  31. package/dist/types/src/util.d.ts +0 -15
  32. package/dist/types/src/util.d.ts.map +0 -1
  33. package/dist/types/src/util.test.d.ts +0 -2
  34. package/dist/types/src/util.test.d.ts.map +0 -1
  35. package/src/util.test.ts +0 -43
  36. package/src/util.ts +0 -48
@@ -16,7 +16,7 @@ import {
16
16
 
17
17
  // packages/core/functions/src/types.ts
18
18
  import { RawObject, S, TypedObject } from "@dxos/echo-schema";
19
- var SubscriptionTriggerSchema = S.struct({
19
+ var SubscriptionTriggerSchema = S.mutable(S.struct({
20
20
  type: S.literal("subscription"),
21
21
  // TODO(burdon): Define query DSL (from ECHO).
22
22
  filter: S.array(S.struct({
@@ -29,22 +29,22 @@ var SubscriptionTriggerSchema = S.struct({
29
29
  // Debounce changes (delay in ms).
30
30
  delay: S.optional(S.number)
31
31
  }))
32
- });
33
- var TimerTriggerSchema = S.struct({
32
+ }));
33
+ var TimerTriggerSchema = S.mutable(S.struct({
34
34
  type: S.literal("timer"),
35
35
  cron: S.string
36
- });
36
+ }));
37
37
  var WebhookTriggerSchema = S.mutable(S.struct({
38
38
  type: S.literal("webhook"),
39
39
  method: S.string,
40
40
  // Assigned port.
41
41
  port: S.optional(S.number)
42
42
  }));
43
- var WebsocketTriggerSchema = S.struct({
43
+ var WebsocketTriggerSchema = S.mutable(S.struct({
44
44
  type: S.literal("websocket"),
45
45
  url: S.string,
46
46
  init: S.optional(S.record(S.string, S.any))
47
- });
47
+ }));
48
48
  var TriggerSpecSchema = S.union(TimerTriggerSchema, WebhookTriggerSchema, WebsocketTriggerSchema, SubscriptionTriggerSchema);
49
49
  var FunctionDef = class extends TypedObject({
50
50
  typename: "dxos.org/type/FunctionDef",
@@ -61,6 +61,7 @@ var FunctionTrigger = class extends TypedObject({
61
61
  typename: "dxos.org/type/FunctionTrigger",
62
62
  version: "0.1.0"
63
63
  })({
64
+ enabled: S.optional(S.boolean),
64
65
  function: S.string.pipe(S.description("Function URI.")),
65
66
  // Context is merged into the event data passed to the function.
66
67
  meta: S.optional(S.object),
@@ -71,11 +72,16 @@ var FunctionManifestSchema = S.struct({
71
72
  functions: S.optional(S.mutable(S.array(RawObject(FunctionDef)))),
72
73
  triggers: S.optional(S.mutable(S.array(RawObject(FunctionTrigger))))
73
74
  });
75
+ var FUNCTION_SCHEMA = [
76
+ FunctionDef,
77
+ FunctionTrigger
78
+ ];
74
79
 
75
80
  export {
76
81
  __require,
77
82
  FunctionDef,
78
83
  FunctionTrigger,
79
- FunctionManifestSchema
84
+ FunctionManifestSchema,
85
+ FUNCTION_SCHEMA
80
86
  };
81
- //# sourceMappingURL=chunk-366QG6IX.mjs.map
87
+ //# sourceMappingURL=chunk-HRU7VDYL.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { RawObject, S, TypedObject } from '@dxos/echo-schema';\n\n/**\n * Type discriminator for TriggerSpec.\n * Every spec has a type field of type FunctionTriggerType that we can use to understand which\n * type we're working with.\n * https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions\n */\nexport type FunctionTriggerType = 'subscription' | 'timer' | 'webhook' | 'websocket';\n\nconst SubscriptionTriggerSchema = S.mutable(\n S.struct({\n type: S.literal('subscription'),\n // TODO(burdon): Define query DSL (from ECHO).\n filter: S.array(\n S.struct({\n type: S.string,\n props: S.optional(S.record(S.string, S.any)),\n }),\n ),\n options: S.optional(\n S.struct({\n // Watch changes to object (not just creation).\n deep: S.optional(S.boolean),\n // Debounce changes (delay in ms).\n delay: S.optional(S.number),\n }),\n ),\n }),\n);\n\nexport type SubscriptionTrigger = S.Schema.Type<typeof SubscriptionTriggerSchema>;\n\nconst TimerTriggerSchema = S.mutable(\n S.struct({\n type: S.literal('timer'),\n cron: S.string,\n }),\n);\n\nexport type TimerTrigger = S.Schema.Type<typeof TimerTriggerSchema>;\n\nconst WebhookTriggerSchema = S.mutable(\n S.struct({\n type: S.literal('webhook'),\n method: S.string,\n // Assigned port.\n port: S.optional(S.number),\n }),\n);\n\nexport type WebhookTrigger = S.Schema.Type<typeof WebhookTriggerSchema>;\n\nconst WebsocketTriggerSchema = S.mutable(\n S.struct({\n type: S.literal('websocket'),\n url: S.string,\n init: S.optional(S.record(S.string, S.any)),\n }),\n);\n\nexport type WebsocketTrigger = S.Schema.Type<typeof WebsocketTriggerSchema>;\n\nconst TriggerSpecSchema = S.union(\n TimerTriggerSchema,\n WebhookTriggerSchema,\n WebsocketTriggerSchema,\n SubscriptionTriggerSchema,\n);\n\nexport type TriggerSpec = TimerTrigger | WebhookTrigger | WebsocketTrigger | SubscriptionTrigger;\n\n/**\n * Function definition.\n */\nexport class FunctionDef extends TypedObject({\n typename: 'dxos.org/type/FunctionDef',\n version: '0.1.0',\n})({\n uri: S.string,\n description: S.optional(S.string),\n route: S.string,\n // TODO(burdon): NPM/GitHub/Docker/CF URL?\n handler: S.string,\n}) {}\n\nexport class FunctionTrigger extends TypedObject({\n typename: 'dxos.org/type/FunctionTrigger',\n version: '0.1.0',\n})({\n enabled: S.optional(S.boolean),\n function: S.string.pipe(S.description('Function URI.')),\n // Context is merged into the event data passed to the function.\n meta: S.optional(S.object),\n spec: TriggerSpecSchema,\n}) {}\n\n/**\n * Function manifest file.\n */\nexport const FunctionManifestSchema = S.struct({\n functions: S.optional(S.mutable(S.array(RawObject(FunctionDef)))),\n triggers: S.optional(S.mutable(S.array(RawObject(FunctionTrigger)))),\n});\n\nexport type FunctionManifest = S.Schema.Type<typeof FunctionManifestSchema>;\n\n// TODO(burdon): Standards?\nexport const FUNCTION_SCHEMA = [FunctionDef, FunctionTrigger];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAIA,SAASA,WAAWC,GAAGC,mBAAmB;AAU1C,IAAMC,4BAA4BC,EAAEC,QAClCD,EAAEE,OAAO;EACPC,MAAMH,EAAEI,QAAQ,cAAA;;EAEhBC,QAAQL,EAAEM,MACRN,EAAEE,OAAO;IACPC,MAAMH,EAAEO;IACRC,OAAOR,EAAES,SAAST,EAAEU,OAAOV,EAAEO,QAAQP,EAAEW,GAAG,CAAA;EAC5C,CAAA,CAAA;EAEFC,SAASZ,EAAES,SACTT,EAAEE,OAAO;;IAEPW,MAAMb,EAAES,SAAST,EAAEc,OAAO;;IAE1BC,OAAOf,EAAES,SAAST,EAAEgB,MAAM;EAC5B,CAAA,CAAA;AAEJ,CAAA,CAAA;AAKF,IAAMC,qBAAqBjB,EAAEC,QAC3BD,EAAEE,OAAO;EACPC,MAAMH,EAAEI,QAAQ,OAAA;EAChBc,MAAMlB,EAAEO;AACV,CAAA,CAAA;AAKF,IAAMY,uBAAuBnB,EAAEC,QAC7BD,EAAEE,OAAO;EACPC,MAAMH,EAAEI,QAAQ,SAAA;EAChBgB,QAAQpB,EAAEO;;EAEVc,MAAMrB,EAAES,SAAST,EAAEgB,MAAM;AAC3B,CAAA,CAAA;AAKF,IAAMM,yBAAyBtB,EAAEC,QAC/BD,EAAEE,OAAO;EACPC,MAAMH,EAAEI,QAAQ,WAAA;EAChBmB,KAAKvB,EAAEO;EACPiB,MAAMxB,EAAES,SAAST,EAAEU,OAAOV,EAAEO,QAAQP,EAAEW,GAAG,CAAA;AAC3C,CAAA,CAAA;AAKF,IAAMc,oBAAoBzB,EAAE0B,MAC1BT,oBACAE,sBACAG,wBACAvB,yBAAAA;AAQK,IAAM4B,cAAN,cAA0BC,YAAY;EAC3CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,KAAK/B,EAAEO;EACPyB,aAAahC,EAAES,SAAST,EAAEO,MAAM;EAChC0B,OAAOjC,EAAEO;;EAET2B,SAASlC,EAAEO;AACb,CAAA,EAAA;AAAI;AAEG,IAAM4B,kBAAN,cAA8BP,YAAY;EAC/CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDM,SAASpC,EAAES,SAAST,EAAEc,OAAO;EAC7BuB,UAAUrC,EAAEO,OAAO+B,KAAKtC,EAAEgC,YAAY,eAAA,CAAA;;EAEtCO,MAAMvC,EAAES,SAAST,EAAEwC,MAAM;EACzBC,MAAMhB;AACR,CAAA,EAAA;AAAI;AAKG,IAAMiB,yBAAyB1C,EAAEE,OAAO;EAC7CyC,WAAW3C,EAAES,SAAST,EAAEC,QAAQD,EAAEM,MAAMsC,UAAUjB,WAAAA,CAAAA,CAAAA,CAAAA;EAClDkB,UAAU7C,EAAES,SAAST,EAAEC,QAAQD,EAAEM,MAAMsC,UAAUT,eAAAA,CAAAA,CAAAA,CAAAA;AACnD,CAAA;AAKO,IAAMW,kBAAkB;EAACnB;EAAaQ;;",
6
+ "names": ["RawObject", "S", "TypedObject", "SubscriptionTriggerSchema", "S", "mutable", "struct", "type", "literal", "filter", "array", "string", "props", "optional", "record", "any", "options", "deep", "boolean", "delay", "number", "TimerTriggerSchema", "cron", "WebhookTriggerSchema", "method", "port", "WebsocketTriggerSchema", "url", "init", "TriggerSpecSchema", "union", "FunctionDef", "TypedObject", "typename", "version", "uri", "description", "route", "handler", "FunctionTrigger", "enabled", "function", "pipe", "meta", "object", "spec", "FunctionManifestSchema", "functions", "RawObject", "triggers", "FUNCTION_SCHEMA"]
7
+ }
@@ -1,10 +1,11 @@
1
1
  import "@dxos/node-std/globals";
2
2
  import {
3
+ FUNCTION_SCHEMA,
3
4
  FunctionDef,
4
5
  FunctionManifestSchema,
5
6
  FunctionTrigger,
6
7
  __require
7
- } from "./chunk-366QG6IX.mjs";
8
+ } from "./chunk-HRU7VDYL.mjs";
8
9
 
9
10
  // packages/core/functions/src/function/function-registry.ts
10
11
  import { Event } from "@dxos/async";
@@ -12,32 +13,7 @@ import { create, Filter } from "@dxos/client/echo";
12
13
  import { Resource } from "@dxos/context";
13
14
  import { PublicKey } from "@dxos/keys";
14
15
  import { log } from "@dxos/log";
15
- import { ComplexMap } from "@dxos/util";
16
-
17
- // packages/core/functions/src/util.ts
18
- var diff = (previous, next, comparator) => {
19
- const remaining = [
20
- ...previous
21
- ];
22
- const result = {
23
- added: [],
24
- updated: [],
25
- removed: remaining
26
- };
27
- for (const object of next) {
28
- const index = remaining.findIndex((item) => comparator(item, object));
29
- if (index === -1) {
30
- result.added.push(object);
31
- } else {
32
- result.updated.push(remaining[index]);
33
- remaining.splice(index, 1);
34
- }
35
- }
36
- return result;
37
- };
38
- var intersection = (a, b, comparator) => a.filter((a2) => b.find((b2) => comparator(a2, b2)) !== void 0);
39
-
40
- // packages/core/functions/src/function/function-registry.ts
16
+ import { ComplexMap, diff } from "@dxos/util";
41
17
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/functions/src/function/function-registry.ts";
42
18
  var FunctionRegistry = class extends Resource {
43
19
  constructor(_client) {
@@ -59,7 +35,7 @@ var FunctionRegistry = class extends Resource {
59
35
  functions: functions?.length ?? 0
60
36
  }, {
61
37
  F: __dxlog_file,
62
- L: 39,
38
+ L: 38,
63
39
  S: this,
64
40
  C: (f, a) => f(...a)
65
41
  });
@@ -70,11 +46,16 @@ var FunctionRegistry = class extends Resource {
70
46
  space.db.graph.runtimeSchemaRegistry.registerSchema(FunctionDef);
71
47
  }
72
48
  const { objects: existing } = await space.db.query(Filter.schema(FunctionDef)).run();
73
- const { added, removed } = diff(existing, functions, (a, b) => a.uri === b.uri);
49
+ const { added } = diff(existing, functions, (a, b) => a.uri === b.uri);
74
50
  added.forEach((def) => space.db.add(create(FunctionDef, def)));
75
- removed.forEach((def) => space.db.remove(def));
76
51
  }
77
52
  async _open() {
53
+ log.info("opening...", void 0, {
54
+ F: __dxlog_file,
55
+ L: 54,
56
+ S: this,
57
+ C: (f, a) => f(...a)
58
+ });
78
59
  const spacesSubscription = this._client.spaces.subscribe(async (spaces) => {
79
60
  for (const space of spaces) {
80
61
  if (this._functionBySpaceKey.has(space.key)) {
@@ -101,6 +82,12 @@ var FunctionRegistry = class extends Resource {
101
82
  this._ctx.onDispose(() => spacesSubscription.unsubscribe());
102
83
  }
103
84
  async _close(_) {
85
+ log.info("closing...", void 0, {
86
+ F: __dxlog_file,
87
+ L: 87,
88
+ S: this,
89
+ C: (f, a) => f(...a)
90
+ });
104
91
  this._functionBySpaceKey.clear();
105
92
  }
106
93
  };
@@ -485,7 +472,7 @@ var Scheduler = class {
485
472
  this.triggers = triggers;
486
473
  this._options = _options;
487
474
  this._ctx = createContext2();
488
- this._callMutex = new Mutex();
475
+ this._functionUriToCallMutex = /* @__PURE__ */ new Map();
489
476
  this.functions.registered.on(async ({ space, added }) => {
490
477
  await this._safeActivateTriggers(space, this.triggers.getInactiveTriggers(space), added);
491
478
  });
@@ -531,7 +518,25 @@ var Scheduler = class {
531
518
  await this.triggers.activate({
532
519
  space
533
520
  }, fnTrigger, async (args) => {
534
- return this._callMutex.executeSynchronized(() => {
521
+ const mutex = this._functionUriToCallMutex.get(definition.uri) ?? new Mutex();
522
+ this._functionUriToCallMutex.set(definition.uri, mutex);
523
+ log4.info("function triggered, waiting for mutex", {
524
+ uri: definition.uri
525
+ }, {
526
+ F: __dxlog_file4,
527
+ L: 86,
528
+ S: this,
529
+ C: (f, a) => f(...a)
530
+ });
531
+ return mutex.executeSynchronized(() => {
532
+ log4.info("mutex acquired", {
533
+ uri: definition.uri
534
+ }, {
535
+ F: __dxlog_file4,
536
+ L: 88,
537
+ S: this,
538
+ C: (f, a) => f(...a)
539
+ });
535
540
  return this._execFunction(definition, fnTrigger, {
536
541
  meta: fnTrigger.meta,
537
542
  data: {
@@ -546,7 +551,7 @@ var Scheduler = class {
546
551
  trigger: fnTrigger
547
552
  }, {
548
553
  F: __dxlog_file4,
549
- L: 91,
554
+ L: 96,
550
555
  S: this,
551
556
  C: (f, a) => f(...a)
552
557
  });
@@ -566,7 +571,7 @@ var Scheduler = class {
566
571
  triggerType: trigger.spec.type
567
572
  }, {
568
573
  F: __dxlog_file4,
569
- L: 108,
574
+ L: 113,
570
575
  S: this,
571
576
  C: (f, a) => f(...a)
572
577
  });
@@ -583,7 +588,7 @@ var Scheduler = class {
583
588
  function: def.uri
584
589
  }, {
585
590
  F: __dxlog_file4,
586
- L: 119,
591
+ L: 124,
587
592
  S: this,
588
593
  C: (f, a) => f(...a)
589
594
  });
@@ -597,7 +602,7 @@ var Scheduler = class {
597
602
  status
598
603
  }, {
599
604
  F: __dxlog_file4,
600
- L: 129,
605
+ L: 134,
601
606
  S: this,
602
607
  C: (f, a) => f(...a)
603
608
  });
@@ -607,7 +612,7 @@ var Scheduler = class {
607
612
  error: err.message
608
613
  }, {
609
614
  F: __dxlog_file4,
610
- L: 131,
615
+ L: 136,
611
616
  S: this,
612
617
  C: (f, a) => f(...a)
613
618
  });
@@ -628,7 +633,7 @@ import { ECHO_ATTR_META, foreignKey, foreignKeyEquals, splitMeta } from "@dxos/e
628
633
  import { invariant as invariant2 } from "@dxos/invariant";
629
634
  import { PublicKey as PublicKey3 } from "@dxos/keys";
630
635
  import { log as log9 } from "@dxos/log";
631
- import { ComplexMap as ComplexMap2 } from "@dxos/util";
636
+ import { ComplexMap as ComplexMap2, diff as diff2, intersection } from "@dxos/util";
632
637
 
633
638
  // packages/core/functions/src/trigger/type/subscription-trigger.ts
634
639
  import { TextV0Type } from "@braneframe/types";
@@ -910,7 +915,7 @@ var TriggerRegistry = class extends Resource2 {
910
915
  trigger
911
916
  }, {
912
917
  F: __dxlog_file9,
913
- L: 75,
918
+ L: 74,
914
919
  S: this,
915
920
  C: (f, a) => f(...a)
916
921
  });
@@ -921,7 +926,7 @@ var TriggerRegistry = class extends Resource2 {
921
926
  const registeredTrigger = this._triggersBySpaceKey.get(triggerCtx.space.key)?.find((reg) => reg.trigger.id === trigger.id);
922
927
  invariant2(registeredTrigger, `Trigger is not registered: ${trigger.function}`, {
923
928
  F: __dxlog_file9,
924
- L: 81,
929
+ L: 80,
925
930
  S: this,
926
931
  A: [
927
932
  "registeredTrigger",
@@ -945,7 +950,7 @@ var TriggerRegistry = class extends Resource2 {
945
950
  space: space.key
946
951
  }, {
947
952
  F: __dxlog_file9,
948
- L: 97,
953
+ L: 96,
949
954
  S: this,
950
955
  C: (f, a) => f(...a)
951
956
  });
@@ -956,7 +961,7 @@ var TriggerRegistry = class extends Resource2 {
956
961
  space.db.graph.runtimeSchemaRegistry.registerSchema(FunctionTrigger);
957
962
  }
958
963
  const { objects: existing } = await space.db.query(Filter3.schema(FunctionTrigger)).run();
959
- const { added, removed } = diff(existing, manifest.triggers, (a, b) => {
964
+ const { added } = diff2(existing, manifest.triggers, (a, b) => {
960
965
  const keys = b[ECHO_ATTR_META]?.keys ?? [
961
966
  foreignKey("manifest", [
962
967
  b.function,
@@ -969,9 +974,14 @@ var TriggerRegistry = class extends Resource2 {
969
974
  const { meta, object } = splitMeta(trigger);
970
975
  space.db.add(create2(FunctionTrigger, object, meta));
971
976
  });
972
- removed.forEach((trigger) => space.db.remove(trigger));
973
977
  }
974
978
  async _open() {
979
+ log9.info("open...", void 0, {
980
+ F: __dxlog_file9,
981
+ L: 121,
982
+ S: this,
983
+ C: (f, a) => f(...a)
984
+ });
975
985
  const spaceListSubscription = this._client.spaces.subscribe(async (spaces) => {
976
986
  for (const space of spaces) {
977
987
  if (this._triggersBySpaceKey.has(space.key)) {
@@ -983,16 +993,30 @@ var TriggerRegistry = class extends Resource2 {
983
993
  if (this._ctx.disposed) {
984
994
  break;
985
995
  }
986
- const functionsSubscription = space.db.query(Filter3.schema(FunctionTrigger)).subscribe(async (triggers) => {
996
+ this._ctx.onDispose(space.db.query(Filter3.schema(FunctionTrigger)).subscribe(async (triggers) => {
997
+ log9.info("update", {
998
+ space: space.key,
999
+ triggers: triggers.objects.length
1000
+ }, {
1001
+ F: __dxlog_file9,
1002
+ L: 138,
1003
+ S: this,
1004
+ C: (f, a) => f(...a)
1005
+ });
987
1006
  await this._handleRemovedTriggers(space, triggers.objects, registered);
988
1007
  this._handleNewTriggers(space, triggers.objects, registered);
989
- });
990
- this._ctx.onDispose(functionsSubscription);
1008
+ }));
991
1009
  }
992
1010
  });
993
1011
  this._ctx.onDispose(() => spaceListSubscription.unsubscribe());
994
1012
  }
995
1013
  async _close(_) {
1014
+ log9.info("close...", void 0, {
1015
+ F: __dxlog_file9,
1016
+ L: 150,
1017
+ S: this,
1018
+ C: (f, a) => f(...a)
1019
+ });
996
1020
  this._triggersBySpaceKey.clear();
997
1021
  }
998
1022
  _handleNewTriggers(space, allTriggers, registered) {
@@ -1004,12 +1028,12 @@ var TriggerRegistry = class extends Resource2 {
1004
1028
  trigger
1005
1029
  }));
1006
1030
  registered.push(...newRegisteredTriggers);
1007
- log9("registered new triggers", () => ({
1031
+ log9.info("added", () => ({
1008
1032
  spaceKey: space.key,
1009
- functions: newTriggers.map((t) => t.function)
1033
+ triggers: newTriggers.map((trigger) => trigger.function)
1010
1034
  }), {
1011
1035
  F: __dxlog_file9,
1012
- L: 159,
1036
+ L: 162,
1013
1037
  S: this,
1014
1038
  C: (f, a) => f(...a)
1015
1039
  });
@@ -1024,6 +1048,17 @@ var TriggerRegistry = class extends Resource2 {
1024
1048
  for (let i = registered.length - 1; i >= 0; i--) {
1025
1049
  const wasRemoved = allTriggers.find((trigger) => trigger.id === registered[i].trigger.id) == null;
1026
1050
  if (wasRemoved) {
1051
+ if (removed.length) {
1052
+ log9.info("removed", () => ({
1053
+ spaceKey: space.key,
1054
+ triggers: removed.map((trigger) => trigger.function)
1055
+ }), {
1056
+ F: __dxlog_file9,
1057
+ L: 181,
1058
+ S: this,
1059
+ C: (f, a) => f(...a)
1060
+ });
1061
+ }
1027
1062
  const unregistered = registered.splice(i, 1)[0];
1028
1063
  await unregistered.activationCtx?.dispose();
1029
1064
  removed.push(unregistered.trigger);
@@ -1043,6 +1078,7 @@ var TriggerRegistry = class extends Resource2 {
1043
1078
  };
1044
1079
  export {
1045
1080
  DevServer,
1081
+ FUNCTION_SCHEMA,
1046
1082
  FunctionDef,
1047
1083
  FunctionManifestSchema,
1048
1084
  FunctionRegistry,