@dxos/client-protocol 0.8.4-main.72ec0f3 → 0.8.4-main.765dc60934

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 (47) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/browser/chunk-GCBXMPTW.mjs +51 -0
  3. package/dist/lib/browser/chunk-GCBXMPTW.mjs.map +7 -0
  4. package/dist/lib/browser/index.mjs +45 -28
  5. package/dist/lib/browser/index.mjs.map +4 -4
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/types/index.mjs +9 -5
  8. package/dist/lib/node-esm/chunk-2RN4CLEW.mjs +53 -0
  9. package/dist/lib/node-esm/chunk-2RN4CLEW.mjs.map +7 -0
  10. package/dist/lib/node-esm/index.mjs +45 -28
  11. package/dist/lib/node-esm/index.mjs.map +4 -4
  12. package/dist/lib/node-esm/meta.json +1 -1
  13. package/dist/lib/node-esm/types/index.mjs +9 -5
  14. package/dist/types/src/config.d.ts +24 -8
  15. package/dist/types/src/config.d.ts.map +1 -1
  16. package/dist/types/src/echo.d.ts +8 -16
  17. package/dist/types/src/echo.d.ts.map +1 -1
  18. package/dist/types/src/index.d.ts +2 -2
  19. package/dist/types/src/index.d.ts.map +1 -1
  20. package/dist/types/src/invitations/encoder.d.ts.map +1 -1
  21. package/dist/types/src/invitations/invitations.d.ts +2 -2
  22. package/dist/types/src/invitations/invitations.d.ts.map +1 -1
  23. package/dist/types/src/{service-definitions.d.ts → service.d.ts} +18 -7
  24. package/dist/types/src/service.d.ts.map +1 -0
  25. package/dist/types/src/space.d.ts +40 -17
  26. package/dist/types/src/space.d.ts.map +1 -1
  27. package/dist/types/src/types/SpaceProperties.d.ts +67 -0
  28. package/dist/types/src/types/SpaceProperties.d.ts.map +1 -0
  29. package/dist/types/src/types/index.d.ts +1 -1
  30. package/dist/types/src/types/index.d.ts.map +1 -1
  31. package/dist/types/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +20 -25
  33. package/src/config.ts +33 -14
  34. package/src/echo.ts +8 -20
  35. package/src/index.ts +2 -2
  36. package/src/{service-definitions.ts → service.ts} +24 -7
  37. package/src/space.ts +61 -27
  38. package/src/types/SpaceProperties.ts +76 -0
  39. package/src/types/index.ts +1 -1
  40. package/dist/lib/browser/chunk-HIQWFHOK.mjs +0 -25
  41. package/dist/lib/browser/chunk-HIQWFHOK.mjs.map +0 -7
  42. package/dist/lib/node-esm/chunk-TN3JZMTK.mjs +0 -27
  43. package/dist/lib/node-esm/chunk-TN3JZMTK.mjs.map +0 -7
  44. package/dist/types/src/service-definitions.d.ts.map +0 -1
  45. package/dist/types/src/types/Properties.d.ts +0 -22
  46. package/dist/types/src/types/Properties.d.ts.map +0 -1
  47. package/src/types/Properties.ts +0 -29
package/LICENSE CHANGED
@@ -1,8 +1,105 @@
1
- MIT License
2
- Copyright (c) 2022 DXOS
1
+ # Functional Source License, Version 1.1, ALv2 Future License
3
2
 
4
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ ## Abbreviation
5
4
 
6
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ FSL-1.1-Apache-2.0
7
6
 
8
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7
+ ## Notice
8
+
9
+ Copyright 2026 DXOS
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the Apache License, Version 2.0 that is effective on the second anniversary of
91
+ the date we make the Software available. On or after that date, you may use the
92
+ Software under the Apache License, Version 2.0, in which case the following
93
+ will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
96
+ this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software distributed
103
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
+ specific language governing permissions and limitations under the License.
@@ -0,0 +1,51 @@
1
+ // src/types/SpaceProperties.ts
2
+ import * as Schema from "effect/Schema";
3
+ import { Annotation, Feed, Ref, Type } from "@dxos/echo";
4
+ var ComputeEnvironment = Schema.Literal("disabled", "local", "edge");
5
+ var SpacePropertiesSchema = Schema.Struct({
6
+ //
7
+ // System properties.
8
+ //
9
+ archived: Schema.optional(Schema.Boolean.annotations({
10
+ title: "Archive Space"
11
+ })),
12
+ // TODO(burdon): Change to mode (no booleans?)
13
+ // TODO(wittjosiah): Make optional with default value.
14
+ edgeReplication: Schema.optional(Schema.Boolean),
15
+ /**
16
+ * @deprecated
17
+ */
18
+ invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),
19
+ /**
20
+ * Preference for trigger execution.
21
+ * *disabled* - triggers do not run locally or on EDGE.
22
+ * *local* - triggers are executed locally on the client, edge is not running triggers.
23
+ * *edge* - triggers are executed on the edge, triggers are not run locally.
24
+ */
25
+ computeEnvironment: Schema.optional(ComputeEnvironment),
26
+ //
27
+ // User properties.
28
+ //
29
+ name: Schema.optional(Schema.String),
30
+ icon: Schema.optional(Schema.String),
31
+ hue: Schema.optional(Schema.String)
32
+ }, {
33
+ key: Schema.String,
34
+ value: Schema.Any
35
+ });
36
+ var LegacySpaceProperties = SpacePropertiesSchema.pipe(Type.object({
37
+ typename: "org.dxos.type.space-properties",
38
+ version: "0.1.0"
39
+ }), Annotation.SystemTypeAnnotation.set(true));
40
+ var SpaceProperties = SpacePropertiesSchema.pipe(Type.object({
41
+ typename: "org.dxos.type.spaceProperties",
42
+ version: "0.1.0"
43
+ }), Annotation.SystemTypeAnnotation.set(true));
44
+
45
+ export {
46
+ ComputeEnvironment,
47
+ SpacePropertiesSchema,
48
+ LegacySpaceProperties,
49
+ SpaceProperties
50
+ };
51
+ //# sourceMappingURL=chunk-GCBXMPTW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/SpaceProperties.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Feed, Ref, Type } from '@dxos/echo';\n\n/**\n * Where do triggers get executed.\n */\nexport const ComputeEnvironment = Schema.Literal('disabled', 'local', 'edge');\nexport type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;\n\nexport const SpacePropertiesSchema = Schema.Struct(\n {\n //\n // System properties.\n //\n\n archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),\n // TODO(burdon): Change to mode (no booleans?)\n // TODO(wittjosiah): Make optional with default value.\n edgeReplication: Schema.optional(Schema.Boolean),\n\n /**\n * @deprecated\n */\n invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),\n\n /**\n * Preference for trigger execution.\n * *disabled* - triggers do not run locally or on EDGE.\n * *local* - triggers are executed locally on the client, edge is not running triggers.\n * *edge* - triggers are executed on the edge, triggers are not run locally.\n */\n computeEnvironment: Schema.optional(ComputeEnvironment),\n\n //\n // User properties.\n //\n\n name: Schema.optional(Schema.String),\n icon: Schema.optional(Schema.String),\n hue: Schema.optional(Schema.String),\n },\n {\n key: Schema.String,\n value: Schema.Any,\n },\n);\n\nexport type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;\n\n/** @deprecated Use SpaceProperties instead. */\nexport const LegacySpaceProperties = SpacePropertiesSchema.pipe(\n Type.object({\n typename: 'org.dxos.type.space-properties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface LegacySpaceProperties extends Schema.Schema.Type<typeof LegacySpaceProperties> {}\n\n// TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?\n// TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?\nexport const SpaceProperties = SpacePropertiesSchema.pipe(\n Type.object({\n typename: 'org.dxos.type.spaceProperties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {}\n"],
5
+ "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,MAAMC,KAAKC,YAAY;AAKrC,IAAMC,qBAA4BC,eAAQ,YAAY,SAAS,MAAA;AAG/D,IAAMC,wBAA+BC,cAC1C;;;;EAKEC,UAAiBC,gBAAgBC,eAAQC,YAAY;IAAEC,OAAO;EAAgB,CAAA,CAAA;;;EAG9EC,iBAAwBJ,gBAAgBC,cAAO;;;;EAK/CI,qBAA4BL,gBAASP,IAAIA,IAAID,KAAKA,IAAI,CAAA;;;;;;;EAQtDc,oBAA2BN,gBAASL,kBAAAA;;;;EAMpCY,MAAaP,gBAAgBQ,aAAM;EACnCC,MAAaT,gBAAgBQ,aAAM;EACnCE,KAAYV,gBAAgBQ,aAAM;AACpC,GACA;EACEG,KAAYH;EACZI,OAAcC;AAChB,CAAA;AAMK,IAAMC,wBAAwBjB,sBAAsBkB,KACzDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;AAO/B,IAAMC,kBAAkBxB,sBAAsBkB,KACnDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;",
6
+ "names": ["Schema", "Annotation", "Feed", "Ref", "Type", "ComputeEnvironment", "Literal", "SpacePropertiesSchema", "Struct", "archived", "optional", "Boolean", "annotations", "title", "edgeReplication", "invocationTraceFeed", "computeEnvironment", "name", "String", "icon", "hue", "key", "value", "Any", "LegacySpaceProperties", "pipe", "object", "typename", "version", "SystemTypeAnnotation", "set", "SpaceProperties"]
7
+ }
@@ -1,32 +1,45 @@
1
1
  import {
2
- PropertiesType,
3
- TYPE_PROPERTIES
4
- } from "./chunk-HIQWFHOK.mjs";
2
+ ComputeEnvironment,
3
+ LegacySpaceProperties,
4
+ SpaceProperties,
5
+ SpacePropertiesSchema
6
+ } from "./chunk-GCBXMPTW.mjs";
5
7
 
