spacetimedb 2.3.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE.txt +2 -2
  2. package/dist/index.browser.mjs +64 -4
  3. package/dist/index.browser.mjs.map +1 -1
  4. package/dist/index.cjs +64 -4
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.mjs +64 -4
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/lib/autogen/types.d.ts +675 -2
  9. package/dist/lib/autogen/types.d.ts.map +1 -1
  10. package/dist/lib/schema.d.ts.map +1 -1
  11. package/dist/min/index.browser.mjs +1 -1
  12. package/dist/min/index.browser.mjs.map +1 -1
  13. package/dist/min/sdk/index.browser.mjs +1 -1
  14. package/dist/min/sdk/index.browser.mjs.map +1 -1
  15. package/dist/sdk/decompress.d.ts.map +1 -1
  16. package/dist/sdk/index.browser.mjs +64 -4
  17. package/dist/sdk/index.browser.mjs.map +1 -1
  18. package/dist/sdk/index.cjs +64 -4
  19. package/dist/sdk/index.cjs.map +1 -1
  20. package/dist/sdk/index.mjs +64 -4
  21. package/dist/sdk/index.mjs.map +1 -1
  22. package/dist/server/http.d.ts +1 -2
  23. package/dist/server/http.d.ts.map +1 -1
  24. package/dist/server/http.test-d.d.ts +2 -0
  25. package/dist/server/http.test-d.d.ts.map +1 -0
  26. package/dist/server/http_handlers.d.ts +82 -0
  27. package/dist/server/http_handlers.d.ts.map +1 -0
  28. package/dist/server/http_internal.d.ts +1 -32
  29. package/dist/server/http_internal.d.ts.map +1 -1
  30. package/dist/server/http_shared.d.ts +44 -0
  31. package/dist/server/http_shared.d.ts.map +1 -0
  32. package/dist/server/index.d.ts +2 -0
  33. package/dist/server/index.d.ts.map +1 -1
  34. package/dist/server/index.mjs +628 -136
  35. package/dist/server/index.mjs.map +1 -1
  36. package/dist/server/runtime.d.ts +1 -0
  37. package/dist/server/runtime.d.ts.map +1 -1
  38. package/dist/server/schema.d.ts +19 -4
  39. package/dist/server/schema.d.ts.map +1 -1
  40. package/dist/server/views.d.ts +17 -1
  41. package/dist/server/views.d.ts.map +1 -1
  42. package/package.json +1 -1
  43. package/src/lib/autogen/types.ts +38 -0
  44. package/src/lib/schema.ts +21 -0
  45. package/src/sdk/decompress.ts +19 -4
  46. package/src/sdk/logger.ts +1 -1
  47. package/src/server/http.test-d.ts +80 -0
  48. package/src/server/http.ts +14 -2
  49. package/src/server/http_handlers.ts +413 -0
  50. package/src/server/http_internal.ts +15 -142
  51. package/src/server/http_shared.ts +186 -0
  52. package/src/server/index.ts +11 -0
  53. package/src/server/procedures.ts +8 -30
  54. package/src/server/runtime.ts +137 -1
  55. package/src/server/schema.ts +86 -4
  56. package/src/server/sys.d.ts +7 -0
  57. package/src/server/view.test-d.ts +22 -0
  58. package/src/server/views.ts +127 -0
  59. package/dist/lib/http_types.d.ts +0 -2
  60. package/dist/lib/http_types.d.ts.map +0 -1
  61. package/src/lib/http_types.ts +0 -8
package/dist/index.mjs CHANGED
@@ -5004,11 +5004,21 @@ async function decompress(buffer, type, chunkSize = 128 * 1024) {
5004
5004
  });
5005
5005
  const decompressionStream = new DecompressionStream(type);
5006
5006
  const decompressedStream = readableStream.pipeThrough(decompressionStream);
5007
+ const reader = decompressedStream.getReader();
5007
5008
  const chunks = [];
5008
- for await (const chunk of decompressedStream) {
5009
- chunks.push(chunk);
5010
- }
5011
- return new Blob(chunks).bytes();
5009
+ let totalLength = 0;
5010
+ let result;
5011
+ while (!(result = await reader.read()).done) {
5012
+ chunks.push(result.value);
5013
+ totalLength += result.value.length;
5014
+ }
5015
+ const decompressedArray = new Uint8Array(totalLength);
5016
+ let chunkOffset = 0;
5017
+ for (const chunk of chunks) {
5018
+ decompressedArray.set(chunk, chunkOffset);
5019
+ chunkOffset += chunk.length;
5020
+ }
5021
+ return decompressedArray;
5012
5022
  }
5013
5023
 
