@voidhash/mimic-sdk 1.0.0-beta.18

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 (94) hide show
  1. package/LICENSE.md +663 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.cjs +14 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs +27 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.cjs +16 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.cjs +11 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
  10. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.cjs +18 -0
  11. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
  12. package/dist/_virtual/rolldown_runtime.cjs +19 -0
  13. package/dist/_virtual/rolldown_runtime.mjs +18 -0
  14. package/dist/effect/CollectionHandle.cjs +93 -0
  15. package/dist/effect/CollectionHandle.d.cts +31 -0
  16. package/dist/effect/CollectionHandle.d.cts.map +1 -0
  17. package/dist/effect/CollectionHandle.d.mts +31 -0
  18. package/dist/effect/CollectionHandle.d.mts.map +1 -0
  19. package/dist/effect/CollectionHandle.mjs +94 -0
  20. package/dist/effect/CollectionHandle.mjs.map +1 -0
  21. package/dist/effect/DatabaseHandle.cjs +61 -0
  22. package/dist/effect/DatabaseHandle.d.cts +25 -0
  23. package/dist/effect/DatabaseHandle.d.cts.map +1 -0
  24. package/dist/effect/DatabaseHandle.d.mts +25 -0
  25. package/dist/effect/DatabaseHandle.d.mts.map +1 -0
  26. package/dist/effect/DatabaseHandle.mjs +62 -0
  27. package/dist/effect/DatabaseHandle.mjs.map +1 -0
  28. package/dist/effect/HttpTransport.cjs +18 -0
  29. package/dist/effect/HttpTransport.d.cts +15 -0
  30. package/dist/effect/HttpTransport.d.cts.map +1 -0
  31. package/dist/effect/HttpTransport.d.mts +15 -0
  32. package/dist/effect/HttpTransport.d.mts.map +1 -0
  33. package/dist/effect/HttpTransport.mjs +19 -0
  34. package/dist/effect/HttpTransport.mjs.map +1 -0
  35. package/dist/effect/MimicSDK.cjs +84 -0
  36. package/dist/effect/MimicSDK.d.cts +40 -0
  37. package/dist/effect/MimicSDK.d.cts.map +1 -0
  38. package/dist/effect/MimicSDK.d.mts +40 -0
  39. package/dist/effect/MimicSDK.d.mts.map +1 -0
  40. package/dist/effect/MimicSDK.mjs +71 -0
  41. package/dist/effect/MimicSDK.mjs.map +1 -0
  42. package/dist/effect/errors.cjs +7 -0
  43. package/dist/effect/errors.d.cts +15 -0
  44. package/dist/effect/errors.d.cts.map +1 -0
  45. package/dist/effect/errors.d.mts +15 -0
  46. package/dist/effect/errors.d.mts.map +1 -0
  47. package/dist/effect/errors.mjs +8 -0
  48. package/dist/effect/errors.mjs.map +1 -0
  49. package/dist/effect/index.cjs +35 -0
  50. package/dist/effect/index.d.cts +8 -0
  51. package/dist/effect/index.d.mts +8 -0
  52. package/dist/effect/index.mjs +8 -0
  53. package/dist/effect/types.d.cts +34 -0
  54. package/dist/effect/types.d.cts.map +1 -0
  55. package/dist/effect/types.d.mts +34 -0
  56. package/dist/effect/types.d.mts.map +1 -0
  57. package/dist/index.cjs +7 -0
  58. package/dist/index.d.cts +6 -0
  59. package/dist/index.d.mts +6 -0
  60. package/dist/index.mjs +5 -0
  61. package/dist/promise/CollectionHandle.cjs +49 -0
  62. package/dist/promise/CollectionHandle.d.cts +32 -0
  63. package/dist/promise/CollectionHandle.d.cts.map +1 -0
  64. package/dist/promise/CollectionHandle.d.mts +32 -0
  65. package/dist/promise/CollectionHandle.d.mts.map +1 -0
  66. package/dist/promise/CollectionHandle.mjs +50 -0
  67. package/dist/promise/CollectionHandle.mjs.map +1 -0
  68. package/dist/promise/DatabaseHandle.cjs +38 -0
  69. package/dist/promise/DatabaseHandle.d.cts +22 -0
  70. package/dist/promise/DatabaseHandle.d.cts.map +1 -0
  71. package/dist/promise/DatabaseHandle.d.mts +22 -0
  72. package/dist/promise/DatabaseHandle.d.mts.map +1 -0
  73. package/dist/promise/DatabaseHandle.mjs +39 -0
  74. package/dist/promise/DatabaseHandle.mjs.map +1 -0
  75. package/dist/promise/MimicSDK.cjs +55 -0
  76. package/dist/promise/MimicSDK.d.cts +40 -0
  77. package/dist/promise/MimicSDK.d.cts.map +1 -0
  78. package/dist/promise/MimicSDK.d.mts +40 -0
  79. package/dist/promise/MimicSDK.d.mts.map +1 -0
  80. package/dist/promise/MimicSDK.mjs +56 -0
  81. package/dist/promise/MimicSDK.mjs.map +1 -0
  82. package/package.json +44 -0
  83. package/src/effect/CollectionHandle.ts +120 -0
  84. package/src/effect/DatabaseHandle.ts +76 -0
  85. package/src/effect/HttpTransport.ts +43 -0
  86. package/src/effect/MimicSDK.ts +118 -0
  87. package/src/effect/errors.ts +7 -0
  88. package/src/effect/index.ts +15 -0
  89. package/src/effect/types.ts +35 -0
  90. package/src/index.ts +12 -0
  91. package/src/promise/CollectionHandle.ts +67 -0
  92. package/src/promise/DatabaseHandle.ts +50 -0
  93. package/src/promise/MimicSDK.ts +69 -0
  94. package/src/promise/index.ts +3 -0
