@voidhash/mimic 0.0.1 → 0.0.3
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/.turbo/turbo-build.log +257 -42
- package/dist/Document.cjs +152 -0
- package/dist/Document.d.cts +67 -0
- package/dist/Document.d.cts.map +1 -0
- package/dist/Document.d.mts +68 -0
- package/dist/Document.d.mts.map +1 -0
- package/dist/Document.mjs +147 -0
- package/dist/Document.mjs.map +1 -0
- package/dist/EffectSchema.cjs +180 -0
- package/dist/EffectSchema.d.cts +84 -0
- package/dist/EffectSchema.d.cts.map +1 -0
- package/dist/EffectSchema.d.mts +84 -0
- package/dist/EffectSchema.d.mts.map +1 -0
- package/dist/EffectSchema.mjs +176 -0
- package/dist/EffectSchema.mjs.map +1 -0
- package/dist/FractionalIndex.cjs +365 -0
- package/dist/FractionalIndex.mjs +364 -0
- package/dist/FractionalIndex.mjs.map +1 -0
- package/dist/Operation.cjs +53 -0
- package/dist/Operation.d.cts +39 -0
- package/dist/Operation.d.cts.map +1 -0
- package/dist/Operation.d.mts +39 -0
- package/dist/Operation.d.mts.map +1 -0
- package/dist/Operation.mjs +46 -0
- package/dist/Operation.mjs.map +1 -0
- package/dist/OperationDefinition.cjs +13 -0
- package/dist/OperationDefinition.d.cts +12 -0
- package/dist/OperationDefinition.d.cts.map +1 -0
- package/dist/OperationDefinition.d.mts +12 -0
- package/dist/OperationDefinition.d.mts.map +1 -0
- package/dist/OperationDefinition.mjs +13 -0
- package/dist/OperationDefinition.mjs.map +1 -0
- package/dist/OperationPath.cjs +148 -0
- package/dist/OperationPath.d.cts +60 -0
- package/dist/OperationPath.d.cts.map +1 -0
- package/dist/OperationPath.d.mts +60 -0
- package/dist/OperationPath.d.mts.map +1 -0
- package/dist/OperationPath.mjs +138 -0
- package/dist/OperationPath.mjs.map +1 -0
- package/dist/{Presence-gWrmGBeu.cjs → Presence.cjs} +4 -39
- package/dist/{Presence-N8u7Eppr.d.mts → Presence.d.cts} +2 -2
- package/dist/Presence.d.cts.map +1 -0
- package/dist/{Presence-DKKP4v5X.d.cts → Presence.d.mts} +2 -2
- package/dist/Presence.d.mts.map +1 -0
- package/dist/{Presence-DdMVKcOv.mjs → Presence.mjs} +3 -28
- package/dist/Presence.mjs.map +1 -0
- package/dist/Primitive.cjs +52 -0
- package/dist/Primitive.d.cts +20 -0
- package/dist/Primitive.d.cts.map +1 -0
- package/dist/Primitive.d.mts +20 -0
- package/dist/Primitive.d.mts.map +1 -0
- package/dist/Primitive.mjs +48 -0
- package/dist/Primitive.mjs.map +1 -0
- package/dist/ProxyEnvironment.cjs +34 -0
- package/dist/ProxyEnvironment.d.cts +31 -0
- package/dist/ProxyEnvironment.d.cts.map +1 -0
- package/dist/ProxyEnvironment.d.mts +31 -0
- package/dist/ProxyEnvironment.d.mts.map +1 -0
- package/dist/ProxyEnvironment.mjs +29 -0
- package/dist/ProxyEnvironment.mjs.map +1 -0
- package/dist/Transaction.cjs +66 -0
- package/dist/Transaction.d.cts +56 -0
- package/dist/Transaction.d.cts.map +1 -0
- package/dist/Transaction.d.mts +56 -0
- package/dist/Transaction.d.mts.map +1 -0
- package/dist/Transaction.mjs +58 -0
- package/dist/Transaction.mjs.map +1 -0
- package/dist/Transform.cjs +11 -0
- package/dist/Transform.d.cts +21 -0
- package/dist/Transform.d.cts.map +1 -0
- package/dist/Transform.d.mts +21 -0
- package/dist/Transform.d.mts.map +1 -0
- package/dist/Transform.mjs +6 -0
- package/dist/Transform.mjs.map +1 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs +18 -0
- package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
- package/dist/_virtual/rolldown_runtime.cjs +43 -0
- package/dist/{chunk-CLMFDpHK.mjs → _virtual/rolldown_runtime.mjs} +1 -1
- package/dist/client/ClientDocument.cjs +590 -0
- package/dist/client/ClientDocument.d.cts +161 -0
- package/dist/client/ClientDocument.d.cts.map +1 -0
- package/dist/client/ClientDocument.d.mts +162 -0
- package/dist/client/ClientDocument.d.mts.map +1 -0
- package/dist/client/ClientDocument.mjs +586 -0
- package/dist/client/ClientDocument.mjs.map +1 -0
- package/dist/client/Rebase.cjs +204 -0
- package/dist/client/Rebase.d.cts +87 -0
- package/dist/client/Rebase.d.cts.map +1 -0
- package/dist/client/Rebase.d.mts +88 -0
- package/dist/client/Rebase.d.mts.map +1 -0
- package/dist/client/Rebase.mjs +198 -0
- package/dist/client/Rebase.mjs.map +1 -0
- package/dist/client/StateMonitor.cjs +133 -0
- package/dist/client/StateMonitor.d.cts +122 -0
- package/dist/client/StateMonitor.d.cts.map +1 -0
- package/dist/client/StateMonitor.d.mts +122 -0
- package/dist/client/StateMonitor.d.mts.map +1 -0
- package/dist/client/StateMonitor.mjs +129 -0
- package/dist/client/StateMonitor.mjs.map +1 -0
- package/dist/client/Transport.cjs +11 -0
- package/dist/client/Transport.d.cts +237 -0
- package/dist/client/Transport.d.cts.map +1 -0
- package/dist/client/Transport.d.mts +237 -0
- package/dist/client/Transport.d.mts.map +1 -0
- package/dist/client/Transport.mjs +6 -0
- package/dist/client/Transport.mjs.map +1 -0
- package/dist/client/WebSocketTransport.cjs +396 -0
- package/dist/client/WebSocketTransport.d.cts +29 -0
- package/dist/client/WebSocketTransport.d.cts.map +1 -0
- package/dist/client/WebSocketTransport.d.mts +29 -0
- package/dist/client/WebSocketTransport.d.mts.map +1 -0
- package/dist/client/WebSocketTransport.mjs +392 -0
- package/dist/client/WebSocketTransport.mjs.map +1 -0
- package/dist/client/errors.cjs +135 -0
- package/dist/client/errors.d.cts +87 -0
- package/dist/client/errors.d.cts.map +1 -0
- package/dist/client/errors.d.mts +87 -0
- package/dist/client/errors.d.mts.map +1 -0
- package/dist/client/errors.mjs +127 -0
- package/dist/client/errors.mjs.map +1 -0
- package/dist/client/index.cjs +22 -1424
- package/dist/client/index.d.cts +8 -692
- package/dist/client/index.d.mts +8 -692
- package/dist/client/index.mjs +9 -1413
- package/dist/index.cjs +30 -2529
- package/dist/index.d.cts +12 -143
- package/dist/index.d.mts +12 -143
- package/dist/index.mjs +13 -2526
- package/dist/primitives/Array.cjs +302 -0
- package/dist/primitives/Array.d.cts +95 -0
- package/dist/primitives/Array.d.cts.map +1 -0
- package/dist/primitives/Array.d.mts +95 -0
- package/dist/primitives/Array.d.mts.map +1 -0
- package/dist/primitives/Array.mjs +301 -0
- package/dist/primitives/Array.mjs.map +1 -0
- package/dist/primitives/Boolean.cjs +95 -0
- package/dist/primitives/Boolean.d.cts +44 -0
- package/dist/primitives/Boolean.d.cts.map +1 -0
- package/dist/primitives/Boolean.d.mts +44 -0
- package/dist/primitives/Boolean.d.mts.map +1 -0
- package/dist/primitives/Boolean.mjs +94 -0
- package/dist/primitives/Boolean.mjs.map +1 -0
- package/dist/primitives/Either.cjs +200 -0
- package/dist/primitives/Either.d.cts +113 -0
- package/dist/primitives/Either.d.cts.map +1 -0
- package/dist/primitives/Either.d.mts +113 -0
- package/dist/primitives/Either.d.mts.map +1 -0
- package/dist/primitives/Either.mjs +199 -0
- package/dist/primitives/Either.mjs.map +1 -0
- package/dist/primitives/Lazy.cjs +46 -0
- package/dist/primitives/Lazy.d.cts +46 -0
- package/dist/primitives/Lazy.d.cts.map +1 -0
- package/dist/primitives/Lazy.d.mts +46 -0
- package/dist/primitives/Lazy.d.mts.map +1 -0
- package/dist/primitives/Lazy.mjs +46 -0
- package/dist/primitives/Lazy.mjs.map +1 -0
- package/dist/primitives/Literal.cjs +91 -0
- package/dist/primitives/Literal.d.cts +46 -0
- package/dist/primitives/Literal.d.cts.map +1 -0
- package/dist/primitives/Literal.d.mts +46 -0
- package/dist/primitives/Literal.d.mts.map +1 -0
- package/dist/primitives/Literal.mjs +90 -0
- package/dist/primitives/Literal.mjs.map +1 -0
- package/dist/primitives/Number.cjs +115 -0
- package/dist/primitives/Number.d.cts +54 -0
- package/dist/primitives/Number.d.cts.map +1 -0
- package/dist/primitives/Number.d.mts +54 -0
- package/dist/primitives/Number.d.mts.map +1 -0
- package/dist/primitives/Number.mjs +114 -0
- package/dist/primitives/Number.mjs.map +1 -0
- package/dist/primitives/String.cjs +127 -0
- package/dist/primitives/String.d.cts +56 -0
- package/dist/primitives/String.d.cts.map +1 -0
- package/dist/primitives/String.d.mts +56 -0
- package/dist/primitives/String.d.mts.map +1 -0
- package/dist/primitives/String.mjs +126 -0
- package/dist/primitives/String.mjs.map +1 -0
- package/dist/primitives/Struct.cjs +207 -0
- package/dist/primitives/Struct.d.cts +96 -0
- package/dist/primitives/Struct.d.cts.map +1 -0
- package/dist/primitives/Struct.d.mts +97 -0
- package/dist/primitives/Struct.d.mts.map +1 -0
- package/dist/primitives/Struct.mjs +206 -0
- package/dist/primitives/Struct.mjs.map +1 -0
- package/dist/primitives/Tree.cjs +575 -0
- package/dist/primitives/Tree.d.cts +185 -0
- package/dist/primitives/Tree.d.cts.map +1 -0
- package/dist/primitives/Tree.d.mts +185 -0
- package/dist/primitives/Tree.d.mts.map +1 -0
- package/dist/primitives/Tree.mjs +574 -0
- package/dist/primitives/Tree.mjs.map +1 -0
- package/dist/primitives/TreeNode.cjs +73 -0
- package/dist/primitives/TreeNode.d.cts +92 -0
- package/dist/primitives/TreeNode.d.cts.map +1 -0
- package/dist/primitives/TreeNode.d.mts +93 -0
- package/dist/primitives/TreeNode.d.mts.map +1 -0
- package/dist/primitives/TreeNode.mjs +72 -0
- package/dist/primitives/TreeNode.mjs.map +1 -0
- package/dist/primitives/Union.cjs +170 -0
- package/dist/primitives/Union.d.cts +81 -0
- package/dist/primitives/Union.d.cts.map +1 -0
- package/dist/primitives/Union.d.mts +81 -0
- package/dist/primitives/Union.d.mts.map +1 -0
- package/dist/primitives/Union.mjs +169 -0
- package/dist/primitives/Union.mjs.map +1 -0
- package/dist/primitives/shared.cjs +60 -0
- package/dist/primitives/shared.d.cts +147 -0
- package/dist/primitives/shared.d.cts.map +1 -0
- package/dist/primitives/shared.d.mts +147 -0
- package/dist/primitives/shared.d.mts.map +1 -0
- package/dist/primitives/shared.mjs +58 -0
- package/dist/primitives/shared.mjs.map +1 -0
- package/dist/server/ServerDocument.cjs +110 -0
- package/dist/server/ServerDocument.d.cts +98 -0
- package/dist/server/ServerDocument.d.cts.map +1 -0
- package/dist/server/ServerDocument.d.mts +99 -0
- package/dist/server/ServerDocument.d.mts.map +1 -0
- package/dist/server/ServerDocument.mjs +106 -0
- package/dist/server/ServerDocument.mjs.map +1 -0
- package/dist/server/errors.cjs +85 -0
- package/dist/server/errors.d.cts +53 -0
- package/dist/server/errors.d.cts.map +1 -0
- package/dist/server/errors.d.mts +53 -0
- package/dist/server/errors.d.mts.map +1 -0
- package/dist/server/errors.mjs +81 -0
- package/dist/server/errors.mjs.map +1 -0
- package/dist/server/index.cjs +9 -185
- package/dist/server/index.d.cts +3 -148
- package/dist/server/index.d.mts +3 -148
- package/dist/server/index.mjs +3 -181
- package/dist/types/index.cjs +16 -0
- package/dist/types/index.d.cts +16 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +16 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +12 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/utils/tree-helpers.cjs +443 -0
- package/dist/utils/tree-helpers.d.cts +280 -0
- package/dist/utils/tree-helpers.d.cts.map +1 -0
- package/dist/utils/tree-helpers.d.mts +280 -0
- package/dist/utils/tree-helpers.d.mts.map +1 -0
- package/dist/utils/tree-helpers.mjs +439 -0
- package/dist/utils/tree-helpers.mjs.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/primitives/shared.ts +7 -1
- package/src/types/index.ts +137 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/tree-helpers.ts +648 -0
- package/tsdown.config.ts +1 -1
- package/dist/Document-ChuFrTk1.cjs +0 -571
- package/dist/Document-CwiAFTIq.mjs +0 -438
- package/dist/Document-CwiAFTIq.mjs.map +0 -1
- package/dist/Presence-DKKP4v5X.d.cts.map +0 -1
- package/dist/Presence-DdMVKcOv.mjs.map +0 -1
- package/dist/Presence-N8u7Eppr.d.mts.map +0 -1
- package/dist/Primitive-CvFVxR8_.d.cts +0 -1175
- package/dist/Primitive-CvFVxR8_.d.cts.map +0 -1
- package/dist/Primitive-lEhQyGVL.d.mts +0 -1175
- package/dist/Primitive-lEhQyGVL.d.mts.map +0 -1
- package/dist/client/index.d.cts.map +0 -1
- package/dist/client/index.d.mts.map +0 -1
- package/dist/client/index.mjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/server/index.d.cts.map +0 -1
- package/dist/server/index.d.mts.map +0 -1
- package/dist/server/index.mjs.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __export } from "./_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { decode as decode$1, encode as encode$1 } from "./OperationPath.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/Operation.ts
|
|
5
|
+
var Operation_exports = /* @__PURE__ */ __export({
|
|
6
|
+
decode: () => decode,
|
|
7
|
+
encode: () => encode,
|
|
8
|
+
fromDefinition: () => fromDefinition
|
|
9
|
+
});
|
|
10
|
+
const fromDefinition = (operationPath, definition, payload) => {
|
|
11
|
+
return {
|
|
12
|
+
kind: definition.kind,
|
|
13
|
+
path: operationPath,
|
|
14
|
+
payload
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Encodes an Operation to a JSON-serializable format for network transport.
|
|
19
|
+
* @param operation - The operation to encode.
|
|
20
|
+
* @returns The encoded representation.
|
|
21
|
+
*/
|
|
22
|
+
const encode = (operation) => {
|
|
23
|
+
return {
|
|
24
|
+
kind: operation.kind,
|
|
25
|
+
path: encode$1(operation.path),
|
|
26
|
+
payload: operation.payload
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Decodes an encoded operation back to an Operation.
|
|
31
|
+
* Note: This returns a partial operation without the definition methods.
|
|
32
|
+
* The caller must have the operation definitions to fully reconstruct if needed.
|
|
33
|
+
* @param encoded - The encoded representation.
|
|
34
|
+
* @returns The decoded Operation (without definition-specific methods).
|
|
35
|
+
*/
|
|
36
|
+
const decode = (encoded) => {
|
|
37
|
+
return {
|
|
38
|
+
kind: encoded.kind,
|
|
39
|
+
path: decode$1(encoded.path),
|
|
40
|
+
payload: encoded.payload
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Operation_exports, decode, encode, fromDefinition };
|
|
46
|
+
//# sourceMappingURL=Operation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation.mjs","names":["OperationPath.encode","OperationPath.decode"],"sources":["../src/Operation.ts"],"sourcesContent":["\nimport * as OperationPath from \"./OperationPath\"\nimport * as OperationDefinition from \"./OperationDefinition\"\nimport { Schema } from \"effect\";\n\n\nexport type Operation<TKind, TPayload extends Schema.Schema.Any, TDef extends OperationDefinition.OperationDefinition<TKind, TPayload, any>> = {\n readonly kind: TKind\n readonly path: OperationPath.OperationPath\n readonly payload: Schema.Schema.Type<TPayload>,\n\n} & TDef\n\nexport const fromDefinition = <TKind, TPayload extends Schema.Schema.Any, TDef extends OperationDefinition.OperationDefinition<TKind, TPayload, any>>(operationPath: OperationPath.OperationPath, definition: TDef, payload: Schema.Schema.Type<TPayload>): Operation<TKind, TPayload, TDef> => {\n return {\n kind: definition.kind,\n path: operationPath,\n payload: payload,\n } as Operation<TKind, TPayload, TDef>\n}\n\n/**\n * Encoded representation of an Operation for network transport.\n */\nexport interface EncodedOperation {\n readonly kind: unknown\n readonly path: OperationPath.EncodedOperationPath\n readonly payload: unknown\n}\n\n/**\n * Encodes an Operation to a JSON-serializable format for network transport.\n * @param operation - The operation to encode.\n * @returns The encoded representation.\n */\nexport const encode = <TKind, TPayload extends Schema.Schema.Any, TDef extends OperationDefinition.OperationDefinition<TKind, TPayload, any>>(\n operation: Operation<TKind, TPayload, TDef>\n): EncodedOperation => {\n return {\n kind: operation.kind,\n path: OperationPath.encode(operation.path),\n payload: operation.payload,\n }\n}\n\n/**\n * Decodes an encoded operation back to an Operation.\n * Note: This returns a partial operation without the definition methods.\n * The caller must have the operation definitions to fully reconstruct if needed.\n * @param encoded - The encoded representation.\n * @returns The decoded Operation (without definition-specific methods).\n */\nexport const decode = (encoded: EncodedOperation): Operation<unknown, Schema.Schema.Any, any> => {\n return {\n kind: encoded.kind,\n path: OperationPath.decode(encoded.path),\n payload: encoded.payload,\n } as Operation<unknown, Schema.Schema.Any, any>\n}"],"mappings":";;;;;;;;;AAaA,MAAa,kBAAyI,eAA4C,YAAkB,YAA4E;AAC5R,QAAO;EACH,MAAM,WAAW;EACjB,MAAM;EACG;EACZ;;;;;;;AAiBL,MAAa,UACT,cACmB;AACnB,QAAO;EACH,MAAM,UAAU;EAChB,MAAMA,SAAqB,UAAU,KAAK;EAC1C,SAAS,UAAU;EACtB;;;;;;;;;AAUL,MAAa,UAAU,YAA0E;AAC7F,QAAO;EACH,MAAM,QAAQ;EACd,MAAMC,SAAqB,QAAQ,KAAK;EACxC,SAAS,QAAQ;EACpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/OperationDefinition.d.ts
|
|
4
|
+
|
|
5
|
+
interface OperationDefinition<TKind, TPayload extends Schema.Schema.Any, TTarget extends Schema.Schema.Any> {
|
|
6
|
+
readonly kind: TKind;
|
|
7
|
+
readonly payload: TPayload;
|
|
8
|
+
readonly target: TTarget;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { OperationDefinition };
|
|
12
|
+
//# sourceMappingURL=OperationDefinition.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationDefinition.d.cts","names":[],"sources":["../src/OperationDefinition.ts"],"sourcesContent":[],"mappings":";;;;AAI6D,UAA5C,mBAA0D,CAAA,KAAA,EAAA,iBAAd,MAAA,CAAO,MAAA,CAAO,GAAA,EAAA,gBAAqB,MAAA,CAAO,MAAA,CAAO,GAAnC,CAAA,CAAA;EAAqB,SAAO,IAAO,EAC3F,KAD2F;EAC3F,SAAA,OAAA,EACG,QADH;EACG,SAAA,MAAA,EACD,OADC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
//#region src/OperationDefinition.d.ts
|
|
4
|
+
|
|
5
|
+
interface OperationDefinition<TKind, TPayload extends Schema.Schema.Any, TTarget extends Schema.Schema.Any> {
|
|
6
|
+
readonly kind: TKind;
|
|
7
|
+
readonly payload: TPayload;
|
|
8
|
+
readonly target: TTarget;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { OperationDefinition };
|
|
12
|
+
//# sourceMappingURL=OperationDefinition.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationDefinition.d.mts","names":[],"sources":["../src/OperationDefinition.ts"],"sourcesContent":[],"mappings":";;;;AAI6D,UAA5C,mBAA0D,CAAA,KAAA,EAAA,iBAAd,MAAA,CAAO,MAAA,CAAO,GAAA,EAAA,gBAAqB,MAAA,CAAO,MAAA,CAAO,GAAnC,CAAA,CAAA;EAAqB,SAAO,IAAO,EAC3F,KAD2F;EAC3F,SAAA,OAAA,EACG,QADH;EACG,SAAA,MAAA,EACD,OADC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/OperationDefinition.ts
|
|
2
|
+
const make = (options) => {
|
|
3
|
+
return {
|
|
4
|
+
kind: options.kind,
|
|
5
|
+
payload: options.payload,
|
|
6
|
+
target: options.target,
|
|
7
|
+
apply: options.apply
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
export { make };
|
|
13
|
+
//# sourceMappingURL=OperationDefinition.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationDefinition.mjs","names":[],"sources":["../src/OperationDefinition.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\ntype Mutable<T> = T extends ReadonlyArray<infer U> ? Array<U> : { -readonly [K in keyof T]: T[K] };\n\nexport interface OperationDefinition<TKind, TPayload extends Schema.Schema.Any, TTarget extends Schema.Schema.Any> {\n readonly kind: TKind\n readonly payload: TPayload\n readonly target: TTarget\n}\n\nexport const make = <TKind, TPayload extends Schema.Schema.Any, TTarget extends Schema.Schema.Any>(options: {\n readonly kind: TKind\n readonly payload: TPayload\n readonly target: TTarget\n readonly apply: (payload: Schema.Schema.Type<TPayload>, target: Mutable<Schema.Schema.Type<TTarget>>) => void\n}) => {\n return {\n kind: options.kind,\n payload: options.payload,\n target: options.target,\n apply: options.apply\n } as const;\n}"],"mappings":";AAUA,MAAa,QAAsF,YAK7F;AACF,QAAO;EACH,MAAM,QAAQ;EACd,SAAS,QAAQ;EACjB,QAAQ,QAAQ;EAChB,OAAO,QAAQ;EAClB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/OperationPath.ts
|
|
4
|
+
var OperationPath_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
5
|
+
decode: () => decode,
|
|
6
|
+
encode: () => encode,
|
|
7
|
+
fromTokens: () => fromTokens,
|
|
8
|
+
getRelativePath: () => getRelativePath,
|
|
9
|
+
isPrefix: () => isPrefix,
|
|
10
|
+
make: () => make,
|
|
11
|
+
pathsEqual: () => pathsEqual,
|
|
12
|
+
pathsOverlap: () => pathsOverlap
|
|
13
|
+
});
|
|
14
|
+
const parseStringPath = (stringPath) => {
|
|
15
|
+
return stringPath.split("/");
|
|
16
|
+
};
|
|
17
|
+
const makeStringPathFromTokens = (tokens) => {
|
|
18
|
+
return tokens.join("/");
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new operation path.
|
|
22
|
+
* @param stringPath - The string path to create the path from.
|
|
23
|
+
* @returns The new operation path.
|
|
24
|
+
*/
|
|
25
|
+
function make(stringPath) {
|
|
26
|
+
const tokensInternal = stringPath ? parseStringPath(stringPath) : [];
|
|
27
|
+
/**
|
|
28
|
+
* Returns the tokens of the path.
|
|
29
|
+
* @returns The tokens of the path.
|
|
30
|
+
*/
|
|
31
|
+
const toTokens = () => {
|
|
32
|
+
return tokensInternal;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Concatenates two paths.
|
|
36
|
+
* @param other - The other path to concatenate.
|
|
37
|
+
* @returns The new path.
|
|
38
|
+
*/
|
|
39
|
+
const concat = (other) => {
|
|
40
|
+
return make(makeStringPathFromTokens(toTokens().concat(other.toTokens())));
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Appends a token to the path.
|
|
44
|
+
* @param token - The token to append.
|
|
45
|
+
* @returns The new path.
|
|
46
|
+
*/
|
|
47
|
+
const append = (token) => {
|
|
48
|
+
return make(makeStringPathFromTokens(toTokens().concat([token])));
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Removes the last token from the path.
|
|
52
|
+
* @returns The new path.
|
|
53
|
+
*/
|
|
54
|
+
const pop = () => {
|
|
55
|
+
return make(makeStringPathFromTokens(toTokens().slice(0, -1)));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Removes the first token from the path.
|
|
59
|
+
* @returns The new path.
|
|
60
|
+
*/
|
|
61
|
+
const shift = () => {
|
|
62
|
+
return make(makeStringPathFromTokens(toTokens().slice(1)));
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
_tag: "OperationPath",
|
|
66
|
+
toTokens,
|
|
67
|
+
concat,
|
|
68
|
+
append,
|
|
69
|
+
pop,
|
|
70
|
+
shift
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a new operation path from tokens.
|
|
75
|
+
* @param tokens - The tokens to create the path from.
|
|
76
|
+
* @returns The new operation path.
|
|
77
|
+
*/
|
|
78
|
+
function fromTokens(tokens) {
|
|
79
|
+
return make(makeStringPathFromTokens(tokens));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Checks if two operation paths overlap (one is prefix of the other or equal).
|
|
83
|
+
*/
|
|
84
|
+
const pathsOverlap = (pathA, pathB) => {
|
|
85
|
+
const tokensA = pathA.toTokens().filter((t) => t !== "");
|
|
86
|
+
const tokensB = pathB.toTokens().filter((t) => t !== "");
|
|
87
|
+
const minLength = Math.min(tokensA.length, tokensB.length);
|
|
88
|
+
for (let i = 0; i < minLength; i++) if (tokensA[i] !== tokensB[i]) return false;
|
|
89
|
+
return true;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Checks if pathA is a prefix of pathB (pathA is ancestor of pathB).
|
|
93
|
+
*/
|
|
94
|
+
const isPrefix = (pathA, pathB) => {
|
|
95
|
+
const tokensA = pathA.toTokens().filter((t) => t !== "");
|
|
96
|
+
const tokensB = pathB.toTokens().filter((t) => t !== "");
|
|
97
|
+
if (tokensA.length > tokensB.length) return false;
|
|
98
|
+
for (let i = 0; i < tokensA.length; i++) if (tokensA[i] !== tokensB[i]) return false;
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Checks if two paths are exactly equal.
|
|
103
|
+
*/
|
|
104
|
+
const pathsEqual = (pathA, pathB) => {
|
|
105
|
+
const tokensA = pathA.toTokens().filter((t) => t !== "");
|
|
106
|
+
const tokensB = pathB.toTokens().filter((t) => t !== "");
|
|
107
|
+
if (tokensA.length !== tokensB.length) return false;
|
|
108
|
+
for (let i = 0; i < tokensA.length; i++) if (tokensA[i] !== tokensB[i]) return false;
|
|
109
|
+
return true;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Gets the relative path of pathB with respect to pathA.
|
|
113
|
+
* Assumes pathA is a prefix of pathB.
|
|
114
|
+
*/
|
|
115
|
+
const getRelativePath = (basePath, fullPath) => {
|
|
116
|
+
const baseTokens = basePath.toTokens().filter((t) => t !== "");
|
|
117
|
+
return fullPath.toTokens().filter((t) => t !== "").slice(baseTokens.length);
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Encodes an OperationPath to a string for network transport.
|
|
121
|
+
* @param path - The operation path to encode.
|
|
122
|
+
* @returns The encoded string representation.
|
|
123
|
+
*/
|
|
124
|
+
const encode = (path) => {
|
|
125
|
+
return makeStringPathFromTokens(path.toTokens());
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Decodes an encoded string back to an OperationPath.
|
|
129
|
+
* @param encoded - The encoded string representation.
|
|
130
|
+
* @returns The decoded OperationPath.
|
|
131
|
+
*/
|
|
132
|
+
const decode = (encoded) => {
|
|
133
|
+
return make(encoded);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
Object.defineProperty(exports, 'OperationPath_exports', {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: function () {
|
|
140
|
+
return OperationPath_exports;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
exports.decode = decode;
|
|
144
|
+
exports.encode = encode;
|
|
145
|
+
exports.isPrefix = isPrefix;
|
|
146
|
+
exports.make = make;
|
|
147
|
+
exports.pathsEqual = pathsEqual;
|
|
148
|
+
exports.pathsOverlap = pathsOverlap;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
declare namespace OperationPath_d_exports {
|
|
2
|
+
export { EncodedOperationPath, OperationPath, OperationPathToken, decode, encode, fromTokens, getRelativePath, isPrefix, make, pathsEqual, pathsOverlap };
|
|
3
|
+
}
|
|
4
|
+
type OperationPathToken = string;
|
|
5
|
+
interface OperationPath {
|
|
6
|
+
readonly _tag: "OperationPath";
|
|
7
|
+
readonly toTokens: () => ReadonlyArray<OperationPathToken>;
|
|
8
|
+
readonly concat: (other: OperationPath) => OperationPath;
|
|
9
|
+
readonly append: (token: OperationPathToken) => OperationPath;
|
|
10
|
+
readonly pop: () => OperationPath;
|
|
11
|
+
readonly shift: () => OperationPath;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new operation path.
|
|
15
|
+
* @param stringPath - The string path to create the path from.
|
|
16
|
+
* @returns The new operation path.
|
|
17
|
+
*/
|
|
18
|
+
declare function make(stringPath?: string): OperationPath;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new operation path from tokens.
|
|
21
|
+
* @param tokens - The tokens to create the path from.
|
|
22
|
+
* @returns The new operation path.
|
|
23
|
+
*/
|
|
24
|
+
declare function fromTokens(tokens: ReadonlyArray<OperationPathToken>): OperationPath;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if two operation paths overlap (one is prefix of the other or equal).
|
|
27
|
+
*/
|
|
28
|
+
declare const pathsOverlap: (pathA: OperationPath, pathB: OperationPath) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if pathA is a prefix of pathB (pathA is ancestor of pathB).
|
|
31
|
+
*/
|
|
32
|
+
declare const isPrefix: (pathA: OperationPath, pathB: OperationPath) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if two paths are exactly equal.
|
|
35
|
+
*/
|
|
36
|
+
declare const pathsEqual: (pathA: OperationPath, pathB: OperationPath) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the relative path of pathB with respect to pathA.
|
|
39
|
+
* Assumes pathA is a prefix of pathB.
|
|
40
|
+
*/
|
|
41
|
+
declare const getRelativePath: (basePath: OperationPath, fullPath: OperationPath) => string[];
|
|
42
|
+
/**
|
|
43
|
+
* Encoded representation of an OperationPath for network transport.
|
|
44
|
+
*/
|
|
45
|
+
type EncodedOperationPath = string;
|
|
46
|
+
/**
|
|
47
|
+
* Encodes an OperationPath to a string for network transport.
|
|
48
|
+
* @param path - The operation path to encode.
|
|
49
|
+
* @returns The encoded string representation.
|
|
50
|
+
*/
|
|
51
|
+
declare const encode: (path: OperationPath) => EncodedOperationPath;
|
|
52
|
+
/**
|
|
53
|
+
* Decodes an encoded string back to an OperationPath.
|
|
54
|
+
* @param encoded - The encoded string representation.
|
|
55
|
+
* @returns The decoded OperationPath.
|
|
56
|
+
*/
|
|
57
|
+
declare const decode: (encoded: EncodedOperationPath) => OperationPath;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { EncodedOperationPath, OperationPath, OperationPath_d_exports };
|
|
60
|
+
//# sourceMappingURL=OperationPath.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationPath.d.cts","names":[],"sources":["../src/OperationPath.ts"],"sourcesContent":[],"mappings":";;;KACY,kBAAA;UAEK,aAAA;;2BAEY,cAAc;2BACd,kBAAkB;2BAClB,uBAAuB;sBAC5B;wBACE;;;;;;;iBAgBV,IAAA,uBAA2B;;AAxB3C;AAEA;;;AAG6B,iBAgFb,UAAA,CAhFa,MAAA,EAgFM,aAhFN,CAgFoB,kBAhFpB,CAAA,CAAA,EAgF0C,aAhF1C;;;;AAEL,cAyFX,YAzFW,EAAA,CAAA,KAAA,EA0Ff,aA1Fe,EAAA,KAAA,EA2Ff,aA3Fe,EAAA,GAAA,OAAA;;;AAiBxB;AA6DgB,cAgCH,QAhCa,EAAA,CAAA,KAAA,EAiCjB,aAjCiB,EAAA,KAAA,EAkCjB,aAlCiB,EAAA,GAAA,OAAA;;;;AAA0D,cAuDvE,UAvDuE,EAAA,CAAA,KAAA,EAwD3E,aAxD2E,EAAA,KAAA,EAyD3E,aAzD2E,EAAA,GAAA,OAAA;AAWpF;AAqBA;AAuBA;AAwBA;AAaY,cAbC,eAamB,EAAA,CAAA,QAAA,EAZpB,aAYoB,EAAA,QAAA,EAXpB,aAWoB,EAAA,GAAA,MAAA,EAAA;AAOhC;AASA;;KAhBY,oBAAA;;;;;;cAOC,eAAgB,kBAAgB;;;;;;cAShC,kBAAmB,yBAAuB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
declare namespace OperationPath_d_exports {
|
|
2
|
+
export { EncodedOperationPath, OperationPath, OperationPathToken, decode, encode, fromTokens, getRelativePath, isPrefix, make, pathsEqual, pathsOverlap };
|
|
3
|
+
}
|
|
4
|
+
type OperationPathToken = string;
|
|
5
|
+
interface OperationPath {
|
|
6
|
+
readonly _tag: "OperationPath";
|
|
7
|
+
readonly toTokens: () => ReadonlyArray<OperationPathToken>;
|
|
8
|
+
readonly concat: (other: OperationPath) => OperationPath;
|
|
9
|
+
readonly append: (token: OperationPathToken) => OperationPath;
|
|
10
|
+
readonly pop: () => OperationPath;
|
|
11
|
+
readonly shift: () => OperationPath;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new operation path.
|
|
15
|
+
* @param stringPath - The string path to create the path from.
|
|
16
|
+
* @returns The new operation path.
|
|
17
|
+
*/
|
|
18
|
+
declare function make(stringPath?: string): OperationPath;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new operation path from tokens.
|
|
21
|
+
* @param tokens - The tokens to create the path from.
|
|
22
|
+
* @returns The new operation path.
|
|
23
|
+
*/
|
|
24
|
+
declare function fromTokens(tokens: ReadonlyArray<OperationPathToken>): OperationPath;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if two operation paths overlap (one is prefix of the other or equal).
|
|
27
|
+
*/
|
|
28
|
+
declare const pathsOverlap: (pathA: OperationPath, pathB: OperationPath) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if pathA is a prefix of pathB (pathA is ancestor of pathB).
|
|
31
|
+
*/
|
|
32
|
+
declare const isPrefix: (pathA: OperationPath, pathB: OperationPath) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if two paths are exactly equal.
|
|
35
|
+
*/
|
|
36
|
+
declare const pathsEqual: (pathA: OperationPath, pathB: OperationPath) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Gets the relative path of pathB with respect to pathA.
|
|
39
|
+
* Assumes pathA is a prefix of pathB.
|
|
40
|
+
*/
|
|
41
|
+
declare const getRelativePath: (basePath: OperationPath, fullPath: OperationPath) => string[];
|
|
42
|
+
/**
|
|
43
|
+
* Encoded representation of an OperationPath for network transport.
|
|
44
|
+
*/
|
|
45
|
+
type EncodedOperationPath = string;
|
|
46
|
+
/**
|
|
47
|
+
* Encodes an OperationPath to a string for network transport.
|
|
48
|
+
* @param path - The operation path to encode.
|
|
49
|
+
* @returns The encoded string representation.
|
|
50
|
+
*/
|
|
51
|
+
declare const encode: (path: OperationPath) => EncodedOperationPath;
|
|
52
|
+
/**
|
|
53
|
+
* Decodes an encoded string back to an OperationPath.
|
|
54
|
+
* @param encoded - The encoded string representation.
|
|
55
|
+
* @returns The decoded OperationPath.
|
|
56
|
+
*/
|
|
57
|
+
declare const decode: (encoded: EncodedOperationPath) => OperationPath;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { EncodedOperationPath, OperationPath, OperationPath_d_exports };
|
|
60
|
+
//# sourceMappingURL=OperationPath.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationPath.d.mts","names":[],"sources":["../src/OperationPath.ts"],"sourcesContent":[],"mappings":";;;KACY,kBAAA;UAEK,aAAA;;2BAEY,cAAc;2BACd,kBAAkB;2BAClB,uBAAuB;sBAC5B;wBACE;;;;;;;iBAgBV,IAAA,uBAA2B;;AAxB3C;AAEA;;;AAG6B,iBAgFb,UAAA,CAhFa,MAAA,EAgFM,aAhFN,CAgFoB,kBAhFpB,CAAA,CAAA,EAgF0C,aAhF1C;;;;AAEL,cAyFX,YAzFW,EAAA,CAAA,KAAA,EA0Ff,aA1Fe,EAAA,KAAA,EA2Ff,aA3Fe,EAAA,GAAA,OAAA;;;AAiBxB;AA6DgB,cAgCH,QAhCa,EAAA,CAAA,KAAA,EAiCjB,aAjCiB,EAAA,KAAA,EAkCjB,aAlCiB,EAAA,GAAA,OAAA;;;;AAA0D,cAuDvE,UAvDuE,EAAA,CAAA,KAAA,EAwD3E,aAxD2E,EAAA,KAAA,EAyD3E,aAzD2E,EAAA,GAAA,OAAA;AAWpF;AAqBA;AAuBA;AAwBA;AAaY,cAbC,eAamB,EAAA,CAAA,QAAA,EAZpB,aAYoB,EAAA,QAAA,EAXpB,aAWoB,EAAA,GAAA,MAAA,EAAA;AAOhC;AASA;;KAhBY,oBAAA;;;;;;cAOC,eAAgB,kBAAgB;;;;;;cAShC,kBAAmB,yBAAuB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { __export } from "./_virtual/rolldown_runtime.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/OperationPath.ts
|
|
4
|
+
var OperationPath_exports = /* @__PURE__ */ __export({
|
|
5
|
+
decode: () => decode,
|
|
6
|
+
encode: () => encode,
|
|
7
|
+
fromTokens: () => fromTokens,
|
|
8
|
+
getRelativePath: () => getRelativePath,
|
|
9
|
+
isPrefix: () => isPrefix,
|
|
10
|
+
make: () => make,
|
|
11
|
+
pathsEqual: () => pathsEqual,
|
|
12
|
+
pathsOverlap: () => pathsOverlap
|
|
13
|
+
});
|
|
14
|
+
const parseStringPath = (stringPath) => {
|
|
15
|
+
return stringPath.split("/");
|
|
16
|
+
};
|
|
17
|
+
const makeStringPathFromTokens = (tokens) => {
|
|
18
|
+
return tokens.join("/");
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new operation path.
|
|
22
|
+
* @param stringPath - The string path to create the path from.
|
|
23
|
+
* @returns The new operation path.
|
|
24
|
+
*/
|
|
25
|
+
function make(stringPath) {
|
|
26
|
+
const tokensInternal = stringPath ? parseStringPath(stringPath) : [];
|
|
27
|
+
/**
|
|
28
|
+
* Returns the tokens of the path.
|
|
29
|
+
* @returns The tokens of the path.
|
|
30
|
+
*/
|
|
31
|
+
const toTokens = () => {
|
|
32
|
+
return tokensInternal;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Concatenates two paths.
|
|
36
|
+
* @param other - The other path to concatenate.
|
|
37
|
+
* @returns The new path.
|
|
38
|
+
*/
|
|
39
|
+
const concat = (other) => {
|
|
40
|
+
return make(makeStringPathFromTokens(toTokens().concat(other.toTokens())));
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Appends a token to the path.
|
|
44
|
+
* @param token - The token to append.
|
|
45
|
+
* @returns The new path.
|
|
46
|
+
*/
|
|
47
|
+
const append = (token) => {
|
|
48
|
+
return make(makeStringPathFromTokens(toTokens().concat([token])));
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Removes the last token from the path.
|
|
52
|
+
* @returns The new path.
|
|
53
|
+
*/
|
|
54
|
+
const pop = () => {
|
|
55
|
+
return make(makeStringPathFromTokens(toTokens().slice(0, -1)));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Removes the first token from the path.
|
|
59
|
+
* @returns The new path.
|
|
60
|
+
*/
|
|
61
|
+
const shift = () => {
|
|
62
|
+
return make(makeStringPathFromTokens(toTokens().slice(1)));
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
_tag: "OperationPath",
|
|
66
|
+
toTokens,
|
|
67
|
+
concat,
|
|
68
|
+
append,
|
|
69
|
+
pop,
|
|
70
|
+
shift
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a new operation path from tokens.
|
|
75
|
+
* @param tokens - The tokens to create the path from.
|
|
76
|
+
* @returns The new operation path.
|
|
77
|
+
*/
|
|
78
|
+
function fromTokens(tokens) {
|
|
79
|
+
return make(makeStringPathFromTokens(tokens));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Checks if two operation paths overlap (one is prefix of the other or equal).
|
|
83
|
+
*/
|
|
84
|
+
const pathsOverlap = (pathA, pathB) => {
|
|
85
|
+
const tokensA = pathA.toTokens().filter((t) => t !== "");
|
|
86
|
+
const tokensB = pathB.toTokens().filter((t) => t !== "");
|
|
87
|
+
const minLength = Math.min(tokensA.length, tokensB.length);
|
|
88
|
+
for (let i = 0; i < minLength; i++) if (tokensA[i] !== tokensB[i]) return false;
|
|
89
|
+
return true;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Checks if pathA is a prefix of pathB (pathA is ancestor of pathB).
|
|
93
|
+
*/
|
|
94
|
+
const isPrefix = (pathA, pathB) => {
|
|
95
|
+
const tokensA = pathA.toTokens().filter((t) => t !== "");
|
|
96
|
+
const tokensB = pathB.toTokens().filter((t) => t !== "");
|
|
97
|
+
if (tokensA.length > tokensB.length) return false;
|
|
98
|
+
for (let i = 0; i < tokensA.length; i++) if (tokensA[i] !== tokensB[i]) return false;
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Checks if two paths are exactly equal.
|
|
103
|
+
*/
|
|
104
|
+
const pathsEqual = (pathA, pathB) => {
|
|
105
|
+
const tokensA = pathA.toTokens().filter((t) => t !== "");
|
|
106
|
+
const tokensB = pathB.toTokens().filter((t) => t !== "");
|
|
107
|
+
if (tokensA.length !== tokensB.length) return false;
|
|
108
|
+
for (let i = 0; i < tokensA.length; i++) if (tokensA[i] !== tokensB[i]) return false;
|
|
109
|
+
return true;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Gets the relative path of pathB with respect to pathA.
|
|
113
|
+
* Assumes pathA is a prefix of pathB.
|
|
114
|
+
*/
|
|
115
|
+
const getRelativePath = (basePath, fullPath) => {
|
|
116
|
+
const baseTokens = basePath.toTokens().filter((t) => t !== "");
|
|
117
|
+
return fullPath.toTokens().filter((t) => t !== "").slice(baseTokens.length);
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Encodes an OperationPath to a string for network transport.
|
|
121
|
+
* @param path - The operation path to encode.
|
|
122
|
+
* @returns The encoded string representation.
|
|
123
|
+
*/
|
|
124
|
+
const encode = (path) => {
|
|
125
|
+
return makeStringPathFromTokens(path.toTokens());
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Decodes an encoded string back to an OperationPath.
|
|
129
|
+
* @param encoded - The encoded string representation.
|
|
130
|
+
* @returns The decoded OperationPath.
|
|
131
|
+
*/
|
|
132
|
+
const decode = (encoded) => {
|
|
133
|
+
return make(encoded);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
export { OperationPath_exports, decode, encode, isPrefix, make, pathsEqual, pathsOverlap };
|
|
138
|
+
//# sourceMappingURL=OperationPath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationPath.mjs","names":["tokensInternal: ReadonlyArray<OperationPathToken>"],"sources":["../src/OperationPath.ts"],"sourcesContent":["// export type OperationPath = string\nexport type OperationPathToken = string\n\nexport interface OperationPath {\n readonly _tag: \"OperationPath\"\n readonly toTokens: () => ReadonlyArray<OperationPathToken>\n readonly concat: (other: OperationPath) => OperationPath\n readonly append: (token: OperationPathToken) => OperationPath\n readonly pop: () => OperationPath\n readonly shift: () => OperationPath\n}\n\nconst parseStringPath = (stringPath: string): ReadonlyArray<OperationPathToken> => {\n return stringPath.split(\"/\")\n}\n\nconst makeStringPathFromTokens = (tokens: ReadonlyArray<OperationPathToken>): string => {\n return tokens.join(\"/\")\n}\n\n/**\n * Creates a new operation path.\n * @param stringPath - The string path to create the path from.\n * @returns The new operation path.\n */\nexport function make(stringPath?: string): OperationPath {\n\n const tokensInternal: ReadonlyArray<OperationPathToken> = stringPath ? parseStringPath(stringPath) : []\n\n /**\n * Returns the tokens of the path.\n * @returns The tokens of the path.\n */\n const toTokens = () => {\n return tokensInternal\n }\n\n /**\n * Concatenates two paths.\n * @param other - The other path to concatenate.\n * @returns The new path.\n */\n const concat = (other: OperationPath): OperationPath => {\n return make(makeStringPathFromTokens(toTokens().concat(other.toTokens())))\n }\n\n /**\n * Appends a token to the path.\n * @param token - The token to append.\n * @returns The new path.\n */\n const append = (token: OperationPathToken): OperationPath => {\n return make(makeStringPathFromTokens(toTokens().concat([token])))\n }\n\n /**\n * Removes the last token from the path.\n * @returns The new path.\n */\n const pop = (): OperationPath => {\n return make(makeStringPathFromTokens(toTokens().slice(0, -1)))\n }\n\n /**\n * Removes the first token from the path.\n * @returns The new path.\n */\n const shift = (): OperationPath => {\n return make(makeStringPathFromTokens(toTokens().slice(1)))\n }\n\n return {\n _tag: \"OperationPath\",\n toTokens,\n concat,\n append,\n pop,\n shift\n } as const\n}\n\n/**\n * Creates a new operation path from tokens.\n * @param tokens - The tokens to create the path from.\n * @returns The new operation path.\n */\nexport function fromTokens(tokens: ReadonlyArray<OperationPathToken>): OperationPath {\n return make(makeStringPathFromTokens(tokens))\n}\n\n// =============================================================================\n// Path Utility Functions\n// =============================================================================\n\n/**\n * Checks if two operation paths overlap (one is prefix of the other or equal).\n */\nexport const pathsOverlap = (\n pathA: OperationPath,\n pathB: OperationPath\n): boolean => {\n const tokensA = pathA.toTokens().filter((t) => t !== \"\");\n const tokensB = pathB.toTokens().filter((t) => t !== \"\");\n\n const minLength = Math.min(tokensA.length, tokensB.length);\n\n for (let i = 0; i < minLength; i++) {\n if (tokensA[i] !== tokensB[i]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Checks if pathA is a prefix of pathB (pathA is ancestor of pathB).\n */\nexport const isPrefix = (\n pathA: OperationPath,\n pathB: OperationPath\n): boolean => {\n const tokensA = pathA.toTokens().filter((t) => t !== \"\");\n const tokensB = pathB.toTokens().filter((t) => t !== \"\");\n\n if (tokensA.length > tokensB.length) {\n return false;\n }\n\n for (let i = 0; i < tokensA.length; i++) {\n if (tokensA[i] !== tokensB[i]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Checks if two paths are exactly equal.\n */\nexport const pathsEqual = (\n pathA: OperationPath,\n pathB: OperationPath\n): boolean => {\n const tokensA = pathA.toTokens().filter((t) => t !== \"\");\n const tokensB = pathB.toTokens().filter((t) => t !== \"\");\n\n if (tokensA.length !== tokensB.length) {\n return false;\n }\n\n for (let i = 0; i < tokensA.length; i++) {\n if (tokensA[i] !== tokensB[i]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Gets the relative path of pathB with respect to pathA.\n * Assumes pathA is a prefix of pathB.\n */\nexport const getRelativePath = (\n basePath: OperationPath,\n fullPath: OperationPath\n): string[] => {\n const baseTokens = basePath.toTokens().filter((t) => t !== \"\");\n const fullTokens = fullPath.toTokens().filter((t) => t !== \"\");\n\n return fullTokens.slice(baseTokens.length);\n};\n\n/**\n * Encoded representation of an OperationPath for network transport.\n */\nexport type EncodedOperationPath = string;\n\n/**\n * Encodes an OperationPath to a string for network transport.\n * @param path - The operation path to encode.\n * @returns The encoded string representation.\n */\nexport const encode = (path: OperationPath): EncodedOperationPath => {\n return makeStringPathFromTokens(path.toTokens());\n};\n\n/**\n * Decodes an encoded string back to an OperationPath.\n * @param encoded - The encoded string representation.\n * @returns The decoded OperationPath.\n */\nexport const decode = (encoded: EncodedOperationPath): OperationPath => {\n return make(encoded);\n};"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,mBAAmB,eAA0D;AAC/E,QAAO,WAAW,MAAM,IAAI;;AAGhC,MAAM,4BAA4B,WAAsD;AACpF,QAAO,OAAO,KAAK,IAAI;;;;;;;AAQ3B,SAAgB,KAAK,YAAoC;CAErD,MAAMA,iBAAoD,aAAa,gBAAgB,WAAW,GAAG,EAAE;;;;;CAMvG,MAAM,iBAAiB;AACnB,SAAO;;;;;;;CAQX,MAAM,UAAU,UAAwC;AACpD,SAAO,KAAK,yBAAyB,UAAU,CAAC,OAAO,MAAM,UAAU,CAAC,CAAC,CAAC;;;;;;;CAQ9E,MAAM,UAAU,UAA6C;AACzD,SAAO,KAAK,yBAAyB,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;;;;;;CAOrE,MAAM,YAA2B;AAC7B,SAAO,KAAK,yBAAyB,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;;;;;;CAOlE,MAAM,cAA6B;AAC/B,SAAO,KAAK,yBAAyB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;;AAG9D,QAAO;EACH,MAAM;EACN;EACA;EACA;EACA;EACA;EACH;;;;;;;AAQL,SAAgB,WAAW,QAA0D;AACjF,QAAO,KAAK,yBAAyB,OAAO,CAAC;;;;;AAUjD,MAAa,gBACX,OACA,UACY;CACZ,MAAM,UAAU,MAAM,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;CACxD,MAAM,UAAU,MAAM,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;CAExD,MAAM,YAAY,KAAK,IAAI,QAAQ,QAAQ,QAAQ,OAAO;AAE1D,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,IAC7B,KAAI,QAAQ,OAAO,QAAQ,GACzB,QAAO;AAIX,QAAO;;;;;AAMT,MAAa,YACX,OACA,UACY;CACZ,MAAM,UAAU,MAAM,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;CACxD,MAAM,UAAU,MAAM,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;AAExD,KAAI,QAAQ,SAAS,QAAQ,OAC3B,QAAO;AAGT,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,IAClC,KAAI,QAAQ,OAAO,QAAQ,GACzB,QAAO;AAIX,QAAO;;;;;AAMT,MAAa,cACX,OACA,UACY;CACZ,MAAM,UAAU,MAAM,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;CACxD,MAAM,UAAU,MAAM,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;AAExD,KAAI,QAAQ,WAAW,QAAQ,OAC7B,QAAO;AAGT,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,IAClC,KAAI,QAAQ,OAAO,QAAQ,GACzB,QAAO;AAIX,QAAO;;;;;;AAOT,MAAa,mBACX,UACA,aACa;CACb,MAAM,aAAa,SAAS,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG;AAG9D,QAFmB,SAAS,UAAU,CAAC,QAAQ,MAAM,MAAM,GAAG,CAE5C,MAAM,WAAW,OAAO;;;;;;;AAa5C,MAAa,UAAU,SAA8C;AACnE,QAAO,yBAAyB,KAAK,UAAU,CAAC;;;;;;;AAQlD,MAAa,UAAU,YAAiD;AACtE,QAAO,KAAK,QAAQ"}
|
|
@@ -1,38 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
2
|
let effect_Schema = require("effect/Schema");
|
|
3
|
-
effect_Schema =
|
|
3
|
+
effect_Schema = require_rolldown_runtime.__toESM(effect_Schema);
|
|
4
4
|
|
|
5
|
-
//#region \0@oxc-project+runtime@0.103.0/helpers/objectSpread2.js
|
|
6
|
-
function ownKeys(e, r) {
|
|
7
|
-
var t = Object.keys(e);
|
|
8
|
-
if (Object.getOwnPropertySymbols) {
|
|
9
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
10
|
-
r && (o = o.filter(function(r$1) {
|
|
11
|
-
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
12
|
-
})), t.push.apply(t, o);
|
|
13
|
-
}
|
|
14
|
-
return t;
|
|
15
|
-
}
|
|
16
|
-
function _objectSpread2(e) {
|
|
17
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
18
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
19
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
20
|
-
require_Document._defineProperty(e, r$1, t[r$1]);
|
|
21
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
22
|
-
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
return e;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
5
|
//#region src/Presence.ts
|
|
30
6
|
/**
|
|
31
7
|
* @since 0.0.1
|
|
32
8
|
* Presence module for ephemeral per-connection state.
|
|
33
9
|
* Used by both client and server for schema validation.
|
|
34
10
|
*/
|
|
35
|
-
var Presence_exports = /* @__PURE__ */
|
|
11
|
+
var Presence_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
|
|
36
12
|
isValid: () => isValid,
|
|
37
13
|
make: () => make,
|
|
38
14
|
validate: () => validate,
|
|
@@ -112,15 +88,4 @@ Object.defineProperty(exports, 'Presence_exports', {
|
|
|
112
88
|
return Presence_exports;
|
|
113
89
|
}
|
|
114
90
|
});
|
|
115
|
-
|
|
116
|
-
enumerable: true,
|
|
117
|
-
get: function () {
|
|
118
|
-
return _objectSpread2;
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
Object.defineProperty(exports, 'validate', {
|
|
122
|
-
enumerable: true,
|
|
123
|
-
get: function () {
|
|
124
|
-
return validate;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
91
|
+
exports.validate = validate;
|
|
@@ -87,5 +87,5 @@ declare const validateSafe: <TData>(presence: Presence<TData>, data: unknown) =>
|
|
|
87
87
|
*/
|
|
88
88
|
declare const isValid: <TData>(presence: Presence<TData>, data: unknown) => data is TData;
|
|
89
89
|
//#endregion
|
|
90
|
-
export {
|
|
91
|
-
//# sourceMappingURL=Presence
|
|
90
|
+
export { AnyPresence, Infer, PresenceEntry, Presence_d_exports };
|
|
91
|
+
//# sourceMappingURL=Presence.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Presence.d.cts","names":[],"sources":["../src/Presence.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAeiB;;;mBAGE,MAAA,CAAO,OAAO;;EAHhB,SAAA,KAAQ,EAKP,KALO;;;;;AAWR,UAAA,eAAe,CAAA,KAAA,CAEC,CAAA;EAMrB;EAKA,SAAA,MAAW,EAXJ,MAAA,CAAO,MAWA,CAXO,KAWC,CAAA;AASlC;AA8BA;;;AAAwE,KA5C5D,KA4C4D,CAAA,UA5C5C,QA4C4C,CAAA,GAAA,CAAA,CAAA,GA5C3B,CA4C2B,CAAA,OAAA,CAAA;;;AAmBxE;AACqB,KA3DT,WAAA,GAAc,QA2DL,CAAA,GAAA,CAAA;;;;AAcR,UAhEI,aAyEhB,CAAA,QAAA,OAAA,CAAA,CAAA;EARoB;EAAT,SAAA,IAAA,EA/DK,KA+DL;EAET;EAAK,SAAA,MAAA,CAAA,EAAA,MAAA;AAeR;;;;;;;;;;;;;;;;;;;;cApDa,uBAAyB,gBAAgB,WAAS,SAAS;;;;;;;;;;cAmB3D,4BACD,SAAS,0BAElB;;;;;;;;;cAYU,gCACD,SAAS,0BAElB;;;;;;;;cAeU,2BACD,SAAS,kCAEV"}
|
|
@@ -87,5 +87,5 @@ declare const validateSafe: <TData>(presence: Presence<TData>, data: unknown) =>
|
|
|
87
87
|
*/
|
|
88
88
|
declare const isValid: <TData>(presence: Presence<TData>, data: unknown) => data is TData;
|
|
89
89
|
//#endregion
|
|
90
|
-
export {
|
|
91
|
-
//# sourceMappingURL=Presence
|
|
90
|
+
export { AnyPresence, Infer, PresenceEntry, Presence_d_exports };
|
|
91
|
+
//# sourceMappingURL=Presence.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Presence.d.mts","names":[],"sources":["../src/Presence.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAeiB;;;mBAGE,MAAA,CAAO,OAAO;;EAHhB,SAAA,KAAQ,EAKP,KALO;;;;;AAWR,UAAA,eAAe,CAAA,KAAA,CAEC,CAAA;EAMrB;EAKA,SAAA,MAAW,EAXJ,MAAA,CAAO,MAWA,CAXO,KAWC,CAAA;AASlC;AA8BA;;;AAAwE,KA5C5D,KA4C4D,CAAA,UA5C5C,QA4C4C,CAAA,GAAA,CAAA,CAAA,GA5C3B,CA4C2B,CAAA,OAAA,CAAA;;;AAmBxE;AACqB,KA3DT,WAAA,GAAc,QA2DL,CAAA,GAAA,CAAA;;;;AAcR,UAhEI,aAyEhB,CAAA,QAAA,OAAA,CAAA,CAAA;EARoB;EAAT,SAAA,IAAA,EA/DK,KA+DL;EAET;EAAK,SAAA,MAAA,CAAA,EAAA,MAAA;AAeR;;;;;;;;;;;;;;;;;;;;cApDa,uBAAyB,gBAAgB,WAAS,SAAS;;;;;;;;;;cAmB3D,4BACD,SAAS,0BAElB;;;;;;;;;cAYU,gCACD,SAAS,0BAElB;;;;;;;;cAeU,2BACD,SAAS,kCAEV"}
|