6
8
  // src/client.ts
7
- var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
9
+ var ClientServicesProviderResource = /* @__PURE__ */ Symbol.for("dxos.resource.ClientServices");
8
10
 
9
11
  // src/config.ts
10
- var DEFAULT_INTERNAL_CHANNEL = "dxos:vault";
11
12
  var DEFAULT_CLIENT_CHANNEL = "dxos:app";
13
+ var DEFAULT_INTERNAL_CHANNEL = "dxos:vault";
12
14
  var DEFAULT_SHELL_CHANNEL = "dxos:shell";
13
15
  var DEFAULT_WORKER_BROADCAST_CHANNEL = "dxos:shared-worker";
14
16
  var DEFAULT_VAULT_URL = "https://halo.dxos.org/vault.html";
17
+ var DEFAULT_PROFILE = "default";
15
18
  var EXPECTED_CONFIG_VERSION = 1;
16
19
  var defaultConfig = {
17
20
  version: 1
18
21
  };
19
22
  var HOME = typeof process !== "undefined" ? process?.env?.HOME ?? "" : "";
20
- var getProfilePath = (root, profile, file = void 0) => `${root}/profile/${profile}` + (file ? `/${file}` : "");
21
23
  var DX_CONFIG = `${HOME}/.config/dx`;
22
24
  var DX_CACHE = `${HOME}/.cache/dx`;
23
25
  var DX_DATA = `${HOME}/.local/share/dx`;
24
26
  var DX_STATE = `${HOME}/.local/state/dx`;
25
27
  var DX_RUNTIME = "/tmp/dx/run";
26
- var ENV_DX_CONFIG = "DX_CONFIG";
27
- var ENV_DX_NO_AGENT = "DX_NO_AGENT";
28
- var ENV_DX_PROFILE = "DX_PROFILE";
29
- var ENV_DX_PROFILE_DEFAULT = "default";
28
+ var DXEnv = /* @__PURE__ */ (function(DXEnv2) {
29
+ DXEnv2["CONFIG"] = "DX_CONFIG";
30
+ DXEnv2["DEBUG"] = "DX_DEBUG";
31
+ DXEnv2["NO_AGENT"] = "DX_NO_AGENT";
32
+ DXEnv2["PROFILE"] = "DX_PROFILE";
33
+ return DXEnv2;
34
+ })({});
35
+ (function(DXEnv2) {
36
+ function get(variable, defaultValue) {
37
+ return process.env[variable] ?? defaultValue;
38
+ }
39
+ DXEnv2.get = get;
40
+ })(DXEnv || (DXEnv = {}));
41
+ var getProfilePath = (root, profile, file) => `${root}/profile/${profile}` + (file ? `/${file}` : "");
42
+ var getProfileConfigPath = (root, profile) => `${getProfilePath(root, profile)}.yml`;
30
43
 
31
44
  // src/invitations/encoder.ts
32
45
  import base from "base-x";
