@party-stack/runtime 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BrowserAuthenticationError.d.ts +2 -1
- package/lib/BrowserAuthenticationError.d.ts.map +1 -1
- package/lib/BrowserAuthenticationError.js +3 -1
- package/lib/BrowserAuthenticationError.js.map +1 -1
- package/lib/Geolocation.d.ts +45 -0
- package/lib/Geolocation.d.ts.map +1 -0
- package/lib/Geolocation.js +20 -0
- package/lib/Geolocation.js.map +1 -0
- package/lib/Runtime.d.ts +3 -0
- package/lib/Runtime.d.ts.map +1 -1
- package/lib/Runtime.js +1 -0
- package/lib/Runtime.js.map +1 -1
- package/lib/Runtimes.d.ts +3 -0
- package/lib/Runtimes.d.ts.map +1 -1
- package/lib/Runtimes.js +1 -0
- package/lib/Runtimes.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/types.d.ts +3 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
//#region src/BrowserAuthenticationError.d.ts
|
|
3
3
|
declare const BrowserAuthenticationError_base: Schema.Class<BrowserAuthenticationError, Schema.TaggedStruct<"BrowserAuthenticationError", {
|
|
4
|
-
|
|
4
|
+
/** `PopupBlocked`: the browser refused to open the sign-in popup; a redirect can still work. */
|
|
5
|
+
readonly reason: Schema.Literals<readonly ["Cancelled", "Configuration", "Platform", "PopupBlocked"]>;
|
|
5
6
|
readonly message: Schema.String;
|
|
6
7
|
readonly cause: Schema.optional<Schema.Defect>;
|
|
7
8
|
}>, import("effect/Cause").YieldableError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserAuthenticationError.d.ts","names":[],"sources":["../src/BrowserAuthenticationError.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BrowserAuthenticationError.d.ts","names":[],"sources":["../src/BrowserAuthenticationError.ts"],"mappings":";;;;;;;;qBAEa,mCAAmC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
//#region src/BrowserAuthenticationError.ts
|
|
3
3
|
var BrowserAuthenticationError = class extends Schema.TaggedError()("BrowserAuthenticationError", {
|
|
4
|
+
/** `PopupBlocked`: the browser refused to open the sign-in popup; a redirect can still work. */
|
|
4
5
|
reason: Schema.Literals([
|
|
5
6
|
"Cancelled",
|
|
6
7
|
"Configuration",
|
|
7
|
-
"Platform"
|
|
8
|
+
"Platform",
|
|
9
|
+
"PopupBlocked"
|
|
8
10
|
]),
|
|
9
11
|
message: Schema.String,
|
|
10
12
|
cause: Schema.optional(Schema.Defect())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserAuthenticationError.js","names":[],"sources":["../src/BrowserAuthenticationError.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class BrowserAuthenticationError extends Schema.TaggedError<BrowserAuthenticationError>()(\n \"BrowserAuthenticationError\",\n {\n reason: Schema.Literals([\"Cancelled\", \"Configuration\", \"Platform\"]),\n message: Schema.String,\n cause: Schema.optional(Schema.Defect()),\n }\n) {}\n"],"mappings":";;AAEA,IAAa,6BAAb,cAAgD,OAAO,YAAwC,CAAC,CAC5F,8BACA
|
|
1
|
+
{"version":3,"file":"BrowserAuthenticationError.js","names":[],"sources":["../src/BrowserAuthenticationError.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class BrowserAuthenticationError extends Schema.TaggedError<BrowserAuthenticationError>()(\n \"BrowserAuthenticationError\",\n {\n /** `PopupBlocked`: the browser refused to open the sign-in popup; a redirect can still work. */\n reason: Schema.Literals([\"Cancelled\", \"Configuration\", \"Platform\", \"PopupBlocked\"]),\n message: Schema.String,\n cause: Schema.optional(Schema.Defect()),\n }\n) {}\n"],"mappings":";;AAEA,IAAa,6BAAb,cAAgD,OAAO,YAAwC,CAAC,CAC5F,8BACA;;CAEI,QAAQ,OAAO,SAAS;EAAC;EAAa;EAAiB;EAAY;CAAc,CAAC;CAClF,SAAS,OAAO;CAChB,OAAO,OAAO,SAAS,OAAO,OAAO,CAAC;AAC1C,CACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Effect, Schema, Stream } from "effect";
|
|
2
|
+
//#region src/Geolocation.d.ts
|
|
3
|
+
declare const GeolocationError_base: Schema.Class<GeolocationError, Schema.TaggedStruct<"GeolocationError", {
|
|
4
|
+
readonly reason: Schema.Literals<readonly ["PermissionDenied", "PositionUnavailable", "Timeout"]>;
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
readonly cause: Schema.optional<Schema.Defect>;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
/** Why a position could not be read, matching the web Geolocation API's codes:
|
|
9
|
+
* `PermissionDenied` (the user or the platform refused location access),
|
|
10
|
+
* `PositionUnavailable` (no fix, e.g. Location Services are off) and `Timeout`. */
|
|
11
|
+
export declare class GeolocationError extends GeolocationError_base {}
|
|
12
|
+
/** A position fix. Structurally compatible with the web `GeolocationPosition`. */
|
|
13
|
+
export interface GeolocationPosition {
|
|
14
|
+
readonly coords: {
|
|
15
|
+
readonly latitude: number;
|
|
16
|
+
readonly longitude: number;
|
|
17
|
+
/** Meters, at 95% confidence. */
|
|
18
|
+
readonly accuracy: number;
|
|
19
|
+
readonly altitude: number | null;
|
|
20
|
+
readonly altitudeAccuracy: number | null;
|
|
21
|
+
readonly heading: number | null;
|
|
22
|
+
readonly speed: number | null;
|
|
23
|
+
};
|
|
24
|
+
/** Milliseconds since the epoch when the fix was taken. */
|
|
25
|
+
readonly timestamp: number;
|
|
26
|
+
}
|
|
27
|
+
/** The web `PositionOptions`, honored where the platform supports them. */
|
|
28
|
+
export interface GeolocationOptions {
|
|
29
|
+
readonly enableHighAccuracy?: boolean;
|
|
30
|
+
/** Milliseconds to wait for a fix before failing with `Timeout`. */
|
|
31
|
+
readonly timeout?: number;
|
|
32
|
+
/** Accept a cached fix at most this many milliseconds old. */
|
|
33
|
+
readonly maximumAge?: number;
|
|
34
|
+
}
|
|
35
|
+
/** Device location, provided by a platform runtime that supports it. */
|
|
36
|
+
export interface Geolocation {
|
|
37
|
+
readonly getCurrentPosition: (options?: GeolocationOptions) => Effect.Effect<GeolocationPosition, GeolocationError>;
|
|
38
|
+
/** Positions as they change, starting with the current one. */
|
|
39
|
+
readonly watchPosition: (options?: GeolocationOptions) => Stream.Stream<GeolocationPosition, GeolocationError>;
|
|
40
|
+
}
|
|
41
|
+
/** The web API's numeric error codes, for code that bridges to `navigator.geolocation`. */
|
|
42
|
+
export declare const geolocationErrorCode: (reason: GeolocationError["reason"]) => 1 | 2 | 3;
|
|
43
|
+
//#endregion
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=Geolocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Geolocation.d.ts","names":[],"sources":["../src/Geolocation.ts"],"mappings":";;;;;;;;;;qBAMa,yBAAyB;;iBAOrB;WACJ;aACI;aACA;;aAEA;aACA;aACA;aACA;aACA;;;WAGJ;;;iBAII;WACJ;;WAEA;;WAEA;;;iBAII;WACJ,qBACL,UAAU,uBACT,OAAO,OAAO,qBAAqB;;WAE/B,gBACL,UAAU,uBACT,OAAO,OAAO,qBAAqB;;;qBAI/B,uBAAoB,QAAY"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
//#region src/Geolocation.ts
|
|
3
|
+
/** Why a position could not be read, matching the web Geolocation API's codes:
|
|
4
|
+
* `PermissionDenied` (the user or the platform refused location access),
|
|
5
|
+
* `PositionUnavailable` (no fix, e.g. Location Services are off) and `Timeout`. */
|
|
6
|
+
var GeolocationError = class extends Schema.TaggedError()("GeolocationError", {
|
|
7
|
+
reason: Schema.Literals([
|
|
8
|
+
"PermissionDenied",
|
|
9
|
+
"PositionUnavailable",
|
|
10
|
+
"Timeout"
|
|
11
|
+
]),
|
|
12
|
+
message: Schema.String,
|
|
13
|
+
cause: Schema.optional(Schema.Defect())
|
|
14
|
+
}) {};
|
|
15
|
+
/** The web API's numeric error codes, for code that bridges to `navigator.geolocation`. */
|
|
16
|
+
const geolocationErrorCode = (reason) => reason === "PermissionDenied" ? 1 : reason === "PositionUnavailable" ? 2 : 3;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { GeolocationError, geolocationErrorCode };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=Geolocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Geolocation.js","names":[],"sources":["../src/Geolocation.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport type { Effect, Stream } from \"effect\";\n\n/** Why a position could not be read, matching the web Geolocation API's codes:\n * `PermissionDenied` (the user or the platform refused location access),\n * `PositionUnavailable` (no fix, e.g. Location Services are off) and `Timeout`. */\nexport class GeolocationError extends Schema.TaggedError<GeolocationError>()(\"GeolocationError\", {\n reason: Schema.Literals([\"PermissionDenied\", \"PositionUnavailable\", \"Timeout\"]),\n message: Schema.String,\n cause: Schema.optional(Schema.Defect()),\n}) {}\n\n/** A position fix. Structurally compatible with the web `GeolocationPosition`. */\nexport interface GeolocationPosition {\n readonly coords: {\n readonly latitude: number;\n readonly longitude: number;\n /** Meters, at 95% confidence. */\n readonly accuracy: number;\n readonly altitude: number | null;\n readonly altitudeAccuracy: number | null;\n readonly heading: number | null;\n readonly speed: number | null;\n };\n /** Milliseconds since the epoch when the fix was taken. */\n readonly timestamp: number;\n}\n\n/** The web `PositionOptions`, honored where the platform supports them. */\nexport interface GeolocationOptions {\n readonly enableHighAccuracy?: boolean;\n /** Milliseconds to wait for a fix before failing with `Timeout`. */\n readonly timeout?: number;\n /** Accept a cached fix at most this many milliseconds old. */\n readonly maximumAge?: number;\n}\n\n/** Device location, provided by a platform runtime that supports it. */\nexport interface Geolocation {\n readonly getCurrentPosition: (\n options?: GeolocationOptions\n ) => Effect.Effect<GeolocationPosition, GeolocationError>;\n /** Positions as they change, starting with the current one. */\n readonly watchPosition: (\n options?: GeolocationOptions\n ) => Stream.Stream<GeolocationPosition, GeolocationError>;\n}\n\n/** The web API's numeric error codes, for code that bridges to `navigator.geolocation`. */\nexport const geolocationErrorCode = (reason: GeolocationError[\"reason\"]): 1 | 2 | 3 =>\n reason === \"PermissionDenied\" ? 1 : reason === \"PositionUnavailable\" ? 2 : 3;\n"],"mappings":";;;;;AAMA,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAAC,oBAAoB;CAC7F,QAAQ,OAAO,SAAS;EAAC;EAAoB;EAAuB;CAAS,CAAC;CAC9E,SAAS,OAAO;CAChB,OAAO,OAAO,SAAS,OAAO,OAAO,CAAC;AAC1C,CAAC,CAAC,CAAC,CAAC;;AAuCJ,MAAa,wBAAwB,WACjC,WAAW,qBAAqB,IAAI,WAAW,wBAAwB,IAAI"}
|
package/lib/Runtime.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Geolocation } from "./Geolocation.js";
|
|
1
2
|
import { RuntimePartition } from "./RuntimePartition.js";
|
|
2
3
|
import { ResourceCapacity } from "./capacity.js";
|
|
3
4
|
import { BrowserAuthentication, NetworkConnectivity, RuntimeOptions } from "./types.js";
|
|
@@ -18,6 +19,8 @@ export interface RuntimeService {
|
|
|
18
19
|
readonly owner: string;
|
|
19
20
|
readonly namespace: string;
|
|
20
21
|
readonly browserAuthentication?: BrowserAuthentication;
|
|
22
|
+
/** Device location; absent where the platform has none (for example Node). */
|
|
23
|
+
readonly geolocation?: Geolocation;
|
|
21
24
|
readonly destroy: Effect.Effect<void, RuntimeError>;
|
|
22
25
|
readonly tables: TablesService;
|
|
23
26
|
readonly encryptionKeyring?: EncryptionKeyringService;
|
package/lib/Runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.d.ts","names":[],"sources":["../src/Runtime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Runtime.d.ts","names":[],"sources":["../src/Runtime.ts"],"mappings":";;;;;;;;;;;;;qBAUa,qBAAqB;;iBAKjB;WACJ,WAAW;;WAEX;WACA;WACA,wBAAwB;;WAExB,cAAc;WACd,SAAS,OAAO,aAAa;WAC7B,QAAQ;WACR,oBAAoB;WACpB,cAAc;WACd,OAAO;;;qBAEP,gBAAgB;;kBAET,OAAI,SAAA,mBAAA,OAAA,OAAA,uBAAA"}
|
package/lib/Runtime.js
CHANGED
|
@@ -14,6 +14,7 @@ var Runtime = class Runtime extends Context.Service()("@party-stack/runtime/Runt
|
|
|
14
14
|
...partition,
|
|
15
15
|
capacity: adapter.capacity,
|
|
16
16
|
browserAuthentication: adapter.browserAuthentication,
|
|
17
|
+
geolocation: adapter.geolocation,
|
|
17
18
|
destroy: adapter.destroy ?? Effect.void,
|
|
18
19
|
tables: adapter.tables,
|
|
19
20
|
encryptionKeyring: adapter.encryptionKeyring,
|
package/lib/Runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtime.js","names":[],"sources":["../src/Runtime.ts"],"sourcesContent":["import { Context, Effect, Schema } from \"effect\";\nimport { alwaysOnlineConnectivity } from \"./NetworkConnectivity.js\";\nimport { RuntimePartition } from \"./RuntimePartition.js\";\nimport type { ResourceCapacity } from \"./capacity.js\";\nimport type { RuntimeOptions, BrowserAuthentication, NetworkConnectivity } from \"./types.js\";\nimport type { BlobBytesService } from \"@party-stack/ontology-storage/blobs\";\nimport type { EncryptionKeyringService } from \"@party-stack/ontology-storage/encrypted\";\nimport type { TablesService } from \"@party-stack/ontology-storage/tables\";\n\nexport class RuntimeError extends Schema.TaggedError<RuntimeError>()(\"RuntimeError\", {\n operation: Schema.String,\n cause: Schema.Defect(),\n}) {}\n/** Acquired platform capabilities and application-boundary bridges, owned by an Effect Scope. */\nexport interface RuntimeService {\n readonly capacity?: ResourceCapacity;\n /** Context-derived partition key; identity selection uses Connect's userId separately. */\n readonly owner: string;\n readonly namespace: string;\n readonly browserAuthentication?: BrowserAuthentication;\n readonly destroy: Effect.Effect<void, RuntimeError>;\n readonly tables: TablesService;\n readonly encryptionKeyring?: EncryptionKeyringService;\n readonly connectivity: NetworkConnectivity;\n readonly bytes: BlobBytesService;\n}\nexport class Runtime extends Context.Service<Runtime, RuntimeService>()(\"@party-stack/runtime/Runtime\") {\n /** Construct the runtime in the caller's Scope; platform Layers own their resources. */\n static readonly make = Effect.fnUntraced(function* (adapter: RuntimeOptions) {\n const partition = yield* RuntimePartition;\n\n const service = Runtime.of({\n ...partition,\n capacity: adapter.capacity,\n browserAuthentication: adapter.browserAuthentication,\n destroy: adapter.destroy ?? Effect.void,\n tables: adapter.tables,\n encryptionKeyring: adapter.encryptionKeyring,\n connectivity: adapter.connectivity ?? alwaysOnlineConnectivity,\n bytes: adapter.blobBytes,\n });\n return service;\n });\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"Runtime.js","names":[],"sources":["../src/Runtime.ts"],"sourcesContent":["import { Context, Effect, Schema } from \"effect\";\nimport { alwaysOnlineConnectivity } from \"./NetworkConnectivity.js\";\nimport { RuntimePartition } from \"./RuntimePartition.js\";\nimport type { ResourceCapacity } from \"./capacity.js\";\nimport type { Geolocation } from \"./Geolocation.js\";\nimport type { RuntimeOptions, BrowserAuthentication, NetworkConnectivity } from \"./types.js\";\nimport type { BlobBytesService } from \"@party-stack/ontology-storage/blobs\";\nimport type { EncryptionKeyringService } from \"@party-stack/ontology-storage/encrypted\";\nimport type { TablesService } from \"@party-stack/ontology-storage/tables\";\n\nexport class RuntimeError extends Schema.TaggedError<RuntimeError>()(\"RuntimeError\", {\n operation: Schema.String,\n cause: Schema.Defect(),\n}) {}\n/** Acquired platform capabilities and application-boundary bridges, owned by an Effect Scope. */\nexport interface RuntimeService {\n readonly capacity?: ResourceCapacity;\n /** Context-derived partition key; identity selection uses Connect's userId separately. */\n readonly owner: string;\n readonly namespace: string;\n readonly browserAuthentication?: BrowserAuthentication;\n /** Device location; absent where the platform has none (for example Node). */\n readonly geolocation?: Geolocation;\n readonly destroy: Effect.Effect<void, RuntimeError>;\n readonly tables: TablesService;\n readonly encryptionKeyring?: EncryptionKeyringService;\n readonly connectivity: NetworkConnectivity;\n readonly bytes: BlobBytesService;\n}\nexport class Runtime extends Context.Service<Runtime, RuntimeService>()(\"@party-stack/runtime/Runtime\") {\n /** Construct the runtime in the caller's Scope; platform Layers own their resources. */\n static readonly make = Effect.fnUntraced(function* (adapter: RuntimeOptions) {\n const partition = yield* RuntimePartition;\n\n const service = Runtime.of({\n ...partition,\n capacity: adapter.capacity,\n browserAuthentication: adapter.browserAuthentication,\n geolocation: adapter.geolocation,\n destroy: adapter.destroy ?? Effect.void,\n tables: adapter.tables,\n encryptionKeyring: adapter.encryptionKeyring,\n connectivity: adapter.connectivity ?? alwaysOnlineConnectivity,\n bytes: adapter.blobBytes,\n });\n return service;\n });\n}\n"],"mappings":";;;;AAUA,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACjF,WAAW,OAAO;CAClB,OAAO,OAAO,OAAO;AACzB,CAAC,CAAC,CAAC,CAAC;AAgBJ,IAAa,UAAb,MAAa,gBAAgB,QAAQ,QAAiC,CAAC,CAAC,8BAA8B,CAAC,CAAC;;CAEpG,OAAgB,OAAO,OAAO,WAAW,WAAW,SAAyB;EACzE,MAAM,YAAY,OAAO;EAazB,OAXgB,QAAQ,GAAG;GACvB,GAAG;GACH,UAAU,QAAQ;GAClB,uBAAuB,QAAQ;GAC/B,aAAa,QAAQ;GACrB,SAAS,QAAQ,WAAW,OAAO;GACnC,QAAQ,QAAQ;GAChB,mBAAmB,QAAQ;GAC3B,cAAc,QAAQ,gBAAgB;GACtC,OAAO,QAAQ;EACnB,CACa;CACjB,CAAC;AACL"}
|
package/lib/Runtimes.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Geolocation } from "./Geolocation.js";
|
|
1
2
|
import { RuntimePartition } from "./RuntimePartition.js";
|
|
2
3
|
import { BrowserAuthentication, RuntimeAcquisitionError } from "./types.js";
|
|
3
4
|
import { Runtime, RuntimeService } from "./Runtime.js";
|
|
@@ -9,12 +10,14 @@ export type RuntimeLayer = Layer.Layer<Runtime, RuntimeAcquisitionError, Runtime
|
|
|
9
10
|
export type RuntimesLayer = Layer.Layer<Runtimes, RuntimeAcquisitionError>;
|
|
10
11
|
declare const Runtimes_base: Context.ServiceClass<Runtimes, "@party-stack/runtime/Runtimes", {
|
|
11
12
|
readonly browserAuthentication?: BrowserAuthentication;
|
|
13
|
+
readonly geolocation?: Geolocation;
|
|
12
14
|
readonly acquire: (partition: RuntimePartition["Service"]) => Effect.Effect<RuntimeService, RuntimeAcquisitionError, Scope.Scope>;
|
|
13
15
|
}>;
|
|
14
16
|
/** Scoped partition acquisition for installations that open multiple ontologies. */
|
|
15
17
|
export declare class Runtimes extends Runtimes_base {
|
|
16
18
|
static readonly layer: (platform: RuntimeLayer, options?: {
|
|
17
19
|
readonly browserAuthentication?: BrowserAuthentication;
|
|
20
|
+
readonly geolocation?: Geolocation;
|
|
18
21
|
}) => Layer.Layer<Runtimes, never, never>;
|
|
19
22
|
}
|
|
20
23
|
//#endregion
|
package/lib/Runtimes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtimes.d.ts","names":[],"sources":["../src/Runtimes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Runtimes.d.ts","names":[],"sources":["../src/Runtimes.ts"],"mappings":";;;;;;;YAUY,eAAe,MAAM,MAAM,SAAS,yBAAyB;;YAE7D,gBAAgB,MAAM,MAAM,UAAU;;WAMT,wBAAA;WACV,cAAA;WACL,UACd,WAAW,gCACV,OAAO,OAAO,gBAAgB,yBAAyB,MAAM;;;qBAP7D,iBAAiB;kBAUV,QAAK,UACP,cAAY;aAET,wBAAwB;aACxB,cAAc;QAC1B,MAAA,MAAA"}
|
package/lib/Runtimes.js
CHANGED
|
@@ -11,6 +11,7 @@ var Runtimes = class Runtimes extends Context.Service()("@party-stack/runtime/Ru
|
|
|
11
11
|
const partitions = yield* LayerMap.make((key) => Layer.fresh(platform).pipe(Layer.provide(Layer.succeed(RuntimePartition)(decode(key)))));
|
|
12
12
|
return Runtimes.of({
|
|
13
13
|
browserAuthentication: options.browserAuthentication,
|
|
14
|
+
geolocation: options.geolocation,
|
|
14
15
|
acquire: Effect.fnUntraced(function* (partition) {
|
|
15
16
|
const context = yield* partitions.contextEffect(encode(partition));
|
|
16
17
|
return Context.get(context, Runtime);
|
package/lib/Runtimes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Runtimes.js","names":[],"sources":["../src/Runtimes.ts"],"sourcesContent":["import { Context, Effect, Layer, LayerMap, Schema } from \"effect\";\nimport { Runtime } from \"./Runtime.js\";\nimport { RuntimePartition, RuntimePartitionSchema } from \"./RuntimePartition.js\";\nimport type { RuntimeService } from \"./Runtime.js\";\nimport type { RuntimeAcquisitionError } from \"./types.js\";\nimport type { BrowserAuthentication } from \"./types.js\";\nimport type { Scope } from \"effect\";\n\n/** Platform configuration supplies a Layer; partition identity is an Effect requirement. */\nexport type RuntimeLayer = Layer.Layer<Runtime, RuntimeAcquisitionError, RuntimePartition>;\n/** Platform capabilities plus lazy partition acquisition; creating this Layer opens no storage. */\nexport type RuntimesLayer = Layer.Layer<Runtimes, RuntimeAcquisitionError>;\n\n/** Scoped partition acquisition for installations that open multiple ontologies. */\nexport class Runtimes extends Context.Service<\n Runtimes,\n {\n readonly browserAuthentication?: BrowserAuthentication;\n readonly acquire: (\n partition: RuntimePartition[\"Service\"]\n ) => Effect.Effect<RuntimeService, RuntimeAcquisitionError, Scope.Scope>;\n }\n>()(\"@party-stack/runtime/Runtimes\") {\n static readonly layer = (\n platform: RuntimeLayer,\n options: {
|
|
1
|
+
{"version":3,"file":"Runtimes.js","names":[],"sources":["../src/Runtimes.ts"],"sourcesContent":["import { Context, Effect, Layer, LayerMap, Schema } from \"effect\";\nimport { Runtime } from \"./Runtime.js\";\nimport { RuntimePartition, RuntimePartitionSchema } from \"./RuntimePartition.js\";\nimport type { Geolocation } from \"./Geolocation.js\";\nimport type { RuntimeService } from \"./Runtime.js\";\nimport type { RuntimeAcquisitionError } from \"./types.js\";\nimport type { BrowserAuthentication } from \"./types.js\";\nimport type { Scope } from \"effect\";\n\n/** Platform configuration supplies a Layer; partition identity is an Effect requirement. */\nexport type RuntimeLayer = Layer.Layer<Runtime, RuntimeAcquisitionError, RuntimePartition>;\n/** Platform capabilities plus lazy partition acquisition; creating this Layer opens no storage. */\nexport type RuntimesLayer = Layer.Layer<Runtimes, RuntimeAcquisitionError>;\n\n/** Scoped partition acquisition for installations that open multiple ontologies. */\nexport class Runtimes extends Context.Service<\n Runtimes,\n {\n readonly browserAuthentication?: BrowserAuthentication;\n readonly geolocation?: Geolocation;\n readonly acquire: (\n partition: RuntimePartition[\"Service\"]\n ) => Effect.Effect<RuntimeService, RuntimeAcquisitionError, Scope.Scope>;\n }\n>()(\"@party-stack/runtime/Runtimes\") {\n static readonly layer = (\n platform: RuntimeLayer,\n options: {\n readonly browserAuthentication?: BrowserAuthentication;\n readonly geolocation?: Geolocation;\n } = {}\n ) =>\n Layer.effect(\n Runtimes,\n Effect.gen(function* () {\n const codec = Schema.fromJsonString(RuntimePartitionSchema);\n const encode = Schema.encodeSync(codec);\n const decode = Schema.decodeUnknownSync(codec);\n const partitions = yield* LayerMap.make((key: string) =>\n Layer.fresh(platform).pipe(Layer.provide(Layer.succeed(RuntimePartition)(decode(key))))\n );\n return Runtimes.of({\n browserAuthentication: options.browserAuthentication,\n geolocation: options.geolocation,\n acquire: Effect.fnUntraced(function* (partition) {\n const context = yield* partitions.contextEffect(encode(partition));\n return Context.get(context, Runtime);\n }),\n });\n })\n );\n}\n"],"mappings":";;;;;AAeA,IAAa,WAAb,MAAa,iBAAiB,QAAQ,QASpC,CAAC,CAAC,+BAA+B,CAAC,CAAC;CACjC,OAAgB,SACZ,UACA,UAGI,CAAC,MAEL,MAAM,OACF,UACA,OAAO,IAAI,aAAa;EACpB,MAAM,QAAQ,OAAO,eAAe,sBAAsB;EAC1D,MAAM,SAAS,OAAO,WAAW,KAAK;EACtC,MAAM,SAAS,OAAO,kBAAkB,KAAK;EAC7C,MAAM,aAAa,OAAO,SAAS,MAAM,QACrC,MAAM,MAAM,QAAQ,CAAC,CAAC,KAAK,MAAM,QAAQ,MAAM,QAAQ,gBAAgB,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAC1F;EACA,OAAO,SAAS,GAAG;GACf,uBAAuB,QAAQ;GAC/B,aAAa,QAAQ;GACrB,SAAS,OAAO,WAAW,WAAW,WAAW;IAC7C,MAAM,UAAU,OAAO,WAAW,cAAc,OAAO,SAAS,CAAC;IACjE,OAAO,QAAQ,IAAI,SAAS,OAAO;GACvC,CAAC;EACL,CAAC;CACL,CAAC,CACL;AACR"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BrowserAuthenticationError } from "./BrowserAuthenticationError.js";
|
|
2
|
+
import { Geolocation, GeolocationError, GeolocationOptions, GeolocationPosition, geolocationErrorCode } from "./Geolocation.js";
|
|
2
3
|
import { RuntimePartition } from "./RuntimePartition.js";
|
|
3
4
|
import { CapacityEstimate, ResourceCapacity, cloudflareCapacity } from "./capacity.js";
|
|
4
5
|
import { BrowserAuthentication, BrowserAuthenticationPresentation, BrowserAuthenticationSession, NetworkConnectivity, RuntimeAcquisitionError, RuntimeOptions } from "./types.js";
|
|
@@ -9,4 +10,4 @@ import { RuntimeLayer, Runtimes, RuntimesLayer } from "./Runtimes.js";
|
|
|
9
10
|
import { KeyMaterialCodec, KeyMaterialStore, makeKeyMaterialStoreKeyring, makeMemoryEncryptionKeyring } from "./encryptionKeys.js";
|
|
10
11
|
import { MemoryBlobBytesStore } from "./memory/MemoryBlobBytesStore.js";
|
|
11
12
|
import { BlobBytesService, ByteInput, ByteSource, byteChunks, byteIO, byteSource, collectByteBlob, readableByteSource } from "@party-stack/ontology-storage/blobs";
|
|
12
|
-
export { type BlobBytesService, type BrowserAuthentication, BrowserAuthenticationError, type BrowserAuthenticationPresentation, type BrowserAuthenticationSession, type ByteInput, type ByteSource, type CapacityEstimate, type KeyMaterialCodec, type KeyMaterialStore, MemoryBlobBytesStore, MemoryRuntime_d_exports as MemoryRuntime, type NetworkConnectivity, type ResourceCapacity, Runtime, type RuntimeAcquisitionError, RuntimeError, type RuntimeLayer, type RuntimeOptions, RuntimePartition, RuntimeService, Runtimes, type RuntimesLayer, alwaysOnlineConnectivity, byteChunks, byteIO, byteSource, cloudflareCapacity, collectByteBlob, makeKeyMaterialStoreKeyring, makeMemoryEncryptionKeyring, makeNetworkConnectivity, readableByteSource };
|
|
13
|
+
export { type BlobBytesService, type BrowserAuthentication, BrowserAuthenticationError, type BrowserAuthenticationPresentation, type BrowserAuthenticationSession, type ByteInput, type ByteSource, type CapacityEstimate, type Geolocation, GeolocationError, type GeolocationOptions, type GeolocationPosition, type KeyMaterialCodec, type KeyMaterialStore, MemoryBlobBytesStore, MemoryRuntime_d_exports as MemoryRuntime, type NetworkConnectivity, type ResourceCapacity, Runtime, type RuntimeAcquisitionError, RuntimeError, type RuntimeLayer, type RuntimeOptions, RuntimePartition, RuntimeService, Runtimes, type RuntimesLayer, alwaysOnlineConnectivity, byteChunks, byteIO, byteSource, cloudflareCapacity, collectByteBlob, geolocationErrorCode, makeKeyMaterialStoreKeyring, makeMemoryEncryptionKeyring, makeNetworkConnectivity, readableByteSource };
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BrowserAuthenticationError } from "./BrowserAuthenticationError.js";
|
|
2
|
+
import { GeolocationError, geolocationErrorCode } from "./Geolocation.js";
|
|
2
3
|
import { makeKeyMaterialStoreKeyring, makeMemoryEncryptionKeyring } from "./encryptionKeys.js";
|
|
3
4
|
import { MemoryBlobBytesStore } from "./memory/MemoryBlobBytesStore.js";
|
|
4
5
|
import { alwaysOnlineConnectivity, makeNetworkConnectivity } from "./NetworkConnectivity.js";
|
|
@@ -8,4 +9,4 @@ import { MemoryRuntime_exports } from "./MemoryRuntime.js";
|
|
|
8
9
|
import { Runtimes } from "./Runtimes.js";
|
|
9
10
|
import { cloudflareCapacity } from "./capacity.js";
|
|
10
11
|
import { byteChunks, byteIO, byteSource, collectByteBlob, readableByteSource } from "@party-stack/ontology-storage/blobs";
|
|
11
|
-
export { BrowserAuthenticationError, MemoryBlobBytesStore, MemoryRuntime_exports as MemoryRuntime, Runtime, RuntimeError, RuntimePartition, Runtimes, alwaysOnlineConnectivity, byteChunks, byteIO, byteSource, cloudflareCapacity, collectByteBlob, makeKeyMaterialStoreKeyring, makeMemoryEncryptionKeyring, makeNetworkConnectivity, readableByteSource };
|
|
12
|
+
export { BrowserAuthenticationError, GeolocationError, MemoryBlobBytesStore, MemoryRuntime_exports as MemoryRuntime, Runtime, RuntimeError, RuntimePartition, Runtimes, alwaysOnlineConnectivity, byteChunks, byteIO, byteSource, cloudflareCapacity, collectByteBlob, geolocationErrorCode, makeKeyMaterialStoreKeyring, makeMemoryEncryptionKeyring, makeNetworkConnectivity, readableByteSource };
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BrowserAuthenticationError } from "./BrowserAuthenticationError.js";
|
|
2
|
+
import { Geolocation } from "./Geolocation.js";
|
|
2
3
|
import { ResourceCapacity } from "./capacity.js";
|
|
3
4
|
import { RuntimeError } from "./Runtime.js";
|
|
4
5
|
import { Effect, Scope, Stream } from "effect";
|
|
@@ -30,6 +31,8 @@ export interface RuntimeOptions {
|
|
|
30
31
|
blobBytes: BlobBytesService;
|
|
31
32
|
connectivity?: NetworkConnectivity;
|
|
32
33
|
browserAuthentication?: BrowserAuthentication;
|
|
34
|
+
/** Device location, where the platform provides it. */
|
|
35
|
+
geolocation?: Geolocation;
|
|
33
36
|
encryptionKeyring?: EncryptionKeyringService;
|
|
34
37
|
/** Acquired by the platform layer in its scope, including explicit memory tables. */
|
|
35
38
|
tables: TablesService;
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;iBAUiB;WACJ,QAAQ,OAAO;;WAEf,SAAS,OAAO;;YAGjB;iBAEK;EACb,KAAK,2BAA2B,OAAO;IAAS;KAAuB;;iBAG1D;EACb,MAAM;IACF;IACA,eAAe;MACf,OAAO,OAAO,8BAA8B,4BAA4B,MAAM;;;iBAIrE;WACJ,WAAW;EACpB,WAAW;EACX,eAAe;EACf,wBAAwB;;EAExB,cAAc;EACd,oBAAoB;;EAEpB,QAAQ;EACR,UAAU,OAAO,aAAa;;YAGtB,0BAA0B,eAAe,uBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@party-stack/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib"
|
|
6
6
|
],
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"effect": "^4.0.5",
|
|
24
|
-
"@party-stack/ontology-storage": "0.2.
|
|
24
|
+
"@party-stack/ontology-storage": "0.2.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"temporal-polyfill": "^0.3.0",
|