@@ -0,0 +1,62 @@
1
+ import { _defineProperty } from "../_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs";
2
+ import { CollectionHandle } from "./CollectionHandle.mjs";
3
+ import { Effect } from "effect";
4
+ import { RpcClient } from "effect/unstable/rpc";
5
+ import { MimicRpcs } from "@voidhash/mimic-protocol";
6
+ import { SchemaJSON } from "@voidhash/mimic";
7
+
8
+ //#region src/effect/DatabaseHandle.ts
9
+ const makeClient = () => RpcClient.make(MimicRpcs);
10
+ var DatabaseHandle = class {
11
+ constructor(id, name, description) {
12
+ _defineProperty(this, "id", void 0);
13
+ _defineProperty(this, "name", void 0);
14
+ _defineProperty(this, "description", void 0);
15
+ this.id = id;
16
+ this.name = name;
17
+ this.description = description;
18
+ }
19
+ createCollection(name, schema) {
20
+ const databaseId = this.id;
21
+ return Effect.scoped(Effect.gen(function* () {
22
+ const client = yield* makeClient();
23
+ const schemaJson = SchemaJSON.toJSON(schema);
24
+ const result = yield* client.CreateCollection({
25
+ databaseId,
26
+ name,
27
+ schemaJson
28
+ });
29
+ return new CollectionHandle(result.id, result.databaseId, schema);
30
+ }));
31
+ }
32
+ listCollections() {
33
+ const databaseId = this.id;
34
+ return Effect.scoped(Effect.gen(function* () {
35
+ return yield* (yield* makeClient()).ListCollections({ databaseId });
36
+ }));
37
+ }
38
+ deleteCollection(id) {
39
+ return Effect.scoped(Effect.gen(function* () {
40
+ yield* (yield* makeClient()).DeleteCollection({ id });
41
+ }));
42
+ }
43
+ collection(id, schema) {
44
+ return new CollectionHandle(id, this.id, schema);
45
+ }
46
+ updateCollectionSchema(collectionId, schemaJson) {
47
+ return Effect.scoped(Effect.gen(function* () {
48
+ const result = yield* (yield* makeClient()).UpdateCollectionSchema({
49
+ id: collectionId,
50
+ schemaJson
51
+ });
52
+ return {
53
+ id: result.id,
54
+ schemaVersion: result.schemaVersion
55
+ };
56
+ }));
57
+ }
58
+ };
59
+
60
+ //#endregion
61
+ export { DatabaseHandle };
62
+ //# sourceMappingURL=DatabaseHandle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseHandle.mjs","names":[],"sources":["../../src/effect/DatabaseHandle.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { type Primitive, SchemaJSON } from \"@voidhash/mimic\";\nimport { RpcClient } from \"effect/unstable/rpc\";\nimport { MimicRpcs } from \"@voidhash/mimic-protocol\";\nimport { CollectionHandle } from \"./CollectionHandle\";\nimport type { CollectionInfo } from \"./types\";\n\nconst makeClient = () => RpcClient.make(MimicRpcs);\n\nexport class DatabaseHandle {\n readonly id: string;\n readonly name: string;\n readonly description: string;\n\n constructor(id: string, name: string, description: string) {\n this.id = id;\n this.name = name;\n this.description = description;\n }\n\n createCollection<TSchema extends Primitive.AnyPrimitive>(name: string, schema: TSchema) {\n const databaseId = this.id;\n return Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const schemaJson = SchemaJSON.toJSON(schema);\n const result = yield* client.CreateCollection({\n databaseId,\n name,\n schemaJson,\n });\n return new CollectionHandle<TSchema>(result.id, result.databaseId, schema);\n }),\n );\n }\n\n listCollections() {\n const databaseId = this.id;\n return Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.ListCollections({ databaseId });\n return result as unknown as CollectionInfo[];\n }),\n );\n }\n\n deleteCollection(id: string) {\n return Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n yield* client.DeleteCollection({ id });\n }),\n );\n }\n\n collection<TSchema extends Primitive.AnyPrimitive>(\n id: string,\n schema: TSchema,\n ): CollectionHandle<TSchema> {\n return new CollectionHandle<TSchema>(id, this.id, schema);\n }\n\n updateCollectionSchema(collectionId: string, schemaJson: unknown) {\n return Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.UpdateCollectionSchema({\n id: collectionId,\n schemaJson,\n });\n return { id: result.id, schemaVersion: result.schemaVersion };\n }),\n );\n }\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,mBAAmB,UAAU,KAAK,UAAU;AAElD,IAAa,iBAAb,MAA4B;CAK1B,YAAY,IAAY,MAAc,aAAqB;wBAJlD;wBACA;wBACA;AAGP,OAAK,KAAK;AACV,OAAK,OAAO;AACZ,OAAK,cAAc;;CAGrB,iBAAyD,MAAc,QAAiB;EACtF,MAAM,aAAa,KAAK;AACxB,SAAO,OAAO,OACZ,OAAO,IAAI,aAAa;GACtB,MAAM,SAAS,OAAO,YAAY;GAClC,MAAM,aAAa,WAAW,OAAO,OAAO;GAC5C,MAAM,SAAS,OAAO,OAAO,iBAAiB;IAC5C;IACA;IACA;IACD,CAAC;AACF,UAAO,IAAI,iBAA0B,OAAO,IAAI,OAAO,YAAY,OAAO;IAC1E,CACH;;CAGH,kBAAkB;EAChB,MAAM,aAAa,KAAK;AACxB,SAAO,OAAO,OACZ,OAAO,IAAI,aAAa;AAGtB,UADe,QADA,OAAO,YAAY,EACL,gBAAgB,EAAE,YAAY,CAAC;IAE5D,CACH;;CAGH,iBAAiB,IAAY;AAC3B,SAAO,OAAO,OACZ,OAAO,IAAI,aAAa;AAEtB,WADe,OAAO,YAAY,EACpB,iBAAiB,EAAE,IAAI,CAAC;IACtC,CACH;;CAGH,WACE,IACA,QAC2B;AAC3B,SAAO,IAAI,iBAA0B,IAAI,KAAK,IAAI,OAAO;;CAG3D,uBAAuB,cAAsB,YAAqB;AAChE,SAAO,OAAO,OACZ,OAAO,IAAI,aAAa;GAEtB,MAAM,SAAS,QADA,OAAO,YAAY,EACL,uBAAuB;IAClD,IAAI;IACJ;IACD,CAAC;AACF,UAAO;IAAE,IAAI,OAAO;IAAI,eAAe,OAAO;IAAe;IAC7D,CACH"}
@@ -0,0 +1,18 @@
1
+ const require_objectSpread2 = require('../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.cjs');
2
+ let effect = require("effect");
3
+ let effect_unstable_rpc = require("effect/unstable/rpc");
4
+ let effect_unstable_http = require("effect/unstable/http");
5
+ let _voidhash_mimic_protocol = require("@voidhash/mimic-protocol");
6
+
7
+ //#region src/effect/HttpTransport.ts
8
+ const MimicClientLayer = (config) => {
9
+ const baseUrl = config.url.replace(/\/+$/, "");
10
+ const basicAuth = btoa(`${config.username}:${config.password}`);
11
+ const ProtocolLive = effect_unstable_rpc.RpcClient.layerProtocolHttp({ url: `${baseUrl}/rpc` });
12
+ const SerializationLive = effect_unstable_rpc.RpcSerialization.layerNdjson;
13
+ const AuthLive = effect_unstable_rpc.RpcMiddleware.layerClient(_voidhash_mimic_protocol.AuthMiddleware, ({ next, request }) => next(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, request), {}, { headers: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, request.headers), {}, { authorization: `Basic ${basicAuth}` }) })));
14
+ return effect.Layer.mergeAll(ProtocolLive.pipe(effect.Layer.provide(effect_unstable_http.FetchHttpClient.layer), effect.Layer.provide(SerializationLive)), SerializationLive, AuthLive);
15
+ };
16
+
17
+ //#endregion
18
+ exports.MimicClientLayer = MimicClientLayer;
@@ -0,0 +1,15 @@
1
+ import { Layer } from "effect";
2
+ import { RpcClient, RpcMiddleware, RpcSerialization } from "effect/unstable/rpc";
3
+ import { AuthMiddleware } from "@voidhash/mimic-protocol";
4
+
5
+ //#region src/effect/HttpTransport.d.ts
6
+ interface MimicClientConfig {
7
+ readonly url: string;
8
+ readonly username: string;
9
+ readonly password: string;
10
+ readonly timeout?: number;
11
+ }
12
+ declare const MimicClientLayer: (config: MimicClientConfig) => Layer.Layer<RpcClient.Protocol | RpcSerialization.RpcSerialization | RpcMiddleware.ForClient<AuthMiddleware>, never, never>;
13
+ //#endregion
14
+ export { MimicClientConfig, MimicClientLayer };
15
+ //# sourceMappingURL=HttpTransport.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTransport.d.cts","names":[],"sources":["../../src/effect/HttpTransport.ts"],"sourcesContent":[],"mappings":";;;;;UAKiB,iBAAA;;EAAA,SAAA,QAAA,EAAA,MAAiB;EAOrB,SAAA,QAAA,EA8BZ,MAAA;EA9BwC,SAAA,OAAA,CAAA,EAAA,MAAA;;AAAiB,cAA7C,gBAA6C,EAAA,CAAA,MAAA,EAAjB,iBAAiB,EAAA,GAAA,KAAA,CAAA,KAAA,CAAA,SAAA,CAAA,QAAA,GAAA,gBAAA,CAAA,gBAAA,GAAA,aAAA,CAAA,SAAA,CAAA,cAAA,CAAA,EAAA,KAAA,EAAA,KAAA,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Layer } from "effect";
2
+ import { RpcClient, RpcMiddleware, RpcSerialization } from "effect/unstable/rpc";
3
+ import { AuthMiddleware } from "@voidhash/mimic-protocol";
4
+
5
+ //#region src/effect/HttpTransport.d.ts
6
+ interface MimicClientConfig {
7
+ readonly url: string;
8
+ readonly username: string;
9
+ readonly password: string;
10
+ readonly timeout?: number;
11
+ }
12
+ declare const MimicClientLayer: (config: MimicClientConfig) => Layer.Layer<RpcClient.Protocol | RpcSerialization.RpcSerialization | RpcMiddleware.ForClient<AuthMiddleware>, never, never>;
13
+ //#endregion
14
+ export { MimicClientConfig, MimicClientLayer };
15
+ //# sourceMappingURL=HttpTransport.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTransport.d.mts","names":[],"sources":["../../src/effect/HttpTransport.ts"],"sourcesContent":[],"mappings":";;;;;UAKiB,iBAAA;;EAAA,SAAA,QAAA,EAAA,MAAiB;EAOrB,SAAA,QAAA,EA8BZ,MAAA;EA9BwC,SAAA,OAAA,CAAA,EAAA,MAAA;;AAAiB,cAA7C,gBAA6C,EAAA,CAAA,MAAA,EAAjB,iBAAiB,EAAA,GAAA,KAAA,CAAA,KAAA,CAAA,SAAA,CAAA,QAAA,GAAA,gBAAA,CAAA,gBAAA,GAAA,aAAA,CAAA,SAAA,CAAA,cAAA,CAAA,EAAA,KAAA,EAAA,KAAA,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs";
2
+ import { Layer } from "effect";
3
+ import { RpcClient, RpcMiddleware, RpcSerialization } from "effect/unstable/rpc";
4
+ import { FetchHttpClient } from "effect/unstable/http";
5
+ import { AuthMiddleware } from "@voidhash/mimic-protocol";
6
+
7
+ //#region src/effect/HttpTransport.ts
8
+ const MimicClientLayer = (config) => {
9
+ const baseUrl = config.url.replace(/\/+$/, "");
10
+ const basicAuth = btoa(`${config.username}:${config.password}`);
11
+ const ProtocolLive = RpcClient.layerProtocolHttp({ url: `${baseUrl}/rpc` });
12
+ const SerializationLive = RpcSerialization.layerNdjson;
13
+ const AuthLive = RpcMiddleware.layerClient(AuthMiddleware, ({ next, request }) => next(_objectSpread2(_objectSpread2({}, request), {}, { headers: _objectSpread2(_objectSpread2({}, request.headers), {}, { authorization: `Basic ${basicAuth}` }) })));
14
+ return Layer.mergeAll(ProtocolLive.pipe(Layer.provide(FetchHttpClient.layer), Layer.provide(SerializationLive)), SerializationLive, AuthLive);
15
+ };
16
+
17
+ //#endregion
18
+ export { MimicClientLayer };
19
+ //# sourceMappingURL=HttpTransport.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HttpTransport.mjs","names":[],"sources":["../../src/effect/HttpTransport.ts"],"sourcesContent":["import { Layer } from \"effect\";\nimport { RpcClient, RpcSerialization, RpcMiddleware } from \"effect/unstable/rpc\";\nimport { FetchHttpClient } from \"effect/unstable/http\";\nimport { AuthMiddleware } from \"@voidhash/mimic-protocol\";\n\nexport interface MimicClientConfig {\n readonly url: string;\n readonly username: string;\n readonly password: string;\n readonly timeout?: number;\n}\n\nexport const MimicClientLayer = (config: MimicClientConfig) => {\n const baseUrl = config.url.replace(/\\/+$/, \"\");\n const basicAuth = btoa(`${config.username}:${config.password}`);\n\n const ProtocolLive = RpcClient.layerProtocolHttp({\n url: `${baseUrl}/rpc`,\n });\n\n const SerializationLive = RpcSerialization.layerNdjson;\n\n const AuthLive = RpcMiddleware.layerClient(\n AuthMiddleware,\n ({ next, request }) =>\n next({\n ...request,\n headers: {\n ...request.headers,\n authorization: `Basic ${basicAuth}`,\n },\n }),\n );\n\n return Layer.mergeAll(\n ProtocolLive.pipe(\n Layer.provide(FetchHttpClient.layer),\n Layer.provide(SerializationLive),\n ),\n SerializationLive,\n AuthLive,\n );\n};\n"],"mappings":";;;;;;;AAYA,MAAa,oBAAoB,WAA8B;CAC7D,MAAM,UAAU,OAAO,IAAI,QAAQ,QAAQ,GAAG;CAC9C,MAAM,YAAY,KAAK,GAAG,OAAO,SAAS,GAAG,OAAO,WAAW;CAE/D,MAAM,eAAe,UAAU,kBAAkB,EAC/C,KAAK,GAAG,QAAQ,OACjB,CAAC;CAEF,MAAM,oBAAoB,iBAAiB;CAE3C,MAAM,WAAW,cAAc,YAC7B,iBACC,EAAE,MAAM,cACP,uCACK,gBACH,2CACK,QAAQ,gBACX,eAAe,SAAS,kBAE1B,CACL;AAED,QAAO,MAAM,SACX,aAAa,KACX,MAAM,QAAQ,gBAAgB,MAAM,EACpC,MAAM,QAAQ,kBAAkB,CACjC,EACD,mBACA,SACD"}
@@ -0,0 +1,84 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_DatabaseHandle = require('./DatabaseHandle.cjs');
3
+ let effect = require("effect");
4
+ let effect_unstable_rpc = require("effect/unstable/rpc");
5
+ let _voidhash_mimic_protocol = require("@voidhash/mimic-protocol");
6
+
7
+ //#region src/effect/MimicSDK.ts
8
+ var MimicSDK_exports = /* @__PURE__ */ require_rolldown_runtime.__export({
9
+ createDatabase: () => createDatabase,
10
+ createUser: () => createUser,
11
+ database: () => database,
12
+ deleteDatabase: () => deleteDatabase,
13
+ deleteUser: () => deleteUser,
14
+ grantPermission: () => grantPermission,
15
+ listDatabases: () => listDatabases,
16
+ listGrants: () => listGrants,
17
+ listUsers: () => listUsers,
18
+ revokePermission: () => revokePermission
19
+ });
20
+ const makeClient = () => effect_unstable_rpc.RpcClient.make(_voidhash_mimic_protocol.MimicRpcs);
21
+ const createDatabase = (options) => effect.Effect.scoped(effect.Effect.gen(function* () {
22
+ var _options$description;
23
+ const result = yield* (yield* makeClient()).CreateDatabase({
24
+ name: options.name,
25
+ description: (_options$description = options.description) !== null && _options$description !== void 0 ? _options$description : ""
26
+ });
27
+ return new require_DatabaseHandle.DatabaseHandle(result.id, result.name, result.description);
28
+ }));
29
+ const listDatabases = () => effect.Effect.scoped(effect.Effect.gen(function* () {
30
+ return yield* (yield* makeClient()).ListDatabases(void 0);
31
+ }));
32
+ const deleteDatabase = (id) => effect.Effect.scoped(effect.Effect.gen(function* () {
33
+ yield* (yield* makeClient()).DeleteDatabase({ id });
34
+ }));
35
+ const database = (id, name = "", description = "") => new require_DatabaseHandle.DatabaseHandle(id, name, description);
36
+ const createUser = (options) => effect.Effect.scoped(effect.Effect.gen(function* () {
37
+ const result = yield* (yield* makeClient()).CreateUser({
38
+ username: options.username,
39
+ password: options.password
40
+ });
41
+ return {
42
+ id: result.id,
43
+ username: result.username
44
+ };
45
+ }));
46
+ const listUsers = () => effect.Effect.scoped(effect.Effect.gen(function* () {
47
+ return yield* (yield* makeClient()).ListUsers(void 0);
48
+ }));
49
+ const deleteUser = (id) => effect.Effect.scoped(effect.Effect.gen(function* () {
50
+ yield* (yield* makeClient()).DeleteUser({ id });
51
+ }));
52
+ const grantPermission = (options) => effect.Effect.scoped(effect.Effect.gen(function* () {
53
+ yield* (yield* makeClient()).GrantPermission({
54
+ userId: options.userId,
55
+ databaseId: options.databaseId,
56
+ permission: options.permission
57
+ });
58
+ }));
59
+ const revokePermission = (options) => effect.Effect.scoped(effect.Effect.gen(function* () {
60
+ yield* (yield* makeClient()).RevokePermission({
61
+ userId: options.userId,
62
+ databaseId: options.databaseId
63
+ });
64
+ }));
65
+ const listGrants = (userId) => effect.Effect.scoped(effect.Effect.gen(function* () {
66
+ return yield* (yield* makeClient()).ListGrants({ userId });
67
+ }));
68
+
69
+ //#endregion
70
+ Object.defineProperty(exports, 'MimicSDK_exports', {
71
+ enumerable: true,
72
+ get: function () {
73
+ return MimicSDK_exports;
74
+ }
75
+ });
76
+ exports.createDatabase = createDatabase;
77
+ exports.createUser = createUser;
78
+ exports.deleteDatabase = deleteDatabase;
79
+ exports.deleteUser = deleteUser;
80
+ exports.grantPermission = grantPermission;
81
+ exports.listDatabases = listDatabases;
82
+ exports.listGrants = listGrants;
83
+ exports.listUsers = listUsers;
84
+ exports.revokePermission = revokePermission;
@@ -0,0 +1,40 @@
1
+ import { DatabaseInfo, GrantInfo, UserInfo } from "./types.cjs";
2
+ import { DatabaseHandle } from "./DatabaseHandle.cjs";
3
+ import { Effect } from "effect";
4
+ import { RpcClient, RpcClientError, RpcMiddleware, RpcSerialization } from "effect/unstable/rpc";
5
+ import { AuthMiddleware } from "@voidhash/mimic-protocol";
6
+
7
+ //#region src/effect/MimicSDK.d.ts
8
+ declare namespace MimicSDK_d_exports {
9
+ export { MimicRpcRequirements, createDatabase, createUser, database, deleteDatabase, deleteUser, grantPermission, listDatabases, listGrants, listUsers, revokePermission };
10
+ }
11
+ type MimicRpcRequirements = RpcClient.Protocol | RpcSerialization.RpcSerialization | RpcMiddleware.ForClient<AuthMiddleware>;
12
+ declare const createDatabase: (options: {
13
+ name: string;
14
+ description?: string;
15
+ }) => Effect.Effect<DatabaseHandle, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
16
+ declare const listDatabases: () => Effect.Effect<DatabaseInfo[], string | RpcClientError.RpcClientError, RpcClient.Protocol>;
17
+ declare const deleteDatabase: (id: string) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
18
+ declare const database: (id: string, name?: string, description?: string) => DatabaseHandle;
19
+ declare const createUser: (options: {
20
+ username: string;
21
+ password: string;
22
+ }) => Effect.Effect<{
23
+ id: string;
24
+ username: string;
25
+ }, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
26
+ declare const listUsers: () => Effect.Effect<UserInfo[], string | RpcClientError.RpcClientError, RpcClient.Protocol>;
27
+ declare const deleteUser: (id: string) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
28
+ declare const grantPermission: (options: {
29
+ userId: string;
30
+ databaseId: string;
31
+ permission: "read" | "write" | "admin";
32
+ }) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
33
+ declare const revokePermission: (options: {
34
+ userId: string;
35
+ databaseId: string;
36
+ }) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
37
+ declare const listGrants: (userId?: string) => Effect.Effect<GrantInfo[], string | RpcClientError.RpcClientError, RpcClient.Protocol>;
38
+ //#endregion
39
+ export { MimicRpcRequirements, MimicSDK_d_exports };
40
+ //# sourceMappingURL=MimicSDK.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MimicSDK.d.cts","names":[],"sources":["../../src/effect/MimicSDK.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAMY,oBAAA,GACR,SAAA,CAAU,WACV,gBAAA,CAAiB,mBACjB,aAAA,CAAc,UAAU;cAIf;;;MAGZ,MAAA,CAAA,OAAA,yBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;cAYY,qBAAa,MAAA,CAAA,OAAA,yBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;cASb,gCAA4B,MAAA,CAAA,sBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;cAQ5B,+DAAsD;cAGtD;;;MAGZ,MAAA,CAAA;;;;cAYY,iBAAS,MAAA,CAAA,OAAA,qBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;AAzDV,cAkEC,UAlEmB,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,GAkEK,MAAA,CAAA,MAlEL,CAAA,IAAA,EAAA,MAAA,GAkEK,cAAA,CAAA,cAlEL,EAkEK,SAAA,CAAA,QAlEL,CAAA;AAC5B,cAyES,eAzEC,EAAA,CAAA,OAAA,EAAA;EACV,MAAA,EAAA,MAAiB;EACO,UAAA,EAAA,MAAA;EAAxB,UAAA,EAAc,MAAA,GAAA,OAAA,GAAA,OAAA;CAAS,EAAA,GA2E1B,MAAA,CAAA,MA3E0B,CAAA,IAAA,EAAA,MAAA,GA2E1B,cAAA,CAAA,cA3E0B,EA2E1B,SAAA,CAAA,QA3E0B,CAAA;AAId,cAmFA,gBAtEV,EAAA,CAAA,OAAA,EAAA;EAVF,MAAA,EAAA,MAAA;EAAA,UAAA,EAAA,MAAA;CAAA,EAAA,GAmFA,MAAA,CAAA,MAnFA,CAAA,IAAA,EAAA,MAAA,GAmFA,cAAA,CAAA,cAnFA,EAmFA,SAAA,CAAA,QAnFA,CAAA;AAAA,cA8FY,UA9FZ,EAAA,CAAA,MAAA,CAAA,EAAA,MAAA,EAAA,GA8FyC,MAAA,CAAA,MA9FzC,CA8FyC,SA9FzC,EAAA,EAAA,MAAA,GA8FyC,cAAA,CAAA,cA9FzC,EA8FyC,SAAA,CAAA,QA9FzC,CAAA"}
@@ -0,0 +1,40 @@
1
+ import { DatabaseInfo, GrantInfo, UserInfo } from "./types.mjs";
2
+ import { DatabaseHandle } from "./DatabaseHandle.mjs";
3
+ import { Effect } from "effect";
4
+ import { RpcClient, RpcClientError, RpcMiddleware, RpcSerialization } from "effect/unstable/rpc";
5
+ import { AuthMiddleware } from "@voidhash/mimic-protocol";
6
+
7
+ //#region src/effect/MimicSDK.d.ts
8
+ declare namespace MimicSDK_d_exports {
9
+ export { MimicRpcRequirements, createDatabase, createUser, database, deleteDatabase, deleteUser, grantPermission, listDatabases, listGrants, listUsers, revokePermission };
10
+ }
11
+ type MimicRpcRequirements = RpcClient.Protocol | RpcSerialization.RpcSerialization | RpcMiddleware.ForClient<AuthMiddleware>;
12
+ declare const createDatabase: (options: {
13
+ name: string;
14
+ description?: string;
15
+ }) => Effect.Effect<DatabaseHandle, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
16
+ declare const listDatabases: () => Effect.Effect<DatabaseInfo[], string | RpcClientError.RpcClientError, RpcClient.Protocol>;
17
+ declare const deleteDatabase: (id: string) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
18
+ declare const database: (id: string, name?: string, description?: string) => DatabaseHandle;
19
+ declare const createUser: (options: {
20
+ username: string;
21
+ password: string;
22
+ }) => Effect.Effect<{
23
+ id: string;
24
+ username: string;
25
+ }, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
26
+ declare const listUsers: () => Effect.Effect<UserInfo[], string | RpcClientError.RpcClientError, RpcClient.Protocol>;
27
+ declare const deleteUser: (id: string) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
28
+ declare const grantPermission: (options: {
29
+ userId: string;
30
+ databaseId: string;
31
+ permission: "read" | "write" | "admin";
32
+ }) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
33
+ declare const revokePermission: (options: {
34
+ userId: string;
35
+ databaseId: string;
36
+ }) => Effect.Effect<void, string | RpcClientError.RpcClientError, RpcClient.Protocol>;
37
+ declare const listGrants: (userId?: string) => Effect.Effect<GrantInfo[], string | RpcClientError.RpcClientError, RpcClient.Protocol>;
38
+ //#endregion
39
+ export { MimicRpcRequirements, MimicSDK_d_exports };
40
+ //# sourceMappingURL=MimicSDK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MimicSDK.d.mts","names":[],"sources":["../../src/effect/MimicSDK.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAMY,oBAAA,GACR,SAAA,CAAU,WACV,gBAAA,CAAiB,mBACjB,aAAA,CAAc,UAAU;cAIf;;;MAGZ,MAAA,CAAA,OAAA,yBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;cAYY,qBAAa,MAAA,CAAA,OAAA,yBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;cASb,gCAA4B,MAAA,CAAA,sBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;cAQ5B,+DAAsD;cAGtD;;;MAGZ,MAAA,CAAA;;;;cAYY,iBAAS,MAAA,CAAA,OAAA,qBAAA,cAAA,CAAA,gBAAA,SAAA,CAAA;AAzDV,cAkEC,UAlEmB,EAAA,CAAA,EAAA,EAAA,MAAA,EAAA,GAkEK,MAAA,CAAA,MAlEL,CAAA,IAAA,EAAA,MAAA,GAkEK,cAAA,CAAA,cAlEL,EAkEK,SAAA,CAAA,QAlEL,CAAA;AAC5B,cAyES,eAzEC,EAAA,CAAA,OAAA,EAAA;EACV,MAAA,EAAA,MAAiB;EACO,UAAA,EAAA,MAAA;EAAxB,UAAA,EAAc,MAAA,GAAA,OAAA,GAAA,OAAA;CAAS,EAAA,GA2E1B,MAAA,CAAA,MA3E0B,CAAA,IAAA,EAAA,MAAA,GA2E1B,cAAA,CAAA,cA3E0B,EA2E1B,SAAA,CAAA,QA3E0B,CAAA;AAId,cAmFA,gBAtEV,EAAA,CAAA,OAAA,EAAA;EAVF,MAAA,EAAA,MAAA;EAAA,UAAA,EAAA,MAAA;CAAA,EAAA,GAmFA,MAAA,CAAA,MAnFA,CAAA,IAAA,EAAA,MAAA,GAmFA,cAAA,CAAA,cAnFA,EAmFA,SAAA,CAAA,QAnFA,CAAA;AAAA,cA8FY,UA9FZ,EAAA,CAAA,MAAA,CAAA,EAAA,MAAA,EAAA,GA8FyC,MAAA,CAAA,MA9FzC,CA8FyC,SA9FzC,EAAA,EAAA,MAAA,GA8FyC,cAAA,CAAA,cA9FzC,EA8FyC,SAAA,CAAA,QA9FzC,CAAA"}
@@ -0,0 +1,71 @@
1
+ import { __export } from "../_virtual/rolldown_runtime.mjs";
2
+ import { DatabaseHandle } from "./DatabaseHandle.mjs";
3
+ import { Effect } from "effect";
4
+ import { RpcClient } from "effect/unstable/rpc";
5
+ import { MimicRpcs } from "@voidhash/mimic-protocol";
6
+
7
+ //#region src/effect/MimicSDK.ts
8
+ var MimicSDK_exports = /* @__PURE__ */ __export({
9
+ createDatabase: () => createDatabase,
10
+ createUser: () => createUser,
11
+ database: () => database,
12
+ deleteDatabase: () => deleteDatabase,
13
+ deleteUser: () => deleteUser,
14
+ grantPermission: () => grantPermission,
15
+ listDatabases: () => listDatabases,
16
+ listGrants: () => listGrants,
17
+ listUsers: () => listUsers,
18
+ revokePermission: () => revokePermission
19
+ });
20
+ const makeClient = () => RpcClient.make(MimicRpcs);
21
+ const createDatabase = (options) => Effect.scoped(Effect.gen(function* () {
22
+ var _options$description;
23
+ const result = yield* (yield* makeClient()).CreateDatabase({
24
+ name: options.name,
25
+ description: (_options$description = options.description) !== null && _options$description !== void 0 ? _options$description : ""
26
+ });
27
+ return new DatabaseHandle(result.id, result.name, result.description);
28
+ }));
29
+ const listDatabases = () => Effect.scoped(Effect.gen(function* () {
30
+ return yield* (yield* makeClient()).ListDatabases(void 0);
31
+ }));
32
+ const deleteDatabase = (id) => Effect.scoped(Effect.gen(function* () {
33
+ yield* (yield* makeClient()).DeleteDatabase({ id });
34
+ }));
35
+ const database = (id, name = "", description = "") => new DatabaseHandle(id, name, description);
36
+ const createUser = (options) => Effect.scoped(Effect.gen(function* () {
37
+ const result = yield* (yield* makeClient()).CreateUser({
38
+ username: options.username,
39
+ password: options.password
40
+ });
41
+ return {
42
+ id: result.id,
43
+ username: result.username
44
+ };
45
+ }));
46
+ const listUsers = () => Effect.scoped(Effect.gen(function* () {
47
+ return yield* (yield* makeClient()).ListUsers(void 0);
48
+ }));
49
+ const deleteUser = (id) => Effect.scoped(Effect.gen(function* () {
50
+ yield* (yield* makeClient()).DeleteUser({ id });
51
+ }));
52
+ const grantPermission = (options) => Effect.scoped(Effect.gen(function* () {
53
+ yield* (yield* makeClient()).GrantPermission({
54
+ userId: options.userId,
55
+ databaseId: options.databaseId,
56
+ permission: options.permission
57
+ });
58
+ }));
59
+ const revokePermission = (options) => Effect.scoped(Effect.gen(function* () {
60
+ yield* (yield* makeClient()).RevokePermission({
61
+ userId: options.userId,
62
+ databaseId: options.databaseId
63
+ });
64
+ }));
65
+ const listGrants = (userId) => Effect.scoped(Effect.gen(function* () {
66
+ return yield* (yield* makeClient()).ListGrants({ userId });
67
+ }));
68
+
69
+ //#endregion
70
+ export { MimicSDK_exports, createDatabase, createUser, deleteDatabase, deleteUser, grantPermission, listDatabases, listGrants, listUsers, revokePermission };
71
+ //# sourceMappingURL=MimicSDK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MimicSDK.mjs","names":[],"sources":["../../src/effect/MimicSDK.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { RpcClient, RpcSerialization, RpcClientError, RpcMiddleware } from \"effect/unstable/rpc\";\nimport { MimicRpcs, type AuthMiddleware } from \"@voidhash/mimic-protocol\";\nimport { DatabaseHandle } from \"./DatabaseHandle\";\nimport type { DatabaseInfo, UserInfo, GrantInfo } from \"./types\";\n\nexport type MimicRpcRequirements =\n | RpcClient.Protocol\n | RpcSerialization.RpcSerialization\n | RpcMiddleware.ForClient<AuthMiddleware>;\n\nconst makeClient = () => RpcClient.make(MimicRpcs);\n\nexport const createDatabase = (options: {\n name: string;\n description?: string;\n}) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.CreateDatabase({\n name: options.name,\n description: options.description ?? \"\",\n });\n return new DatabaseHandle(result.id, result.name, result.description);\n }),\n );\n\nexport const listDatabases = () =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.ListDatabases(undefined as any);\n return result as unknown as DatabaseInfo[];\n }),\n );\n\nexport const deleteDatabase = (id: string) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n yield* client.DeleteDatabase({ id });\n }),\n );\n\nexport const database = (id: string, name = \"\", description = \"\"): DatabaseHandle =>\n new DatabaseHandle(id, name, description);\n\nexport const createUser = (options: {\n username: string;\n password: string;\n}) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.CreateUser({\n username: options.username,\n password: options.password,\n });\n return { id: result.id, username: result.username };\n }),\n );\n\nexport const listUsers = () =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.ListUsers(undefined as any);\n return result as unknown as UserInfo[];\n }),\n );\n\nexport const deleteUser = (id: string) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n yield* client.DeleteUser({ id });\n }),\n );\n\nexport const grantPermission = (options: {\n userId: string;\n databaseId: string;\n permission: \"read\" | \"write\" | \"admin\";\n}) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n yield* client.GrantPermission({\n userId: options.userId,\n databaseId: options.databaseId,\n permission: options.permission,\n });\n }),\n );\n\nexport const revokePermission = (options: {\n userId: string;\n databaseId: string;\n}) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n yield* client.RevokePermission({\n userId: options.userId,\n databaseId: options.databaseId,\n });\n }),\n );\n\nexport const listGrants = (userId?: string) =>\n Effect.scoped(\n Effect.gen(function* () {\n const client = yield* makeClient();\n const result = yield* client.ListGrants({ userId });\n return result as unknown as GrantInfo[];\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,MAAM,mBAAmB,UAAU,KAAK,UAAU;AAElD,MAAa,kBAAkB,YAI7B,OAAO,OACL,OAAO,IAAI,aAAa;;CAEtB,MAAM,SAAS,QADA,OAAO,YAAY,EACL,eAAe;EAC1C,MAAM,QAAQ;EACd,qCAAa,QAAQ,kFAAe;EACrC,CAAC;AACF,QAAO,IAAI,eAAe,OAAO,IAAI,OAAO,MAAM,OAAO,YAAY;EACrE,CACH;AAEH,MAAa,sBACX,OAAO,OACL,OAAO,IAAI,aAAa;AAGtB,QADe,QADA,OAAO,YAAY,EACL,cAAc,OAAiB;EAE5D,CACH;AAEH,MAAa,kBAAkB,OAC7B,OAAO,OACL,OAAO,IAAI,aAAa;AAEtB,SADe,OAAO,YAAY,EACpB,eAAe,EAAE,IAAI,CAAC;EACpC,CACH;AAEH,MAAa,YAAY,IAAY,OAAO,IAAI,cAAc,OAC5D,IAAI,eAAe,IAAI,MAAM,YAAY;AAE3C,MAAa,cAAc,YAIzB,OAAO,OACL,OAAO,IAAI,aAAa;CAEtB,MAAM,SAAS,QADA,OAAO,YAAY,EACL,WAAW;EACtC,UAAU,QAAQ;EAClB,UAAU,QAAQ;EACnB,CAAC;AACF,QAAO;EAAE,IAAI,OAAO;EAAI,UAAU,OAAO;EAAU;EACnD,CACH;AAEH,MAAa,kBACX,OAAO,OACL,OAAO,IAAI,aAAa;AAGtB,QADe,QADA,OAAO,YAAY,EACL,UAAU,OAAiB;EAExD,CACH;AAEH,MAAa,cAAc,OACzB,OAAO,OACL,OAAO,IAAI,aAAa;AAEtB,SADe,OAAO,YAAY,EACpB,WAAW,EAAE,IAAI,CAAC;EAChC,CACH;AAEH,MAAa,mBAAmB,YAK9B,OAAO,OACL,OAAO,IAAI,aAAa;AAEtB,SADe,OAAO,YAAY,EACpB,gBAAgB;EAC5B,QAAQ,QAAQ;EAChB,YAAY,QAAQ;EACpB,YAAY,QAAQ;EACrB,CAAC;EACF,CACH;AAEH,MAAa,oBAAoB,YAI/B,OAAO,OACL,OAAO,IAAI,aAAa;AAEtB,SADe,OAAO,YAAY,EACpB,iBAAiB;EAC7B,QAAQ,QAAQ;EAChB,YAAY,QAAQ;EACrB,CAAC;EACF,CACH;AAEH,MAAa,cAAc,WACzB,OAAO,OACL,OAAO,IAAI,aAAa;AAGtB,QADe,QADA,OAAO,YAAY,EACL,WAAW,EAAE,QAAQ,CAAC;EAEnD,CACH"}
@@ -0,0 +1,7 @@
1
+ let effect = require("effect");
2
+
3
+ //#region src/effect/errors.ts
4
+ var MimicSDKError = class extends effect.Data.TaggedError("MimicSDKError") {};
5
+
6
+ //#endregion
7
+ exports.MimicSDKError = MimicSDKError;
@@ -0,0 +1,15 @@
1
+ import * as effect_Types0 from "effect/Types";
2
+ import * as effect_Cause0 from "effect/Cause";
3
+
4
+ //#region src/effect/errors.d.ts
5
+ declare const MimicSDKError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.MatchRecord<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }, void, { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
6
+ readonly _tag: "MimicSDKError";
7
+ } & Readonly<A>;
8
+ declare class MimicSDKError extends MimicSDKError_base<{
9
+ readonly message: string;
10
+ readonly method?: string;
11
+ readonly cause?: unknown;
12
+ }> {}
13
+ //#endregion
14
+ export { MimicSDKError };
15
+ //# sourceMappingURL=errors.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.cts","names":[],"sources":["../../src/effect/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;cAEa,aAAA,SAAsB"}
@@ -0,0 +1,15 @@
1
+ import * as effect_Types0 from "effect/Types";
2
+ import * as effect_Cause0 from "effect/Cause";
3
+
4
+ //#region src/effect/errors.d.ts
5
+ declare const MimicSDKError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.MatchRecord<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }, void, { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
6
+ readonly _tag: "MimicSDKError";
7
+ } & Readonly<A>;
8
+ declare class MimicSDKError extends MimicSDKError_base<{
9
+ readonly message: string;
10
+ readonly method?: string;
11
+ readonly cause?: unknown;
12
+ }> {}
13
+ //#endregion
14
+ export { MimicSDKError };
15
+ //# sourceMappingURL=errors.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.mts","names":[],"sources":["../../src/effect/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;cAEa,aAAA,SAAsB"}
@@ -0,0 +1,8 @@
1
+ import { Data } from "effect";
2
+
3
+ //#region src/effect/errors.ts
4
+ var MimicSDKError = class extends Data.TaggedError("MimicSDKError") {};
5
+
6
+ //#endregion
7
+ export { MimicSDKError };
8
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","names":[],"sources":["../../src/effect/errors.ts"],"sourcesContent":["import { Data } from \"effect\";\n\nexport class MimicSDKError extends Data.TaggedError(\"MimicSDKError\")<{\n readonly message: string;\n readonly method?: string;\n readonly cause?: unknown;\n}> {}\n"],"mappings":";;;AAEA,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAIjE"}
@@ -0,0 +1,35 @@
1
+ const require_HttpTransport = require('./HttpTransport.cjs');
2
+ const require_CollectionHandle = require('./CollectionHandle.cjs');
3
+ const require_DatabaseHandle = require('./DatabaseHandle.cjs');
4
+ const require_MimicSDK = require('./MimicSDK.cjs');
5
+ const require_errors = require('./errors.cjs');
6
+ let _voidhash_mimic_protocol = require("@voidhash/mimic-protocol");
7
+
8
+ Object.defineProperty(exports, 'AuthMiddleware', {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _voidhash_mimic_protocol.AuthMiddleware;
12
+ }
13
+ });
14
+ exports.CollectionHandle = require_CollectionHandle.CollectionHandle;
15
+ Object.defineProperty(exports, 'CurrentUser', {
16
+ enumerable: true,
17
+ get: function () {
18
+ return _voidhash_mimic_protocol.CurrentUser;
19
+ }
20
+ });
21
+ exports.DatabaseHandle = require_DatabaseHandle.DatabaseHandle;
22
+ exports.MimicClientLayer = require_HttpTransport.MimicClientLayer;
23
+ Object.defineProperty(exports, 'MimicRpcs', {
24
+ enumerable: true,
25
+ get: function () {
26
+ return _voidhash_mimic_protocol.MimicRpcs;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, 'MimicSDK', {
30
+ enumerable: true,
31
+ get: function () {
32
+ return require_MimicSDK.MimicSDK_exports;
33
+ }
34
+ });
35
+ exports.MimicSDKError = require_errors.MimicSDKError;
@@ -0,0 +1,8 @@
1
+ import { MimicClientConfig, MimicClientLayer } from "./HttpTransport.cjs";
2
+ import { MimicSDKError } from "./errors.cjs";
3
+ import { CollectionInfo, CreatedDocumentToken, DatabaseInfo, DocumentSnapshot, GrantInfo, UserInfo } from "./types.cjs";
4
+ import { CollectionHandle } from "./CollectionHandle.cjs";
5
+ import { DatabaseHandle } from "./DatabaseHandle.cjs";
6
+ import { MimicRpcRequirements, MimicSDK_d_exports } from "./MimicSDK.cjs";
7
+ import { AuthMiddleware, CurrentUser, MimicRpcs } from "@voidhash/mimic-protocol";
8
+ export { AuthMiddleware, CollectionHandle, type CollectionInfo, type CreatedDocumentToken, CurrentUser, DatabaseHandle, type DatabaseInfo, type DocumentSnapshot, type GrantInfo, type MimicClientConfig, MimicClientLayer, type MimicRpcRequirements, MimicRpcs, MimicSDK_d_exports as MimicSDK, MimicSDKError, type UserInfo };
@@ -0,0 +1,8 @@
1
+ import { MimicClientConfig, MimicClientLayer } from "./HttpTransport.mjs";
2
+ import { MimicSDKError } from "./errors.mjs";
3
+ import { CollectionInfo, CreatedDocumentToken, DatabaseInfo, DocumentSnapshot, GrantInfo, UserInfo } from "./types.mjs";
4
+ import { CollectionHandle } from "./CollectionHandle.mjs";
5
+ import { DatabaseHandle } from "./DatabaseHandle.mjs";
6
+ import { MimicRpcRequirements, MimicSDK_d_exports } from "./MimicSDK.mjs";
7
+ import { AuthMiddleware, CurrentUser, MimicRpcs } from "@voidhash/mimic-protocol";
8
+ export { AuthMiddleware, CollectionHandle, type CollectionInfo, type CreatedDocumentToken, CurrentUser, DatabaseHandle, type DatabaseInfo, type DocumentSnapshot, type GrantInfo, type MimicClientConfig, MimicClientLayer, type MimicRpcRequirements, MimicRpcs, MimicSDK_d_exports as MimicSDK, MimicSDKError, type UserInfo };
@@ -0,0 +1,8 @@
1
+ import { MimicClientLayer } from "./HttpTransport.mjs";
2
+ import { CollectionHandle } from "./CollectionHandle.mjs";
3
+ import { DatabaseHandle } from "./DatabaseHandle.mjs";
4
+ import { MimicSDK_exports } from "./MimicSDK.mjs";
5
+ import { MimicSDKError } from "./errors.mjs";
6
+ import { AuthMiddleware, CurrentUser, MimicRpcs } from "@voidhash/mimic-protocol";
7
+
8
+ export { AuthMiddleware, CollectionHandle, CurrentUser, DatabaseHandle, MimicClientLayer, MimicRpcs, MimicSDK_exports as MimicSDK, MimicSDKError };
@@ -0,0 +1,34 @@
1
+ //#region src/effect/types.d.ts
2
+ interface DatabaseInfo {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly description: string;
6
+ }
7
+ interface CollectionInfo {
8
+ readonly id: string;
9
+ readonly databaseId: string;
10
+ readonly name: string;
11
+ }
12
+ interface UserInfo {
13
+ readonly id: string;
14
+ readonly username: string;
15
+ readonly isSuperuser: boolean;
16
+ }
17
+ interface GrantInfo {
18
+ readonly id: string;
19
+ readonly userId: string;
20
+ readonly databaseId: string;
21
+ readonly permission: string;
22
+ }
23
+ interface CreatedDocumentToken {
24
+ readonly token: string;
25
+ }
26
+ interface DocumentSnapshot<TState = unknown> {
27
+ readonly id: string;
28
+ readonly collectionId: string;
29
+ readonly state: TState;
30
+ readonly version: number;
31
+ }
32
+ //#endregion
33
+ export { CollectionInfo, CreatedDocumentToken, DatabaseInfo, DocumentSnapshot, GrantInfo, UserInfo };
34
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/effect/types.ts"],"sourcesContent":[],"mappings":";UAAiB,YAAA;EAAA,SAAA,EAAA,EAAA,MAAY;EAMZ,SAAA,IAAA,EAAA,MAAc;EAMd,SAAA,WAAQ,EAAA,MAAA;AAMzB;AAOiB,UAnBA,cAAA,CAmBoB;EAIpB,SAAA,EAAA,EAAA,MAAgB;;;;UAjBhB,QAAA;;;;;UAMA,SAAA;;;;;;UAOA,oBAAA;;;UAIA;;;kBAGC"}
@@ -0,0 +1,34 @@
1
+ //#region src/effect/types.d.ts
2
+ interface DatabaseInfo {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly description: string;
6
+ }
7
+ interface CollectionInfo {
8
+ readonly id: string;
9
+ readonly databaseId: string;
10
+ readonly name: string;
11
+ }
12
+ interface UserInfo {
13
+ readonly id: string;
14
+ readonly username: string;
15
+ readonly isSuperuser: boolean;
16
+ }
17
+ interface GrantInfo {
18
+ readonly id: string;
19
+ readonly userId: string;
20
+ readonly databaseId: string;
21
+ readonly permission: string;
22
+ }
23
+ interface CreatedDocumentToken {
24
+ readonly token: string;
25
+ }
26
+ interface DocumentSnapshot<TState = unknown> {
27
+ readonly id: string;
28
+ readonly collectionId: string;
29
+ readonly state: TState;
30
+ readonly version: number;
31
+ }
32
+ //#endregion
33
+ export { CollectionInfo, CreatedDocumentToken, DatabaseInfo, DocumentSnapshot, GrantInfo, UserInfo };
34
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/effect/types.ts"],"sourcesContent":[],"mappings":";UAAiB,YAAA;EAAA,SAAA,EAAA,EAAA,MAAY;EAMZ,SAAA,IAAA,EAAA,MAAc;EAMd,SAAA,WAAQ,EAAA,MAAA;AAMzB;AAOiB,UAnBA,cAAA,CAmBoB;EAIpB,SAAA,EAAA,EAAA,MAAgB;;;;UAjBhB,QAAA;;;;;UAMA,SAAA;;;;;;UAOA,oBAAA;;;UAIA;;;kBAGC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ const require_CollectionHandle = require('./promise/CollectionHandle.cjs');
2
+ const require_DatabaseHandle = require('./promise/DatabaseHandle.cjs');
3
+ const require_MimicSDK = require('./promise/MimicSDK.cjs');
4
+
5
+ exports.CollectionHandle = require_CollectionHandle.CollectionHandle;
6
+ exports.DatabaseHandle = require_DatabaseHandle.DatabaseHandle;
7
+ exports.MimicSDK = require_MimicSDK.MimicSDK;