5014
5024
  // src/sdk/ws.ts
@@ -6683,7 +6693,10 @@ var ModuleContext = class {
6683
6693
  schedules: [],
6684
6694
  procedures: [],
6685
6695
  views: [],
6696
+ viewPrimaryKeys: [],
6686
6697
  lifeCycleReducers: [],
6698
+ httpHandlers: [],
6699
+ httpRoutes: [],
6687
6700
  caseConversionPolicy: { tag: "SnakeCase" },
6688
6701
  explicitNames: {
6689
6702
  entries: []
@@ -6704,6 +6717,12 @@ var ModuleContext = class {
6704
6717
  push(module.reducers && { tag: "Reducers", value: module.reducers });
6705
6718
  push(module.procedures && { tag: "Procedures", value: module.procedures });
6706
6719
  push(module.views && { tag: "Views", value: module.views });
6720
+ push(
6721
+ module.viewPrimaryKeys && {
6722
+ tag: "ViewPrimaryKeys",
6723
+ value: module.viewPrimaryKeys
6724
+ }
6725
+ );
6707
6726
  push(module.schedules && { tag: "Schedules", value: module.schedules });
6708
6727
  push(
6709
6728
  module.lifeCycleReducers && {
@@ -6711,6 +6730,18 @@ var ModuleContext = class {
6711
6730
  value: module.lifeCycleReducers
6712
6731
  }
6713
6732
  );
6733
+ push(
6734
+ module.httpHandlers && {
6735
+ tag: "HttpHandlers",
6736
+ value: module.httpHandlers
6737
+ }
6738
+ );
6739
+ push(
6740
+ module.httpRoutes && {
6741
+ tag: "HttpRoutes",
6742
+ value: module.httpRoutes
6743
+ }
6744
+ );
6714
6745
  push(
6715
6746
  module.rowLevelSecurity && {
6716
6747
  tag: "RowLevelSecurity",
@@ -6969,6 +7000,12 @@ var Lifecycle = t.enum("Lifecycle", {
6969
7000
  OnConnect: t.unit(),
6970
7001
  OnDisconnect: t.unit()
6971
7002
  });
7003
+ var MethodOrAny = t.enum("MethodOrAny", {
7004
+ Any: t.unit(),
7005
+ get Method() {
7006
+ return HttpMethod;
7007
+ }
7008
+ });
6972
7009
  var MiscModuleExport = t.enum("MiscModuleExport", {
6973
7010
  get TypeAlias() {
6974
7011
  return TypeAlias;
@@ -7026,6 +7063,16 @@ var RawConstraintDefV9 = t.object("RawConstraintDefV9", {
7026
7063
  return RawConstraintDataV9;
7027
7064
  }
7028
7065
  });
7066
+ var RawHttpHandlerDefV10 = t.object("RawHttpHandlerDefV10", {
7067
+ sourceName: t.string()
7068
+ });
7069
+ var RawHttpRouteDefV10 = t.object("RawHttpRouteDefV10", {
7070
+ handlerFunction: t.string(),
7071
+ get method() {
7072
+ return MethodOrAny;
7073
+ },
7074
+ path: t.string()
7075
+ });
7029
7076
  var RawIndexAlgorithm = t.enum("RawIndexAlgorithm", {
7030
7077
  BTree: t.array(t.u16()),
7031
7078
  Hash: t.array(t.u16()),
@@ -7122,6 +7169,15 @@ var RawModuleDefV10Section = t.enum("RawModuleDefV10Section", {
7122
7169
  },
7123
7170
  get ExplicitNames() {
7124
7171
  return ExplicitNames;
7172
+ },
7173
+ get HttpHandlers() {
7174
+ return t.array(RawHttpHandlerDefV10);
7175
+ },
7176
+ get HttpRoutes() {
7177
+ return t.array(RawHttpRouteDefV10);
7178
+ },
7179
+ get ViewPrimaryKeys() {
7180
+ return t.array(RawViewPrimaryKeyDefV10);
7125
7181
  }
7126
7182
  });
7127
7183
  var RawModuleDefV8 = t.object("RawModuleDefV8", {
@@ -7359,6 +7415,10 @@ var RawViewDefV9 = t.object("RawViewDefV9", {
7359
7415
  return AlgebraicType2;
7360
7416
  }
7361
7417
  });
7418
+ var RawViewPrimaryKeyDefV10 = t.object("RawViewPrimaryKeyDefV10", {
7419
+ viewSourceName: t.string(),
7420
+ columns: t.array(t.string())
7421
+ });
7362
7422
  var ReducerDef = t.object("ReducerDef", {
7363
7423
  name: t.string(),
7364
7424
  get args() {