@@ -108,15 +121,7 @@ var AuthenticatingInvitation = class extends CancellableInvitation {
108
121
  var wrapObservable = async (observable) => {
109
122
  return new Promise((resolve, reject) => {
110
123
  const subscription = observable.subscribe((invitation) => {
111
- invariant(invitation?.state === Invitation2.State.SUCCESS, void 0, {
112
- F: __dxlog_file,
113
- L: 90,
114
- S: void 0,
115
- A: [
116
- "invitation?.state === Invitation.State.SUCCESS",
117
- ""
118
- ]
119
- });
124
+ invariant(invitation?.state === Invitation2.State.SUCCESS, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 53, S: void 0, A: ["invitation?.state === Invitation.State.SUCCESS", ""] });
120
125
  subscription.unsubscribe();
121
126
  resolve(invitation);
122
127
  }, (err) => {
@@ -132,7 +137,7 @@ var getExpirationTime = (invitation) => {
132
137
  return new Date(invitation.created.getTime() + invitation.lifetime * 1e3);
133
138
  };
134
139
 
135
- // src/service-definitions.ts
140
+ // src/service.ts
136
141
  import { schema as schema2 } from "@dxos/protocols/proto";
137
142
  import { createServiceBundle } from "@dxos/rpc";
138
143
  var clientServiceBundle = createServiceBundle({
@@ -147,9 +152,9 @@ var clientServiceBundle = createServiceBundle({
147
152
  DataService: schema2.getService("dxos.echo.service.DataService"),
148
153
  ContactsService: schema2.getService("dxos.client.services.ContactsService"),
149
154
  EdgeAgentService: schema2.getService("dxos.client.services.EdgeAgentService"),
155
+ QueueService: schema2.getService("dxos.client.services.QueueService"),
150
156
  // TODO(burdon): Deprecated.
151
- DevtoolsHost: schema2.getService("dxos.devtools.host.DevtoolsHost"),
152
- TracingService: schema2.getService("dxos.tracing.TracingService")
157
+ DevtoolsHost: schema2.getService("dxos.devtools.host.DevtoolsHost")
153
158
  });
154
159
  var iframeServiceBundle = {
155
160
  BridgeService: schema2.getService("dxos.mesh.bridge.BridgeService")
@@ -164,6 +169,14 @@ var shellServiceBundle = {
164
169
  ShellService: schema2.getService("dxos.iframe.ShellService")
165
170
  };
166
171
 
172
+ // src/space.ts
173
+ import * as Schema from "effect/Schema";
174
+ var SPACE_TAG = /* @__PURE__ */ Symbol("dxos.client.protocol.Space");
175
+ var isSpace = (object) => typeof object === "object" && object != null && object[SPACE_TAG] === true;
176
+ var SpaceSchema = Schema.Any.pipe(Schema.filter((space) => isSpace(space)), Schema.annotations({
177
+ title: "Space"
178
+ }));
179
+
167
180
  // src/timeouts.ts
168
181
  var PROXY_CONNECTION_TIMEOUT = 3e4;
169
182
  var AUTH_TIMEOUT = 3e4;
@@ -180,37 +193,41 @@ export {
180
193
  CREATE_SPACE_TIMEOUT,
181
194
  CancellableInvitation,
182
195
  ClientServicesProviderResource,
196
+ ComputeEnvironment,
183
197
  DEFAULT_CLIENT_CHANNEL,
184
198
  DEFAULT_INTERNAL_CHANNEL,
199
+ DEFAULT_PROFILE,
185
200
  DEFAULT_SHELL_CHANNEL,
186
201
  DEFAULT_VAULT_URL,
187
202
  DEFAULT_WORKER_BROADCAST_CHANNEL,
203
+ DXEnv,
188
204
  DX_CACHE,
189
205
  DX_CONFIG,
190
206
  DX_DATA,
191
207
  DX_RUNTIME,
192
208
  DX_STATE,
193
- ENV_DX_CONFIG,
194
- ENV_DX_NO_AGENT,
195
- ENV_DX_PROFILE,
196
- ENV_DX_PROFILE_DEFAULT,
197
209
  EXPECTED_CONFIG_VERSION,
198
210
  IMPORT_SPACE_TIMEOUT,
199
211
  INVITATION_TIMEOUT,
200
212
  InvitationEncoder,
201
213
  LOAD_CONTROL_FEEDS_TIMEOUT,
202
214
  LOAD_PROPERTIES_TIMEOUT,
215
+ LegacySpaceProperties,
203
216
  PROXY_CONNECTION_TIMEOUT,
204
- PropertiesType,
205
217
  RESOURCE_LOCK_TIMEOUT,
218
+ SPACE_TAG,
206
219
  STATUS_TIMEOUT,
207
- TYPE_PROPERTIES,
220
+ SpaceProperties,
221
+ SpacePropertiesSchema,
222
+ SpaceSchema,
208
223
  appServiceBundle,
209
224
  clientServiceBundle,
210
225
  defaultConfig,
211
226
  getExpirationTime,
227
+ getProfileConfigPath,
212
228
  getProfilePath,
213
229
  iframeServiceBundle,
230
+ isSpace,
214
231
  shellServiceBundle,
215
232
  workerServiceBundle,
216
233
  wrapObservable
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/client.ts", "../../../src/config.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/service-definitions.ts", "../../../src/timeouts.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport const ClientServicesProviderResource = Symbol.for('dxos.resource.ClientServices');\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type ConfigProto } from '@dxos/config';\n\nexport const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';\nexport const DEFAULT_CLIENT_CHANNEL = 'dxos:app';\nexport const DEFAULT_SHELL_CHANNEL = 'dxos:shell';\nexport const DEFAULT_WORKER_BROADCAST_CHANNEL = 'dxos:shared-worker';\n\n/**\n * @deprecated\n */\nexport const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';\n\nexport const EXPECTED_CONFIG_VERSION = 1;\nexport const defaultConfig: ConfigProto = { version: 1 };\n\n// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.\nconst HOME = typeof process !== 'undefined' ? (process?.env?.HOME ?? '') : '';\n\n// Base directories.\n// TODO(burdon): Consider Windows, Linux, OSX.\n// https://wiki.archlinux.org/title/XDG_Base_Directory\n// Each `/dx` directory should contain `/profile/<DX_PROFILE>` subdirectories.\nexport const getProfilePath = (root: string, profile: string, file: string | undefined = undefined) =>\n `${root}/profile/${profile}` + (file ? `/${file}` : '');\n\n// XDG_CONFIG_HOME (Analogous to /etc.)\nexport const DX_CONFIG = `${HOME}/.config/dx`;\n\n// XDG_CACHE_HOME (Analogous to /var/cache).\nexport const DX_CACHE = `${HOME}/.cache/dx`;\n\n// TODO(burdon): Storage should use this by default (make path optional).\n// XDG_DATA_HOME (Analogous to /usr/share).\nexport const DX_DATA = `${HOME}/.local/share/dx`;\n\n// XDG_STATE_HOME (Analogous to /var/lib).\nexport const DX_STATE = `${HOME}/.local/state/dx`;\n\n// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)\nexport const DX_RUNTIME = '/tmp/dx/run';\n\nexport const ENV_DX_CONFIG = 'DX_CONFIG';\nexport const ENV_DX_NO_AGENT = 'DX_NO_AGENT';\nexport const ENV_DX_PROFILE = 'DX_PROFILE';\nexport const ENV_DX_PROFILE_DEFAULT = 'default';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport base from 'base-x';\n\nimport { schema } from '@dxos/protocols/proto';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\n// Encode with URL-safe alpha-numeric characters.\nconst base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');\n\nconst codec = schema.getCodecForType('dxos.client.services.Invitation');\n\n/**\n * Encodes and decodes an invitation proto into/from alphanumeric chars.\n */\nexport class InvitationEncoder {\n static decode(text: string): Invitation {\n const decodedInvitation = codec.decode(base62.decode(text));\n if (decodedInvitation.type === Invitation.Type.MULTIUSE) {\n decodedInvitation.type = Invitation.Type.INTERACTIVE;\n decodedInvitation.multiUse = true;\n }\n return decodedInvitation;\n }\n\n static encode(invitation: Invitation): string {\n return base62.encode(\n codec.encode({\n invitationId: invitation.invitationId,\n type: invitation.type,\n kind: invitation.kind,\n authMethod: invitation.authMethod,\n swarmKey: invitation.swarmKey,\n state: invitation.state,\n timeout: invitation.timeout,\n guestKeypair: invitation.guestKeypair,\n spaceId: invitation.spaceId,\n lifetime: invitation.lifetime,\n created: invitation.created,\n // TODO(wittjosiah): Make these optional to encode for greater privacy.\n ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),\n ...(invitation.target ? { target: invitation.target } : {}),\n }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, type Observable, type Subscriber } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nexport const AUTHENTICATION_CODE_LENGTH = 6;\n\nexport const INVITATION_TIMEOUT = 3 * 60_000; // 3 mins.\n\nexport interface Invitations {\n created: MulticastObservable<CancellableInvitation[]>;\n accepted: MulticastObservable<AuthenticatingInvitation[]>;\n share(options?: Partial<Invitation>): CancellableInvitation;\n join(invitation: Invitation): AuthenticatingInvitation;\n}\n\n/**\n * Base class for all invitation observables and providers.\n */\nexport class CancellableInvitation extends MulticastObservable<Invitation> {\n private readonly _onCancel: () => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n }) {\n super(subscriber, initialInvitation);\n this._onCancel = onCancel;\n }\n\n cancel(): Promise<void> {\n return this._onCancel();\n }\n\n get expired() {\n const expiration = getExpirationTime(this.get());\n return expiration && expiration.getTime() < Date.now();\n }\n\n get expiry() {\n return getExpirationTime(this.get());\n }\n}\n\n/**\n * Cancelable observer that relays authentication requests.\n */\nexport class AuthenticatingInvitation extends CancellableInvitation {\n private readonly _onAuthenticate: (authCode: string) => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n onAuthenticate,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n onAuthenticate: (authCode: string) => Promise<void>;\n }) {\n super({ subscriber, initialInvitation, onCancel });\n this._onAuthenticate = onAuthenticate;\n }\n\n async authenticate(authCode: string): Promise<void> {\n return this._onAuthenticate(authCode);\n }\n}\n\n/**\n * Testing util to wrap non-authenticating observable with promise.\n * Don't use this in production code.\n * @deprecated\n */\n// TODO(wittjosiah): Move to testing.\nexport const wrapObservable = async (observable: CancellableInvitation): Promise<Invitation> => {\n return new Promise((resolve, reject) => {\n const subscription = observable.subscribe(\n (invitation: Invitation | undefined) => {\n // TODO(burdon): Throw error if auth requested.\n invariant(invitation?.state === Invitation.State.SUCCESS);\n subscription.unsubscribe();\n resolve(invitation);\n },\n (err: Error) => {\n subscription.unsubscribe();\n reject(err);\n },\n );\n });\n};\n\nexport const getExpirationTime = (invitation: Partial<Invitation>): Date | undefined => {\n if (!(invitation.created && invitation.lifetime)) {\n return;\n }\n return new Date(invitation.created.getTime() + invitation.lifetime * 1000);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { schema } from '@dxos/protocols/proto';\nimport type {\n ContactsService,\n DevicesService,\n EdgeAgentService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService } from '@dxos/protocols/proto/dxos/echo/service';\nimport type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';\nimport type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';\nimport type { TracingService } from '@dxos/protocols/proto/dxos/tracing';\nimport { type ServiceBundle, createServiceBundle } from '@dxos/rpc';\n\n//\n// NOTE: Should contain client/proxy dependencies only.\n//\n\nexport type ClientServices = {\n SystemService: SystemService;\n NetworkService: NetworkService;\n LoggingService: LoggingService;\n\n IdentityService: IdentityService;\n InvitationsService: InvitationsService;\n QueryService: QueryService;\n DevicesService: DevicesService;\n SpacesService: SpacesService;\n DataService: DataService;\n ContactsService: ContactsService;\n EdgeAgentService: EdgeAgentService;\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: DevtoolsHost;\n\n TracingService: TracingService;\n};\n\n/**\n * Provide access to client services definitions and service handler.\n */\nexport interface ClientServicesProvider {\n /**\n * The connection to the services provider was terminated.\n * This should fire if the services disconnect unexpectedly or during a client reset.\n */\n closed: Event<Error | undefined>;\n descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n // TODO(burdon): Should take context from parent?\n open(): Promise<void>;\n close(): Promise<void>;\n}\n\n/**\n * Services supported by host.\n */\nexport const clientServiceBundle = createServiceBundle<ClientServices>({\n SystemService: schema.getService('dxos.client.services.SystemService'),\n NetworkService: schema.getService('dxos.client.services.NetworkService'),\n LoggingService: schema.getService('dxos.client.services.LoggingService'),\n\n IdentityService: schema.getService('dxos.client.services.IdentityService'),\n QueryService: schema.getService('dxos.echo.query.QueryService'),\n InvitationsService: schema.getService('dxos.client.services.InvitationsService'),\n DevicesService: schema.getService('dxos.client.services.DevicesService'),\n SpacesService: schema.getService('dxos.client.services.SpacesService'),\n DataService: schema.getService('dxos.echo.service.DataService'),\n ContactsService: schema.getService('dxos.client.services.ContactsService'),\n EdgeAgentService: schema.getService('dxos.client.services.EdgeAgentService'),\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),\n TracingService: schema.getService('dxos.tracing.TracingService'),\n});\n\nexport type IframeServiceBundle = {\n BridgeService: BridgeService;\n};\n\nexport const iframeServiceBundle: ServiceBundle<IframeServiceBundle> = {\n BridgeService: schema.getService('dxos.mesh.bridge.BridgeService'),\n};\n\nexport type WorkerServiceBundle = {\n WorkerService: WorkerService;\n};\n\nexport const workerServiceBundle: ServiceBundle<WorkerServiceBundle> = {\n WorkerService: schema.getService('dxos.iframe.WorkerService'),\n};\n\nexport type AppServiceBundle = {\n AppService: AppService;\n};\n\nexport const appServiceBundle: ServiceBundle<AppServiceBundle> = {\n AppService: schema.getService('dxos.iframe.AppService'),\n};\n\nexport type ShellServiceBundle = {\n ShellService: ShellService;\n};\n\nexport const shellServiceBundle: ServiceBundle<ShellServiceBundle> = {\n ShellService: schema.getService('dxos.iframe.ShellService'),\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for making rpc connections from remote proxies.\n */\nexport const PROXY_CONNECTION_TIMEOUT = 30_000;\n\n/**\n * Timeout for the device to be added to the trusted set during auth.\n */\nexport const AUTH_TIMEOUT = 30_000;\n\n/**\n * Timeout for how long the remote client will wait before assuming the connection is lost.\n */\nexport const STATUS_TIMEOUT = 10_000;\n\n/**\n * Timeout for waiting before stealing resource lock.\n */\nexport const RESOURCE_LOCK_TIMEOUT = 3_000;\n\n/**\n * Timeout for space properties to be loaded in the set of tracked items.\n * Accounts for latency between SpaceService reporting the space as READY and DataService streaming the item states.\n */\nexport const LOAD_PROPERTIES_TIMEOUT = 3_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const CREATE_SPACE_TIMEOUT = 5_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const IMPORT_SPACE_TIMEOUT = 30_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n"],
5
- "mappings": ";;;;;;AAIO,IAAMA,iCAAiCC,OAAOC,IAAI,8BAAA;;;ACElD,IAAMC,2BAA2B;AACjC,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAC9B,IAAMC,mCAAmC;AAKzC,IAAMC,oBAAoB;AAE1B,IAAMC,0BAA0B;AAChC,IAAMC,gBAA6B;EAAEC,SAAS;AAAE;AAGvD,IAAMC,OAAO,OAAOC,YAAY,cAAeA,SAASC,KAAKF,QAAQ,KAAM;AAMpE,IAAMG,iBAAiB,CAACC,MAAcC,SAAiBC,OAA2BC,WACvF,GAAGH,IAAAA,YAAgBC,OAAAA,MAAaC,OAAO,IAAIA,IAAAA,KAAS;AAG/C,IAAME,YAAY,GAAGR,IAAAA;AAGrB,IAAMS,WAAW,GAAGT,IAAAA;AAIpB,IAAMU,UAAU,GAAGV,IAAAA;AAGnB,IAAMW,WAAW,GAAGX,IAAAA;AAGpB,IAAMY,aAAa;AAEnB,IAAMC,gBAAgB;AACtB,IAAMC,kBAAkB;AACxB,IAAMC,iBAAiB;AACvB,IAAMC,yBAAyB;;;AC5CtC,OAAOC,UAAU;AAEjB,SAASC,cAAc;AACvB,SAASC,kBAAkB;AAG3B,IAAMC,SAASC,KAAK,gEAAA;AAEpB,IAAMC,QAAQC,OAAOC,gBAAgB,iCAAA;AAK9B,IAAMC,oBAAN,MAAMA;EACX,OAAOC,OAAOC,MAA0B;AACtC,UAAMC,oBAAoBN,MAAMI,OAAON,OAA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AAOC,WAAW,6BAAA;AACpC,CAAA;AAMO,IAAMa,sBAA0D;EACrEC,eAAef,QAAOC,WAAW,gCAAA;AACnC;AAMO,IAAMe,sBAA0D;EACrEC,eAAejB,QAAOC,WAAW,2BAAA;AACnC;AAMO,IAAMiB,mBAAoD;EAC/DC,YAAYnB,QAAOC,WAAW,wBAAA;AAChC;AAMO,IAAMmB,qBAAwD;EACnEC,cAAcrB,QAAOC,WAAW,0BAAA;AAClC;;;AC/GO,IAAMqB,2BAA2B;AAKjC,IAAMC,eAAe;AAKrB,IAAMC,iBAAiB;AAKvB,IAAMC,wBAAwB;AAM9B,IAAMC,0BAA0B;AAKhC,IAAMC,uBAAuB;AAK7B,IAAMC,uBAAuB;AAK7B,IAAMC,6BAA6B;",
6
- "names": ["ClientServicesProviderResource", "Symbol", "for", "DEFAULT_INTERNAL_CHANNEL", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_WORKER_BROADCAST_CHANNEL", "DEFAULT_VAULT_URL", "EXPECTED_CONFIG_VERSION", "defaultConfig", "version", "HOME", "process", "env", "getProfilePath", "root", "profile", "file", "undefined", "DX_CONFIG", "DX_CACHE", "DX_DATA", "DX_STATE", "DX_RUNTIME", "ENV_DX_CONFIG", "ENV_DX_NO_AGENT", "ENV_DX_PROFILE", "ENV_DX_PROFILE_DEFAULT", "base", "schema", "Invitation", "base62", "base", "codec", "schema", "getCodecForType", "InvitationEncoder", "decode", "text", "decodedInvitation", "type", "Invitation", "Type", "MULTIUSE", "INTERACTIVE", "multiUse", "encode", "invitation", "invitationId", "kind", "authMethod", "swarmKey", "state", "timeout", "guestKeypair", "spaceId", "lifetime", "created", "spaceKey", "target", "MulticastObservable", "invariant", "Invitation", "AUTHENTICATION_CODE_LENGTH", "INVITATION_TIMEOUT", "CancellableInvitation", "_onCancel", "subscriber", "initialInvitation", "onCancel", "cancel", "expired", "expiration", "getExpirationTime", "get", "getTime", "Date", "now", "expiry", "AuthenticatingInvitation", "_onAuthenticate", "onAuthenticate", "authenticate", "authCode", "wrapObservable", "observable", "Promise", "resolve", "reject", "subscription", "subscribe", "invitation", "state", "State", "SUCCESS", "unsubscribe", "err", "created", "lifetime", "schema", "createServiceBundle", "clientServiceBundle", "createServiceBundle", "SystemService", "schema", "getService", "NetworkService", "LoggingService", "IdentityService", "QueryService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "ContactsService", "EdgeAgentService", "DevtoolsHost", "TracingService", "iframeServiceBundle", "BridgeService", "workerServiceBundle", "WorkerService", "appServiceBundle", "AppService", "shellServiceBundle", "ShellService", "PROXY_CONNECTION_TIMEOUT", "AUTH_TIMEOUT", "STATUS_TIMEOUT", "RESOURCE_LOCK_TIMEOUT", "LOAD_PROPERTIES_TIMEOUT", "CREATE_SPACE_TIMEOUT", "IMPORT_SPACE_TIMEOUT", "LOAD_CONTROL_FEEDS_TIMEOUT"]
3
+ "sources": ["../../../src/client.ts", "../../../src/config.ts", "../../../src/invitations/encoder.ts", "../../../src/invitations/invitations.ts", "../../../src/service.ts", "../../../src/space.ts", "../../../src/timeouts.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nexport const ClientServicesProviderResource = Symbol.for('dxos.resource.ClientServices');\n", "//\n// Copyright 2022 DXOS.org\n//\n\n// TODO(wittjosiah): Factor out to @dxos/config.\n\nexport const DEFAULT_CLIENT_CHANNEL = 'dxos:app';\nexport const DEFAULT_INTERNAL_CHANNEL = 'dxos:vault';\nexport const DEFAULT_SHELL_CHANNEL = 'dxos:shell';\nexport const DEFAULT_WORKER_BROADCAST_CHANNEL = 'dxos:shared-worker';\n\n/**\n * @deprecated\n */\nexport const DEFAULT_VAULT_URL = 'https://halo.dxos.org/vault.html';\n\n/**\n * @deprecated\n */\n// TODO(burdon): Remove need (i.e., make undefined do the right thing).\nexport const DEFAULT_PROFILE = 'default';\n\nexport const EXPECTED_CONFIG_VERSION = 1;\nexport const defaultConfig = { version: 1 };\n\n// TODO(burdon): Allow override via env? Generalize since currently NodeJS only.\nconst HOME = typeof process !== 'undefined' ? (process?.env?.HOME ?? '') : '';\n\n// XDG_CONFIG_HOME (Analogous to /etc.)\nexport const DX_CONFIG = `${HOME}/.config/dx`;\n\n// XDG_CACHE_HOME (Analogous to /var/cache).\nexport const DX_CACHE = `${HOME}/.cache/dx`;\n\n// TODO(burdon): Storage should use this by default (make path optional).\n// XDG_DATA_HOME (Analogous to /usr/share).\nexport const DX_DATA = `${HOME}/.local/share/dx`;\n\n// XDG_STATE_HOME (Analogous to /var/lib).\nexport const DX_STATE = `${HOME}/.local/state/dx`;\n\n// XDG_RUNTIME_DIR (Non-essential files, sockets, etc.)\nexport const DX_RUNTIME = '/tmp/dx/run';\n\nexport enum DXEnv {\n CONFIG = 'DX_CONFIG',\n DEBUG = 'DX_DEBUG',\n NO_AGENT = 'DX_NO_AGENT',\n PROFILE = 'DX_PROFILE',\n}\n\nexport namespace DXEnv {\n /**\n * Helper to get the value from process.env\n */\n export function get(variable: DXEnv): string | undefined;\n export function get(variable: DXEnv, defaultValue: string): string;\n export function get(variable: DXEnv, defaultValue?: string): string | undefined {\n return process.env[variable] ?? defaultValue;\n }\n}\n\n// Profile layout: profile/<name> is the profile dir; profile/<name>.yml is the config file.\nexport const getProfilePath = (root: string, profile: string, file?: string) =>\n `${root}/profile/${profile}` + (file ? `/${file}` : '');\n\n/** Path to the profile config file (profile/<name>.yml). */\nexport const getProfileConfigPath = (root: string, profile: string) => `${getProfilePath(root, profile)}.yml`;\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport base from 'base-x';\n\nimport { schema } from '@dxos/protocols/proto';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\n// Encode with URL-safe alpha-numeric characters.\nconst base62 = base('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');\n\nconst codec = schema.getCodecForType('dxos.client.services.Invitation');\n\n/**\n * Encodes and decodes an invitation proto into/from alphanumeric chars.\n */\nexport class InvitationEncoder {\n static decode(text: string): Invitation {\n const decodedInvitation = codec.decode(base62.decode(text));\n if (decodedInvitation.type === Invitation.Type.MULTIUSE) {\n decodedInvitation.type = Invitation.Type.INTERACTIVE;\n decodedInvitation.multiUse = true;\n }\n return decodedInvitation;\n }\n\n static encode(invitation: Invitation): string {\n return base62.encode(\n codec.encode({\n invitationId: invitation.invitationId,\n type: invitation.type,\n kind: invitation.kind,\n authMethod: invitation.authMethod,\n swarmKey: invitation.swarmKey,\n state: invitation.state,\n timeout: invitation.timeout,\n guestKeypair: invitation.guestKeypair,\n spaceId: invitation.spaceId,\n lifetime: invitation.lifetime,\n created: invitation.created,\n // TODO(wittjosiah): Make these optional to encode for greater privacy.\n ...(invitation.spaceKey ? { spaceKey: invitation.spaceKey } : {}),\n ...(invitation.target ? { target: invitation.target } : {}),\n }),\n );\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { MulticastObservable, type Observable, type Subscriber } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { Invitation } from '@dxos/protocols/proto/dxos/client/services';\n\nexport const AUTHENTICATION_CODE_LENGTH = 6;\n\nexport const INVITATION_TIMEOUT = 3 * 60_000; // 3 mins.\n\nexport interface Invitations {\n created: MulticastObservable<CancellableInvitation[]>;\n accepted: MulticastObservable<AuthenticatingInvitation[]>;\n share(options?: Partial<Invitation>): CancellableInvitation;\n join(invitation: Invitation): AuthenticatingInvitation;\n}\n\n/**\n * Base class for all invitation observables and providers.\n */\nexport class CancellableInvitation extends MulticastObservable<Invitation> {\n private readonly _onCancel: () => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n }) {\n super(subscriber, initialInvitation);\n this._onCancel = onCancel;\n }\n\n cancel(): Promise<void> {\n return this._onCancel();\n }\n\n get expired() {\n const expiration = getExpirationTime(this.get());\n return expiration && expiration.getTime() < Date.now();\n }\n\n get expiry() {\n return getExpirationTime(this.get());\n }\n}\n\n/**\n * Cancelable observer that relays authentication requests.\n */\nexport class AuthenticatingInvitation extends CancellableInvitation {\n private readonly _onAuthenticate: (authCode: string) => Promise<void>;\n\n constructor({\n subscriber,\n initialInvitation,\n onCancel,\n onAuthenticate,\n }: {\n subscriber: Observable<Invitation> | Subscriber<Invitation>;\n initialInvitation: Invitation;\n onCancel: () => Promise<void>;\n onAuthenticate: (authCode: string) => Promise<void>;\n }) {\n super({ subscriber, initialInvitation, onCancel });\n this._onAuthenticate = onAuthenticate;\n }\n\n async authenticate(authCode: string): Promise<void> {\n return this._onAuthenticate(authCode);\n }\n}\n\n/**\n * Testing util to wrap non-authenticating observable with promise.\n * Don't use this in production code.\n * @deprecated\n */\n// TODO(wittjosiah): Move to testing.\nexport const wrapObservable = async (observable: CancellableInvitation): Promise<Invitation> => {\n return new Promise((resolve, reject) => {\n const subscription = observable.subscribe(\n (invitation: Invitation | undefined) => {\n // TODO(burdon): Throw error if auth requested.\n invariant(invitation?.state === Invitation.State.SUCCESS);\n subscription.unsubscribe();\n resolve(invitation);\n },\n (err: Error) => {\n subscription.unsubscribe();\n reject(err);\n },\n );\n });\n};\n\nexport const getExpirationTime = (invitation: Partial<Invitation>): Date | undefined => {\n if (!(invitation.created && invitation.lifetime)) {\n return;\n }\n return new Date(invitation.created.getTime() + invitation.lifetime * 1000);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Event } from '@dxos/async';\nimport { schema } from '@dxos/protocols/proto';\nimport type {\n ContactsService,\n DevicesService,\n EdgeAgentService,\n IdentityService,\n InvitationsService,\n LoggingService,\n NetworkService,\n QueueService,\n SpacesService,\n SystemService,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport type { DevtoolsHost } from '@dxos/protocols/proto/dxos/devtools/host';\nimport type { QueryService } from '@dxos/protocols/proto/dxos/echo/query';\nimport type { DataService } from '@dxos/protocols/proto/dxos/echo/service';\nimport type { AppService, ShellService, WorkerService } from '@dxos/protocols/proto/dxos/iframe';\nimport type { BridgeService } from '@dxos/protocols/proto/dxos/mesh/bridge';\nimport { type ServiceBundle, createServiceBundle } from '@dxos/rpc';\n\nexport type { QueueService } from '@dxos/protocols/proto/dxos/client/services';\n\n//\n// NOTE: Should contain client/proxy dependencies only.\n//\n\nexport type ClientServices = {\n SystemService: SystemService;\n NetworkService: NetworkService;\n LoggingService: LoggingService;\n\n IdentityService: IdentityService;\n InvitationsService: InvitationsService;\n DevicesService: DevicesService;\n SpacesService: SpacesService;\n\n DataService: DataService;\n QueryService: QueryService;\n QueueService: QueueService;\n\n ContactsService: ContactsService;\n EdgeAgentService: EdgeAgentService;\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: DevtoolsHost;\n};\n\n/**\n * Provide access to client services definitions and service handler.\n */\nexport interface ClientServicesProvider {\n /**\n * The connection to the services provider was terminated.\n * This should fire if the services disconnect unexpectedly or during a client reset.\n */\n closed: Event<Error | undefined>;\n\n /**\n * The underlying service connection was re-established.\n * Fires after all reconnection callbacks have completed.\n */\n reconnected?: Event<void>;\n\n /**\n * Register a callback to be invoked when services reconnect.\n * The callback should re-establish any RPC streams.\n * Reconnection waits for all callbacks to complete before emitting `reconnected`.\n */\n onReconnect?: (callback: () => Promise<void>) => void;\n\n descriptors: ServiceBundle<ClientServices>;\n services: Partial<ClientServices>;\n\n // TODO(burdon): Should take context from parent?\n open(): Promise<unknown>;\n close(): Promise<unknown>;\n}\n\n/**\n * Services supported by host.\n */\nexport const clientServiceBundle = createServiceBundle<ClientServices>({\n SystemService: schema.getService('dxos.client.services.SystemService'),\n NetworkService: schema.getService('dxos.client.services.NetworkService'),\n LoggingService: schema.getService('dxos.client.services.LoggingService'),\n\n IdentityService: schema.getService('dxos.client.services.IdentityService'),\n QueryService: schema.getService('dxos.echo.query.QueryService'),\n InvitationsService: schema.getService('dxos.client.services.InvitationsService'),\n DevicesService: schema.getService('dxos.client.services.DevicesService'),\n SpacesService: schema.getService('dxos.client.services.SpacesService'),\n DataService: schema.getService('dxos.echo.service.DataService'),\n ContactsService: schema.getService('dxos.client.services.ContactsService'),\n EdgeAgentService: schema.getService('dxos.client.services.EdgeAgentService'),\n QueueService: schema.getService('dxos.client.services.QueueService'),\n\n // TODO(burdon): Deprecated.\n DevtoolsHost: schema.getService('dxos.devtools.host.DevtoolsHost'),\n});\n\nexport type IframeServiceBundle = {\n BridgeService: BridgeService;\n};\n\nexport const iframeServiceBundle: ServiceBundle<IframeServiceBundle> = {\n BridgeService: schema.getService('dxos.mesh.bridge.BridgeService'),\n};\n\nexport type WorkerServiceBundle = {\n WorkerService: WorkerService;\n};\n\nexport const workerServiceBundle: ServiceBundle<WorkerServiceBundle> = {\n WorkerService: schema.getService('dxos.iframe.WorkerService'),\n};\n\nexport type AppServiceBundle = {\n AppService: AppService;\n};\n\nexport const appServiceBundle: ServiceBundle<AppServiceBundle> = {\n AppService: schema.getService('dxos.iframe.AppService'),\n};\n\nexport type ShellServiceBundle = {\n ShellService: ShellService;\n};\n\nexport const shellServiceBundle: ServiceBundle<ShellServiceBundle> = {\n ShellService: schema.getService('dxos.iframe.ShellService'),\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { type MulticastObservable } from '@dxos/async';\nimport { type SpecificCredential } from '@dxos/credentials';\nimport { type Database, type Obj } from '@dxos/echo';\nimport { type EchoDatabase, type QueueFactory, type SpaceSyncState } from '@dxos/echo-db';\nimport { type PublicKey, type SpaceId } from '@dxos/keys';\nimport { type Messenger } from '@dxos/protocols';\nimport {\n type Contact,\n type CreateEpochRequest,\n type Invitation,\n SpaceArchive,\n type Space as SpaceData,\n type SpaceMember,\n type SpaceState,\n type UpdateMemberRoleRequest,\n} from '@dxos/protocols/proto/dxos/client/services';\nimport { type EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';\nimport { type SpaceSnapshot } from '@dxos/protocols/proto/dxos/echo/snapshot';\nimport { type Credential, type Epoch, type MembershipPolicy } from '@dxos/protocols/proto/dxos/halo/credentials';\n\nimport { type CancellableInvitation } from './invitations';\nimport { type SpaceProperties } from './types';\n\nexport type CreateEpochOptions = {\n migration?: CreateEpochRequest.Migration;\n automergeRootUrl?: string;\n};\n\nexport type ExportSpaceOptions = {\n /**\n * Archive format.\n * @default SpaceArchive.Format.BINARY\n */\n format?: SpaceArchive.Format;\n};\n\nexport interface SpaceInternal {\n get db(): EchoDatabase;\n get data(): SpaceData;\n\n getCredentials(): Promise<Credential[]>;\n\n getEpochs(): Promise<SpecificCredential<Epoch>[]>;\n\n // TODO(dmaretskyi): Return epoch info.\n createEpoch(options?: CreateEpochOptions): Promise<void>;\n\n // TOOD(burdon): Start to factor out credentials.\n removeMember(memberKey: PublicKey): Promise<void>;\n\n export(options?: ExportSpaceOptions): Promise<SpaceArchive>;\n\n /**\n * Migrate space data to the latest version.\n */\n migrate(): Promise<void>;\n\n setEdgeReplicationPreference(setting: EdgeReplicationSetting): Promise<void>;\n\n /**\n * Waits until the space is fully synced with EDGE.\n * @throws If the EDGE sync is disabled.\n */\n syncToEdge(opts?: {\n onProgress: (state: SpaceSyncState.PeerState | undefined) => void;\n timeout?: number;\n }): Promise<void>;\n}\n\nexport const SPACE_TAG = Symbol('dxos.client.protocol.Space');\n\nexport interface Space extends Messenger {\n readonly [SPACE_TAG]: true;\n\n /**\n * @deprecated Use `id`.\n */\n get key(): PublicKey;\n\n /**\n * Unique space identifier.\n */\n get id(): SpaceId;\n\n /**\n * Echo database.\n */\n get db(): Database.Database;\n\n /**\n * Access to queues.\n */\n get queues(): QueueFactory;\n\n // TODO(burdon): Replace with state?\n get isOpen(): boolean;\n\n /**\n * Immutable tags assigned at space creation time.\n * Available on closed spaces.\n */\n get tags(): string[];\n\n /**\n * Immutable membership policy assigned at space creation time.\n * Available on closed spaces.\n */\n get membershipPolicy(): MembershipPolicy;\n\n /**\n * Current state of the space.\n * The database is ready to be used in `SpaceState.SPACE_READY` state.\n * Presence is available in `SpaceState.SPACE_CONTROL_ONLY` state.\n */\n get state(): MulticastObservable<SpaceState>;\n\n /**\n * Properties object.\n */\n get properties(): Obj.OfShape<SpaceProperties>;\n\n /**\n * Current state of space pipeline.\n */\n get pipeline(): MulticastObservable<SpaceData.PipelineState>;\n\n get invitations(): MulticastObservable<CancellableInvitation[]>;\n\n get members(): MulticastObservable<SpaceMember[]>;\n\n /**\n * @deprecated\n */\n // TODO(wittjosiah): Audit and remove. This should not be exposed (or marked as internal).\n get internal(): SpaceInternal;\n\n /**\n * Activates the space enabling the use of the database and starts replication with peers.\n * The setting is persisted on the local device.\n */\n // TODO(wittjosiah): Rename activate/deactivate?\n open(): Promise<void>;\n\n /**\n * Deactivates the space stopping replication with other peers.\n * The space will not auto-open on the next app launch.\n * The setting is persisted on the local device.\n */\n close(): Promise<void>;\n\n /**\n * Waits until the space is in the ready state, with database initialized.\n */\n waitUntilReady(): Promise<this>;\n\n createSnapshot(): Promise<SpaceSnapshot>;\n\n // TODO(burdon): Create invitation?\n // TODO(burdon): Factor out membership, etc.\n share(options?: Partial<Invitation>): CancellableInvitation;\n admitContact(contact: Contact): Promise<void>;\n updateMemberRole(request: Omit<UpdateMemberRoleRequest, 'spaceKey'>): Promise<void>;\n}\n\nexport const isSpace = (object: unknown): object is Space =>\n typeof object === 'object' && object != null && (object as Space)[SPACE_TAG] === true;\n\n// TODO(burdon): Create lower-level definition (HasId, db, etc.) and move to @dxos/echo.\nexport const SpaceSchema: Schema.Schema<Space> = Schema.Any.pipe(\n Schema.filter((space) => isSpace(space)),\n Schema.annotations({ title: 'Space' }),\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Timeout for making rpc connections from remote proxies.\n */\nexport const PROXY_CONNECTION_TIMEOUT = 30_000;\n\n/**\n * Timeout for the device to be added to the trusted set during auth.\n */\nexport const AUTH_TIMEOUT = 30_000;\n\n/**\n * Timeout for how long the remote client will wait before assuming the connection is lost.\n */\nexport const STATUS_TIMEOUT = 10_000;\n\n/**\n * Timeout for waiting before stealing resource lock.\n */\nexport const RESOURCE_LOCK_TIMEOUT = 3_000;\n\n/**\n * Timeout for space properties to be loaded in the set of tracked items.\n * Accounts for latency between SpaceService reporting the space as READY and DataService streaming the item states.\n */\nexport const LOAD_PROPERTIES_TIMEOUT = 3_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const CREATE_SPACE_TIMEOUT = 5_000;\n\n/**\n * Timeout for creating new spaces.\n */\nexport const IMPORT_SPACE_TIMEOUT = 30_000;\n\n/**\n * Timeout for loading of control feeds.\n */\nexport const LOAD_CONTROL_FEEDS_TIMEOUT = 3_000;\n"],
5
+ "mappings": ";;;;;;;;AAIO,IAAMA,iCAAiCC,uBAAOC,IAAI,8BAAA;;;ACElD,IAAMC,yBAAyB;AAC/B,IAAMC,2BAA2B;AACjC,IAAMC,wBAAwB;AAC9B,IAAMC,mCAAmC;AAKzC,IAAMC,oBAAoB;AAM1B,IAAMC,kBAAkB;AAExB,IAAMC,0BAA0B;AAChC,IAAMC,gBAAgB;EAAEC,SAAS;AAAE;AAG1C,IAAMC,OAAO,OAAOC,YAAY,cAAeA,SAASC,KAAKF,QAAQ,KAAM;AAGpE,IAAMG,YAAY,GAAGH,IAAAA;AAGrB,IAAMI,WAAW,GAAGJ,IAAAA;AAIpB,IAAMK,UAAU,GAAGL,IAAAA;AAGnB,IAAMM,WAAW,GAAGN,IAAAA;AAGpB,IAAMO,aAAa;AAEnB,IAAKC,QAAAA,0BAAAA,QAAAA;;;;;SAAAA;;UAOKA,QAAAA;AAMR,WAASC,IAAIC,UAAiBC,cAAqB;AACxD,WAAOV,QAAQC,IAAIQ,QAAAA,KAAaC;EAClC;SAFgBF,MAAAA;AAGlB,GATiBD,UAAAA,QAAAA,CAAAA,EAAAA;AAYV,IAAMI,iBAAiB,CAACC,MAAcC,SAAiBC,SAC5D,GAAGF,IAAAA,YAAgBC,OAAAA,MAAaC,OAAO,IAAIA,IAAAA,KAAS;AAG/C,IAAMC,uBA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AAOI,WAAW,+BAAA;EAC/BS,iBAAiBb,QAAOI,WAAW,sCAAA;EACnCU,kBAAkBd,QAAOI,WAAW,uCAAA;EACpCW,cAAcf,QAAOI,WAAW,mCAAA;;EAGhCY,cAAchB,QAAOI,WAAW,iCAAA;AAClC,CAAA;AAMO,IAAMa,sBAA0D;EACrEC,eAAelB,QAAOI,WAAW,gCAAA;AACnC;AAMO,IAAMe,sBAA0D;EACrEC,eAAepB,QAAOI,WAAW,2BAAA;AACnC;AAMO,IAAMiB,mBAAoD;EAC/DC,YAAYtB,QAAOI,WAAW,wBAAA;AAChC;AAMO,IAAMmB,qBAAwD;EACnEC,cAAcxB,QAAOI,WAAW,0BAAA;AAClC;;;ACnIA,YAAYqB,YAAY;AAuEjB,IAAMC,YAAYC,uBAAO,4BAAA;AA+FzB,IAAMC,UAAU,CAACC,WACtB,OAAOA,WAAW,YAAYA,UAAU,QAASA,OAAiBH,SAAAA,MAAe;AAG5E,IAAMI,cAA2CC,WAAIC,KACnDC,cAAO,CAACC,UAAUN,QAAQM,KAAAA,CAAAA,GAC1BC,mBAAY;EAAEC,OAAO;AAAQ,CAAA,CAAA;;;ACzK/B,IAAMC,2BAA2B;AAKjC,IAAMC,eAAe;AAKrB,IAAMC,iBAAiB;AAKvB,IAAMC,wBAAwB;AAM9B,IAAMC,0BAA0B;AAKhC,IAAMC,uBAAuB;AAK7B,IAAMC,uBAAuB;AAK7B,IAAMC,6BAA6B;",
6
+ "names": ["ClientServicesProviderResource", "Symbol", "for", "DEFAULT_CLIENT_CHANNEL", "DEFAULT_INTERNAL_CHANNEL", "DEFAULT_SHELL_CHANNEL", "DEFAULT_WORKER_BROADCAST_CHANNEL", "DEFAULT_VAULT_URL", "DEFAULT_PROFILE", "EXPECTED_CONFIG_VERSION", "defaultConfig", "version", "HOME", "process", "env", "DX_CONFIG", "DX_CACHE", "DX_DATA", "DX_STATE", "DX_RUNTIME", "DXEnv", "get", "variable", "defaultValue", "getProfilePath", "root", "profile", "file", "getProfileConfigPath", "base", "schema", "Invitation", "base62", "codec", "getCodecForType", "InvitationEncoder", "decode", "text", "decodedInvitation", "type", "Type", "MULTIUSE", "INTERACTIVE", "multiUse", "encode", "invitation", "invitationId", "kind", "authMethod", "swarmKey", "state", "timeout", "guestKeypair", "spaceId", "lifetime", "created", "spaceKey", "target", "MulticastObservable", "invariant", "Invitation", "AUTHENTICATION_CODE_LENGTH", "_onCancel", "onCancel", "cancel", "expired", "expiration", "expiry", "onAuthenticate", "subscriber", "initialInvitation", "authenticate", "observable", "invitation", "state", "SUCCESS", "resolve", "err", "subscription", "unsubscribe", "reject", "schema", "createServiceBundle", "clientServiceBundle", "SystemService", "getService", "NetworkService", "LoggingService", "IdentityService", "QueryService", "InvitationsService", "DevicesService", "SpacesService", "DataService", "ContactsService", "EdgeAgentService", "QueueService", "DevtoolsHost", "iframeServiceBundle", "BridgeService", "workerServiceBundle", "WorkerService", "appServiceBundle", "AppService", "shellServiceBundle", "ShellService", "Schema", "SPACE_TAG", "Symbol", "isSpace", "object", "SpaceSchema", "Any", "pipe", "filter", "space", "annotations", "title", "PROXY_CONNECTION_TIMEOUT", "AUTH_TIMEOUT", "STATUS_TIMEOUT", "RESOURCE_LOCK_TIMEOUT", "LOAD_PROPERTIES_TIMEOUT", "CREATE_SPACE_TIMEOUT", "IMPORT_SPACE_TIMEOUT", "LOAD_CONTROL_FEEDS_TIMEOUT"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/client.ts":{"bytes":710,"imports":[],"format":"esm"},"src/config.ts":{"bytes":6067,"imports":[],"format":"esm"},"src/invitations/encoder.ts":{"bytes":5819,"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"src/invitations/invitations.ts":{"bytes":9357,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"src/invitations/index.ts":{"bytes":565,"imports":[{"path":"src/invitations/encoder.ts","kind":"import-statement","original":"./encoder"},{"path":"src/invitations/invitations.ts","kind":"import-statement","original":"./invitations"}],"format":"esm"},"src/service-definitions.ts":{"bytes":9009,"imports":[{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true}],"format":"esm"},"src/timeouts.ts":{"bytes":3417,"imports":[],"format":"esm"},"src/types/Properties.ts":{"bytes":2952,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":467,"imports":[{"path":"src/types/Properties.ts","kind":"import-statement","original":"./Properties"}],"format":"esm"},"src/index.ts":{"bytes":1082,"imports":[{"path":"src/client.ts","kind":"import-statement","original":"./client"},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/invitations/index.ts","kind":"import-statement","original":"./invitations"},{"path":"src/service-definitions.ts","kind":"import-statement","original":"./service-definitions"},{"path":"src/timeouts.ts","kind":"import-statement","original":"./timeouts"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":17529},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-HIQWFHOK.mjs","kind":"import-statement"},{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true}],"exports":["AUTHENTICATION_CODE_LENGTH","AUTH_TIMEOUT","AuthenticatingInvitation","CREATE_SPACE_TIMEOUT","CancellableInvitation","ClientServicesProviderResource","DEFAULT_CLIENT_CHANNEL","DEFAULT_INTERNAL_CHANNEL","DEFAULT_SHELL_CHANNEL","DEFAULT_VAULT_URL","DEFAULT_WORKER_BROADCAST_CHANNEL","DX_CACHE","DX_CONFIG","DX_DATA","DX_RUNTIME","DX_STATE","ENV_DX_CONFIG","ENV_DX_NO_AGENT","ENV_DX_PROFILE","ENV_DX_PROFILE_DEFAULT","EXPECTED_CONFIG_VERSION","IMPORT_SPACE_TIMEOUT","INVITATION_TIMEOUT","InvitationEncoder","LOAD_CONTROL_FEEDS_TIMEOUT","LOAD_PROPERTIES_TIMEOUT","PROXY_CONNECTION_TIMEOUT","PropertiesType","RESOURCE_LOCK_TIMEOUT","STATUS_TIMEOUT","TYPE_PROPERTIES","appServiceBundle","clientServiceBundle","defaultConfig","getExpirationTime","getProfilePath","iframeServiceBundle","shellServiceBundle","workerServiceBundle","wrapObservable"],"entryPoint":"src/index.ts","inputs":{"src/client.ts":{"bytesInOutput":81},"src/index.ts":{"bytesInOutput":0},"src/config.ts":{"bytesInOutput":841},"src/invitations/encoder.ts":{"bytesInOutput":1355},"src/invitations/index.ts":{"bytesInOutput":0},"src/invitations/invitations.ts":{"bytesInOutput":1921},"src/service-definitions.ts":{"bytesInOutput":1548},"src/timeouts.ts":{"bytesInOutput":256}},"bytes":7156},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-HIQWFHOK.mjs","kind":"import-statement"}],"exports":["PropertiesType","TYPE_PROPERTIES"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":160},"dist/lib/browser/chunk-HIQWFHOK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1544},"dist/lib/browser/chunk-HIQWFHOK.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true}],"exports":["PropertiesType","TYPE_PROPERTIES"],"inputs":{"src/types/Properties.ts":{"bytesInOutput":559},"src/types/index.ts":{"bytesInOutput":0}},"bytes":679}}}
1
+ {"inputs":{"src/client.ts":{"bytes":626,"imports":[],"format":"esm"},"src/config.ts":{"bytes":7251,"imports":[],"format":"esm"},"src/invitations/encoder.ts":{"bytes":5726,"imports":[{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"src/invitations/invitations.ts":{"bytes":9220,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true}],"format":"esm"},"src/invitations/index.ts":{"bytes":470,"imports":[{"path":"src/invitations/encoder.ts","kind":"import-statement","original":"./encoder"},{"path":"src/invitations/invitations.ts","kind":"import-statement","original":"./invitations"}],"format":"esm"},"src/service.ts":{"bytes":9540,"imports":[{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true}],"format":"esm"},"src/space.ts":{"bytes":8070,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true}],"format":"esm"},"src/timeouts.ts":{"bytes":3335,"imports":[],"format":"esm"},"src/types/SpaceProperties.ts":{"bytes":7142,"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/types/index.ts":{"bytes":395,"imports":[{"path":"src/types/SpaceProperties.ts","kind":"import-statement","original":"./SpaceProperties"}],"format":"esm"},"src/index.ts":{"bytes":1008,"imports":[{"path":"src/client.ts","kind":"import-statement","original":"./client"},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/invitations/index.ts","kind":"import-statement","original":"./invitations"},{"path":"src/service.ts","kind":"import-statement","original":"./service"},{"path":"src/space.ts","kind":"import-statement","original":"./space"},{"path":"src/timeouts.ts","kind":"import-statement","original":"./timeouts"},{"path":"src/types/index.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23734},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-GCBXMPTW.mjs","kind":"import-statement"},{"path":"base-x","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto/dxos/client/services","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/rpc","kind":"import-statement","external":true},{"path":"effect/Schema","kind":"import-statement","external":true}],"exports":["AUTHENTICATION_CODE_LENGTH","AUTH_TIMEOUT","AuthenticatingInvitation","CREATE_SPACE_TIMEOUT","CancellableInvitation","ClientServicesProviderResource","ComputeEnvironment","DEFAULT_CLIENT_CHANNEL","DEFAULT_INTERNAL_CHANNEL","DEFAULT_PROFILE","DEFAULT_SHELL_CHANNEL","DEFAULT_VAULT_URL","DEFAULT_WORKER_BROADCAST_CHANNEL","DXEnv","DX_CACHE","DX_CONFIG","DX_DATA","DX_RUNTIME","DX_STATE","EXPECTED_CONFIG_VERSION","IMPORT_SPACE_TIMEOUT","INVITATION_TIMEOUT","InvitationEncoder","LOAD_CONTROL_FEEDS_TIMEOUT","LOAD_PROPERTIES_TIMEOUT","LegacySpaceProperties","PROXY_CONNECTION_TIMEOUT","RESOURCE_LOCK_TIMEOUT","SPACE_TAG","STATUS_TIMEOUT","SpaceProperties","SpacePropertiesSchema","SpaceSchema","appServiceBundle","clientServiceBundle","defaultConfig","getExpirationTime","getProfileConfigPath","getProfilePath","iframeServiceBundle","isSpace","shellServiceBundle","workerServiceBundle","wrapObservable"],"entryPoint":"src/index.ts","inputs":{"src/client.ts":{"bytesInOutput":97},"src/index.ts":{"bytesInOutput":0},"src/config.ts":{"bytesInOutput":1181},"src/invitations/encoder.ts":{"bytesInOutput":1355},"src/invitations/invitations.ts":{"bytesInOutput":1877},"src/service.ts":{"bytesInOutput":1552},"src/space.ts":{"bytesInOutput":332},"src/timeouts.ts":{"bytesInOutput":256}},"bytes":7928},"dist/lib/browser/types/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/types/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-GCBXMPTW.mjs","kind":"import-statement"}],"exports":["ComputeEnvironment","LegacySpaceProperties","SpaceProperties","SpacePropertiesSchema"],"entryPoint":"src/types/index.ts","inputs":{},"bytes":268},"dist/lib/browser/chunk-GCBXMPTW.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3570},"dist/lib/browser/chunk-GCBXMPTW.mjs":{"imports":[{"path":"effect/Schema","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"exports":["ComputeEnvironment","LegacySpaceProperties","SpaceProperties","SpacePropertiesSchema"],"inputs":{"src/types/SpaceProperties.ts":{"bytesInOutput":1480},"src/types/index.ts":{"bytesInOutput":0}},"bytes":1659}}}
@@ -1,9 +1,13 @@
1
1
  import {
2
- PropertiesType,
3
- TYPE_PROPERTIES
4
- } from "../chunk-HIQWFHOK.mjs";
2
+ ComputeEnvironment,
3
+ LegacySpaceProperties,
4
+ SpaceProperties,
5
+ SpacePropertiesSchema
6
+ } from "../chunk-GCBXMPTW.mjs";
5
7
  export {
6
- PropertiesType,
7
- TYPE_PROPERTIES
8
+ ComputeEnvironment,
9
+ LegacySpaceProperties,
10
+ SpaceProperties,
11
+ SpacePropertiesSchema
8
12
  };
9
13
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,53 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // src/types/SpaceProperties.ts
4
+ import * as Schema from "effect/Schema";
5
+ import { Annotation, Feed, Ref, Type } from "@dxos/echo";
6
+ var ComputeEnvironment = Schema.Literal("disabled", "local", "edge");
7
+ var SpacePropertiesSchema = Schema.Struct({
8
+ //
9
+ // System properties.
10
+ //
11
+ archived: Schema.optional(Schema.Boolean.annotations({
12
+ title: "Archive Space"
13
+ })),
14
+ // TODO(burdon): Change to mode (no booleans?)
15
+ // TODO(wittjosiah): Make optional with default value.
16
+ edgeReplication: Schema.optional(Schema.Boolean),
17
+ /**
18
+ * @deprecated
19
+ */
20
+ invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),
21
+ /**
22
+ * Preference for trigger execution.
23
+ * *disabled* - triggers do not run locally or on EDGE.
24
+ * *local* - triggers are executed locally on the client, edge is not running triggers.
25
+ * *edge* - triggers are executed on the edge, triggers are not run locally.
26
+ */
27
+ computeEnvironment: Schema.optional(ComputeEnvironment),
28
+ //
29
+ // User properties.
30
+ //
31
+ name: Schema.optional(Schema.String),
32
+ icon: Schema.optional(Schema.String),
33
+ hue: Schema.optional(Schema.String)
34
+ }, {
35
+ key: Schema.String,
36
+ value: Schema.Any
37
+ });
38
+ var LegacySpaceProperties = SpacePropertiesSchema.pipe(Type.object({
39
+ typename: "org.dxos.type.space-properties",
40
+ version: "0.1.0"
41
+ }), Annotation.SystemTypeAnnotation.set(true));
42
+ var SpaceProperties = SpacePropertiesSchema.pipe(Type.object({
43
+ typename: "org.dxos.type.spaceProperties",
44
+ version: "0.1.0"
45
+ }), Annotation.SystemTypeAnnotation.set(true));
46
+
47
+ export {
48
+ ComputeEnvironment,
49
+ SpacePropertiesSchema,
50
+ LegacySpaceProperties,
51
+ SpaceProperties
52
+ };
53
+ //# sourceMappingURL=chunk-2RN4CLEW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/SpaceProperties.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Annotation, Feed, Ref, Type } from '@dxos/echo';\n\n/**\n * Where do triggers get executed.\n */\nexport const ComputeEnvironment = Schema.Literal('disabled', 'local', 'edge');\nexport type ComputeEnvironment = Schema.Schema.Type<typeof ComputeEnvironment>;\n\nexport const SpacePropertiesSchema = Schema.Struct(\n {\n //\n // System properties.\n //\n\n archived: Schema.optional(Schema.Boolean.annotations({ title: 'Archive Space' })),\n // TODO(burdon): Change to mode (no booleans?)\n // TODO(wittjosiah): Make optional with default value.\n edgeReplication: Schema.optional(Schema.Boolean),\n\n /**\n * @deprecated\n */\n invocationTraceFeed: Schema.optional(Ref.Ref(Feed.Feed)),\n\n /**\n * Preference for trigger execution.\n * *disabled* - triggers do not run locally or on EDGE.\n * *local* - triggers are executed locally on the client, edge is not running triggers.\n * *edge* - triggers are executed on the edge, triggers are not run locally.\n */\n computeEnvironment: Schema.optional(ComputeEnvironment),\n\n //\n // User properties.\n //\n\n name: Schema.optional(Schema.String),\n icon: Schema.optional(Schema.String),\n hue: Schema.optional(Schema.String),\n },\n {\n key: Schema.String,\n value: Schema.Any,\n },\n);\n\nexport type SpacePropertiesSchema = Schema.Schema.Type<typeof SpacePropertiesSchema>;\n\n/** @deprecated Use SpaceProperties instead. */\nexport const LegacySpaceProperties = SpacePropertiesSchema.pipe(\n Type.object({\n typename: 'org.dxos.type.space-properties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface LegacySpaceProperties extends Schema.Schema.Type<typeof LegacySpaceProperties> {}\n\n// TODO(burdon): Pipe Schem.optional, or partial to entire struct to make everything optional?\n// TODO(burdon): Is separate schema def required for forms? Can it be extracted from SpaceProperties?\nexport const SpaceProperties = SpacePropertiesSchema.pipe(\n Type.object({\n typename: 'org.dxos.type.spaceProperties',\n version: '0.1.0',\n }),\n Annotation.SystemTypeAnnotation.set(true),\n);\n\nexport interface SpaceProperties extends Schema.Schema.Type<typeof SpaceProperties> {}\n"],
5
+ "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,MAAMC,KAAKC,YAAY;AAKrC,IAAMC,qBAA4BC,eAAQ,YAAY,SAAS,MAAA;AAG/D,IAAMC,wBAA+BC,cAC1C;;;;EAKEC,UAAiBC,gBAAgBC,eAAQC,YAAY;IAAEC,OAAO;EAAgB,CAAA,CAAA;;;EAG9EC,iBAAwBJ,gBAAgBC,cAAO;;;;EAK/CI,qBAA4BL,gBAASP,IAAIA,IAAID,KAAKA,IAAI,CAAA;;;;;;;EAQtDc,oBAA2BN,gBAASL,kBAAAA;;;;EAMpCY,MAAaP,gBAAgBQ,aAAM;EACnCC,MAAaT,gBAAgBQ,aAAM;EACnCE,KAAYV,gBAAgBQ,aAAM;AACpC,GACA;EACEG,KAAYH;EACZI,OAAcC;AAChB,CAAA;AAMK,IAAMC,wBAAwBjB,sBAAsBkB,KACzDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;AAO/B,IAAMC,kBAAkBxB,sBAAsBkB,KACnDrB,KAAKsB,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACA3B,WAAW4B,qBAAqBC,IAAI,IAAA,CAAA;",
6
+ "names": ["Schema", "Annotation", "Feed", "Ref", "Type", "ComputeEnvironment", "Literal", "SpacePropertiesSchema", "Struct", "archived", "optional", "Boolean", "annotations", "title", "edgeReplication", "invocationTraceFeed", "computeEnvironment", "name", "String", "icon", "hue", "key", "value", "Any", "LegacySpaceProperties", "pipe", "object", "typename", "version", "SystemTypeAnnotation", "set", "SpaceProperties"]
7
+ }