@tinycloudlabs/sdk-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/LICENSE.md +320 -0
  2. package/dist/TinyCloud.d.ts +206 -0
  3. package/dist/TinyCloud.d.ts.map +1 -0
  4. package/dist/TinyCloud.js +244 -0
  5. package/dist/TinyCloud.js.map +1 -0
  6. package/dist/TinyCloud.schema.d.ts +173 -0
  7. package/dist/TinyCloud.schema.d.ts.map +1 -0
  8. package/dist/TinyCloud.schema.js +136 -0
  9. package/dist/TinyCloud.schema.js.map +1 -0
  10. package/dist/TinyCloud.schema.test.d.ts +5 -0
  11. package/dist/TinyCloud.schema.test.d.ts.map +1 -0
  12. package/dist/TinyCloud.schema.test.js +286 -0
  13. package/dist/TinyCloud.schema.test.js.map +1 -0
  14. package/dist/authorization/CapabilityKeyRegistry.d.ts +317 -0
  15. package/dist/authorization/CapabilityKeyRegistry.d.ts.map +1 -0
  16. package/dist/authorization/CapabilityKeyRegistry.js +509 -0
  17. package/dist/authorization/CapabilityKeyRegistry.js.map +1 -0
  18. package/dist/authorization/authorization.schema.d.ts +233 -0
  19. package/dist/authorization/authorization.schema.d.ts.map +1 -0
  20. package/dist/authorization/authorization.schema.js +220 -0
  21. package/dist/authorization/authorization.schema.js.map +1 -0
  22. package/dist/authorization/authorization.schema.test.d.ts +5 -0
  23. package/dist/authorization/authorization.schema.test.d.ts.map +1 -0
  24. package/dist/authorization/authorization.schema.test.js +618 -0
  25. package/dist/authorization/authorization.schema.test.js.map +1 -0
  26. package/dist/authorization/index.d.ts +38 -0
  27. package/dist/authorization/index.d.ts.map +1 -0
  28. package/dist/authorization/index.js +52 -0
  29. package/dist/authorization/index.js.map +1 -0
  30. package/dist/authorization/spaceCreation.d.ts +96 -0
  31. package/dist/authorization/spaceCreation.d.ts.map +1 -0
  32. package/dist/authorization/spaceCreation.js +35 -0
  33. package/dist/authorization/spaceCreation.js.map +1 -0
  34. package/dist/authorization/spaceCreation.schema.d.ts +67 -0
  35. package/dist/authorization/spaceCreation.schema.d.ts.map +1 -0
  36. package/dist/authorization/spaceCreation.schema.js +95 -0
  37. package/dist/authorization/spaceCreation.schema.js.map +1 -0
  38. package/dist/authorization/spaceCreation.schema.test.d.ts +5 -0
  39. package/dist/authorization/spaceCreation.schema.test.d.ts.map +1 -0
  40. package/dist/authorization/spaceCreation.schema.test.js +168 -0
  41. package/dist/authorization/spaceCreation.schema.test.js.map +1 -0
  42. package/dist/authorization/strategies.d.ts +134 -0
  43. package/dist/authorization/strategies.d.ts.map +1 -0
  44. package/dist/authorization/strategies.js +15 -0
  45. package/dist/authorization/strategies.js.map +1 -0
  46. package/dist/authorization/strategies.schema.d.ts +185 -0
  47. package/dist/authorization/strategies.schema.d.ts.map +1 -0
  48. package/dist/authorization/strategies.schema.js +147 -0
  49. package/dist/authorization/strategies.schema.js.map +1 -0
  50. package/dist/authorization/strategies.schema.test.d.ts +5 -0
  51. package/dist/authorization/strategies.schema.test.d.ts.map +1 -0
  52. package/dist/authorization/strategies.schema.test.js +253 -0
  53. package/dist/authorization/strategies.schema.test.js.map +1 -0
  54. package/dist/delegations/DelegationManager.d.ts +164 -0
  55. package/dist/delegations/DelegationManager.d.ts.map +1 -0
  56. package/dist/delegations/DelegationManager.js +428 -0
  57. package/dist/delegations/DelegationManager.js.map +1 -0
  58. package/dist/delegations/SharingService.d.ts +279 -0
  59. package/dist/delegations/SharingService.d.ts.map +1 -0
  60. package/dist/delegations/SharingService.js +558 -0
  61. package/dist/delegations/SharingService.js.map +1 -0
  62. package/dist/delegations/SharingService.schema.d.ts +401 -0
  63. package/dist/delegations/SharingService.schema.d.ts.map +1 -0
  64. package/dist/delegations/SharingService.schema.js +211 -0
  65. package/dist/delegations/SharingService.schema.js.map +1 -0
  66. package/dist/delegations/index.d.ts +38 -0
  67. package/dist/delegations/index.d.ts.map +1 -0
  68. package/dist/delegations/index.js +42 -0
  69. package/dist/delegations/index.js.map +1 -0
  70. package/dist/delegations/types.d.ts +13 -0
  71. package/dist/delegations/types.d.ts.map +1 -0
  72. package/dist/delegations/types.js +42 -0
  73. package/dist/delegations/types.js.map +1 -0
  74. package/dist/delegations/types.schema.d.ts +1641 -0
  75. package/dist/delegations/types.schema.d.ts.map +1 -0
  76. package/dist/delegations/types.schema.js +535 -0
  77. package/dist/delegations/types.schema.js.map +1 -0
  78. package/dist/delegations/types.schema.test.d.ts +5 -0
  79. package/dist/delegations/types.schema.test.d.ts.map +1 -0
  80. package/dist/delegations/types.schema.test.js +627 -0
  81. package/dist/delegations/types.schema.test.js.map +1 -0
  82. package/dist/index.d.ts +22 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +52 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/json-schema.d.ts +327 -0
  87. package/dist/json-schema.d.ts.map +1 -0
  88. package/dist/json-schema.js +703 -0
  89. package/dist/json-schema.js.map +1 -0
  90. package/dist/json-schema.test.d.ts +7 -0
  91. package/dist/json-schema.test.d.ts.map +1 -0
  92. package/dist/json-schema.test.js +365 -0
  93. package/dist/json-schema.test.js.map +1 -0
  94. package/dist/signer.d.ts +28 -0
  95. package/dist/signer.d.ts.map +1 -0
  96. package/dist/signer.js +2 -0
  97. package/dist/signer.js.map +1 -0
  98. package/dist/space.d.ts +53 -0
  99. package/dist/space.d.ts.map +1 -0
  100. package/dist/space.js +67 -0
  101. package/dist/space.js.map +1 -0
  102. package/dist/space.schema.d.ts +65 -0
  103. package/dist/space.schema.d.ts.map +1 -0
  104. package/dist/space.schema.js +65 -0
  105. package/dist/space.schema.js.map +1 -0
  106. package/dist/space.schema.test.d.ts +5 -0
  107. package/dist/space.schema.test.d.ts.map +1 -0
  108. package/dist/space.schema.test.js +148 -0
  109. package/dist/space.schema.test.js.map +1 -0
  110. package/dist/spaces/Space.d.ts +175 -0
  111. package/dist/spaces/Space.d.ts.map +1 -0
  112. package/dist/spaces/Space.js +84 -0
  113. package/dist/spaces/Space.js.map +1 -0
  114. package/dist/spaces/SpaceService.d.ts +271 -0
  115. package/dist/spaces/SpaceService.d.ts.map +1 -0
  116. package/dist/spaces/SpaceService.js +715 -0
  117. package/dist/spaces/SpaceService.js.map +1 -0
  118. package/dist/spaces/index.d.ts +11 -0
  119. package/dist/spaces/index.d.ts.map +1 -0
  120. package/dist/spaces/index.js +20 -0
  121. package/dist/spaces/index.js.map +1 -0
  122. package/dist/spaces/spaces.schema.d.ts +421 -0
  123. package/dist/spaces/spaces.schema.d.ts.map +1 -0
  124. package/dist/spaces/spaces.schema.js +342 -0
  125. package/dist/spaces/spaces.schema.js.map +1 -0
  126. package/dist/spaces/spaces.schema.test.d.ts +5 -0
  127. package/dist/spaces/spaces.schema.test.d.ts.map +1 -0
  128. package/dist/spaces/spaces.schema.test.js +471 -0
  129. package/dist/spaces/spaces.schema.test.js.map +1 -0
  130. package/dist/storage.d.ts +47 -0
  131. package/dist/storage.d.ts.map +1 -0
  132. package/dist/storage.js +14 -0
  133. package/dist/storage.js.map +1 -0
  134. package/dist/storage.schema.d.ts +277 -0
  135. package/dist/storage.schema.d.ts.map +1 -0
  136. package/dist/storage.schema.js +185 -0
  137. package/dist/storage.schema.js.map +1 -0
  138. package/dist/storage.schema.test.d.ts +5 -0
  139. package/dist/storage.schema.test.d.ts.map +1 -0
  140. package/dist/storage.schema.test.js +346 -0
  141. package/dist/storage.schema.test.js.map +1 -0
  142. package/dist/userAuthorization.d.ts +99 -0
  143. package/dist/userAuthorization.d.ts.map +1 -0
  144. package/dist/userAuthorization.js +3 -0
  145. package/dist/userAuthorization.js.map +1 -0
  146. package/dist/userAuthorization.schema.d.ts +259 -0
  147. package/dist/userAuthorization.schema.d.ts.map +1 -0
  148. package/dist/userAuthorization.schema.js +175 -0
  149. package/dist/userAuthorization.schema.js.map +1 -0
  150. package/dist/userAuthorization.schema.test.d.ts +5 -0
  151. package/dist/userAuthorization.schema.test.d.ts.map +1 -0
  152. package/dist/userAuthorization.schema.test.js +356 -0
  153. package/dist/userAuthorization.schema.test.js.map +1 -0
  154. package/dist/version.d.ts +30 -0
  155. package/dist/version.d.ts.map +1 -0
  156. package/dist/version.js +54 -0
  157. package/dist/version.js.map +1 -0
  158. package/dist/wasm-validation.d.ts +287 -0
  159. package/dist/wasm-validation.d.ts.map +1 -0
  160. package/dist/wasm-validation.js +219 -0
  161. package/dist/wasm-validation.js.map +1 -0
  162. package/dist/wasm-validation.test.d.ts +5 -0
  163. package/dist/wasm-validation.test.d.ts.map +1 -0
  164. package/dist/wasm-validation.test.js +233 -0
  165. package/dist/wasm-validation.test.js.map +1 -0
  166. package/package.json +40 -0
@@ -0,0 +1,38 @@
1
+ /**
2
+ * TinyCloud SDK Authorization Module
3
+ *
4
+ * This module provides authorization and capability management
5
+ * for the TinyCloud SDK.
6
+ *
7
+ * @packageDocumentation
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import {
12
+ * CapabilityKeyRegistry,
13
+ * ICapabilityKeyRegistry,
14
+ * createCapabilityKeyRegistry,
15
+ * } from "@tinycloudlabs/sdk-core/authorization";
16
+ *
17
+ * // Create a capability registry
18
+ * const registry = createCapabilityKeyRegistry();
19
+ *
20
+ * // Register a session key with its delegations
21
+ * registry.registerKey(sessionKey, [rootDelegation]);
22
+ *
23
+ * // Get the best key for an operation
24
+ * const key = registry.getKeyForCapability(
25
+ * "tinycloud://my-space/kv/data",
26
+ * "tinycloud.kv/get"
27
+ * );
28
+ *
29
+ * if (key) {
30
+ * // Use this key for the operation
31
+ * console.log("Using key:", key.id);
32
+ * }
33
+ * ```
34
+ */
35
+ export { CapabilityKeyRegistry, ICapabilityKeyRegistry, createCapabilityKeyRegistry, StoredDelegationChain, CapabilityKeyRegistryErrorCodes, CapabilityKeyRegistryErrorCode, } from "./CapabilityKeyRegistry";
36
+ export { SignRequest, SignResponse, SignCallback, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, EventEmitterStrategy, SignStrategy, defaultSignStrategy, } from "./strategies";
37
+ export { SpaceCreationContext, ISpaceCreationHandler, AutoApproveSpaceCreationHandler, defaultSpaceCreationHandler, } from "./spaceCreation";
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAEL,qBAAqB,EAErB,sBAAsB,EAEtB,2BAA2B,EAE3B,qBAAqB,EAErB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAEL,WAAW,EACX,YAAY,EACZ,YAAY,EAEZ,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EAEZ,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,oBAAoB,EAEpB,qBAAqB,EAErB,+BAA+B,EAE/B,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * TinyCloud SDK Authorization Module
3
+ *
4
+ * This module provides authorization and capability management
5
+ * for the TinyCloud SDK.
6
+ *
7
+ * @packageDocumentation
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import {
12
+ * CapabilityKeyRegistry,
13
+ * ICapabilityKeyRegistry,
14
+ * createCapabilityKeyRegistry,
15
+ * } from "@tinycloudlabs/sdk-core/authorization";
16
+ *
17
+ * // Create a capability registry
18
+ * const registry = createCapabilityKeyRegistry();
19
+ *
20
+ * // Register a session key with its delegations
21
+ * registry.registerKey(sessionKey, [rootDelegation]);
22
+ *
23
+ * // Get the best key for an operation
24
+ * const key = registry.getKeyForCapability(
25
+ * "tinycloud://my-space/kv/data",
26
+ * "tinycloud.kv/get"
27
+ * );
28
+ *
29
+ * if (key) {
30
+ * // Use this key for the operation
31
+ * console.log("Using key:", key.id);
32
+ * }
33
+ * ```
34
+ */
35
+ export {
36
+ // Class
37
+ CapabilityKeyRegistry,
38
+ // Factory
39
+ createCapabilityKeyRegistry,
40
+ // Error codes
41
+ CapabilityKeyRegistryErrorCodes, } from "./CapabilityKeyRegistry";
42
+ // SignStrategy types
43
+ export {
44
+ // Default
45
+ defaultSignStrategy, } from "./strategies";
46
+ // Space creation handler types
47
+ export {
48
+ // Default implementation
49
+ AutoApproveSpaceCreationHandler,
50
+ // Default instance
51
+ defaultSpaceCreationHandler, } from "./spaceCreation";
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO;AACL,QAAQ;AACR,qBAAqB;AAGrB,UAAU;AACV,2BAA2B;AAG3B,cAAc;AACd,+BAA+B,GAEhC,MAAM,yBAAyB,CAAC;AAEjC,qBAAqB;AACrB,OAAO;AAWL,UAAU;AACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,+BAA+B;AAC/B,OAAO;AAKL,yBAAyB;AACzB,+BAA+B;AAC/B,mBAAmB;AACnB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Space creation handler types for TinyCloud authorization.
3
+ *
4
+ * These types abstract space creation confirmation, allowing different
5
+ * implementations for web (modal) vs node (auto-approve) environments.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Context passed to space creation handlers.
11
+ */
12
+ export interface SpaceCreationContext {
13
+ /** The unique identifier for the space being created */
14
+ spaceId: string;
15
+ /** Ethereum address of the user creating the space */
16
+ address: string;
17
+ /** Chain ID for the creation context */
18
+ chainId: number;
19
+ /** Host URL where the space will be created */
20
+ host: string;
21
+ }
22
+ /**
23
+ * Interface for handling space creation confirmation.
24
+ *
25
+ * Implementations can provide different UX patterns:
26
+ * - Auto-approve for backend services
27
+ * - Modal confirmation for web apps
28
+ * - CLI prompts for terminal apps
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * class ModalSpaceCreationHandler implements ISpaceCreationHandler {
33
+ * async confirmSpaceCreation(context: SpaceCreationContext): Promise<boolean> {
34
+ * return await showConfirmationModal(`Create space ${context.spaceId}?`);
35
+ * }
36
+ *
37
+ * onSpaceCreated(context: SpaceCreationContext): void {
38
+ * showToast(`Space ${context.spaceId} created!`);
39
+ * }
40
+ *
41
+ * onSpaceCreationFailed(context: SpaceCreationContext, error: Error): void {
42
+ * showErrorModal(`Failed to create space: ${error.message}`);
43
+ * }
44
+ * }
45
+ * ```
46
+ */
47
+ export interface ISpaceCreationHandler {
48
+ /**
49
+ * Called when a new space needs to be created.
50
+ * Returns true if space should be created, false to skip.
51
+ *
52
+ * @param context - Information about the space to be created
53
+ * @returns Promise resolving to true to proceed, false to cancel
54
+ */
55
+ confirmSpaceCreation(context: SpaceCreationContext): Promise<boolean>;
56
+ /**
57
+ * Called after successful space creation.
58
+ * Optional - implement to show success UI or perform cleanup.
59
+ *
60
+ * @param context - Information about the created space
61
+ */
62
+ onSpaceCreated?(context: SpaceCreationContext): void;
63
+ /**
64
+ * Called if space creation fails.
65
+ * Optional - implement to show error UI or perform recovery.
66
+ *
67
+ * @param context - Information about the space that failed to create
68
+ * @param error - The error that occurred
69
+ */
70
+ onSpaceCreationFailed?(context: SpaceCreationContext, error: Error): void;
71
+ }
72
+ /**
73
+ * Default handler that auto-approves all space creation.
74
+ *
75
+ * Use cases:
76
+ * - Backend services
77
+ * - Automated scripts
78
+ * - Node.js applications without UI
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const handler = new AutoApproveSpaceCreationHandler();
83
+ * const config = { spaceCreationHandler: handler };
84
+ * ```
85
+ */
86
+ export declare class AutoApproveSpaceCreationHandler implements ISpaceCreationHandler {
87
+ /**
88
+ * Always returns true to auto-approve space creation.
89
+ */
90
+ confirmSpaceCreation(): Promise<boolean>;
91
+ }
92
+ /**
93
+ * Default space creation handler that auto-approves all requests.
94
+ */
95
+ export declare const defaultSpaceCreationHandler: ISpaceCreationHandler;
96
+ //# sourceMappingURL=spaceCreation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCreation.d.ts","sourceRoot":"","sources":["../../src/authorization/spaceCreation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtE;;;;;OAKG;IACH,cAAc,CAAC,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAErD;;;;;;OAMG;IACH,qBAAqB,CAAC,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC3E;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,+BAAgC,YAAW,qBAAqB;IAC3E;;OAEG;IACG,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC;CAG/C;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,qBACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Space creation handler types for TinyCloud authorization.
3
+ *
4
+ * These types abstract space creation confirmation, allowing different
5
+ * implementations for web (modal) vs node (auto-approve) environments.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Default handler that auto-approves all space creation.
11
+ *
12
+ * Use cases:
13
+ * - Backend services
14
+ * - Automated scripts
15
+ * - Node.js applications without UI
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const handler = new AutoApproveSpaceCreationHandler();
20
+ * const config = { spaceCreationHandler: handler };
21
+ * ```
22
+ */
23
+ export class AutoApproveSpaceCreationHandler {
24
+ /**
25
+ * Always returns true to auto-approve space creation.
26
+ */
27
+ async confirmSpaceCreation() {
28
+ return true;
29
+ }
30
+ }
31
+ /**
32
+ * Default space creation handler that auto-approves all requests.
33
+ */
34
+ export const defaultSpaceCreationHandler = new AutoApproveSpaceCreationHandler();
35
+ //# sourceMappingURL=spaceCreation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCreation.js","sourceRoot":"","sources":["../../src/authorization/spaceCreation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqEH;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,+BAA+B;IAC1C;;OAEG;IACH,KAAK,CAAC,oBAAoB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,IAAI,+BAA+B,EAAE,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Zod schemas for space creation handler types.
3
+ *
4
+ * These schemas provide runtime validation for space creation configuration.
5
+ * Types are derived from schemas using z.infer<>.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import { z } from "zod";
10
+ import type { Result } from "../delegations/types.schema";
11
+ import type { ValidationError } from "../storage.schema";
12
+ /**
13
+ * Schema for context passed to space creation handlers.
14
+ */
15
+ export declare const SpaceCreationContextSchema: z.ZodObject<{
16
+ /** The unique identifier for the space being created */
17
+ spaceId: z.ZodString;
18
+ /** Ethereum address of the user creating the space */
19
+ address: z.ZodString;
20
+ /** Chain ID for the creation context */
21
+ chainId: z.ZodNumber;
22
+ /** Host URL where the space will be created */
23
+ host: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ spaceId: string;
26
+ address: string;
27
+ chainId: number;
28
+ host: string;
29
+ }, {
30
+ spaceId: string;
31
+ address: string;
32
+ chainId: number;
33
+ host: string;
34
+ }>;
35
+ export type SpaceCreationContext = z.infer<typeof SpaceCreationContextSchema>;
36
+ /**
37
+ * Schema for ISpaceCreationHandler interface.
38
+ *
39
+ * Note: Since this is an interface with methods, we validate shape only.
40
+ * The actual implementation is not validated at runtime.
41
+ */
42
+ export declare const SpaceCreationHandlerSchema: z.ZodObject<{
43
+ /** Called when a new space needs to be created */
44
+ confirmSpaceCreation: z.ZodEffects<z.ZodUnknown, (context: SpaceCreationContext) => Promise<boolean>, unknown>;
45
+ /** Called after successful space creation (optional) */
46
+ onSpaceCreated: z.ZodOptional<z.ZodEffects<z.ZodUnknown, ((context: SpaceCreationContext) => void) | undefined, unknown>>;
47
+ /** Called if space creation fails (optional) */
48
+ onSpaceCreationFailed: z.ZodOptional<z.ZodEffects<z.ZodUnknown, ((context: SpaceCreationContext, error: Error) => void) | undefined, unknown>>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ confirmSpaceCreation: (context: SpaceCreationContext) => Promise<boolean>;
51
+ onSpaceCreated?: ((context: SpaceCreationContext) => void) | undefined;
52
+ onSpaceCreationFailed?: ((context: SpaceCreationContext, error: Error) => void) | undefined;
53
+ }, {
54
+ confirmSpaceCreation?: unknown;
55
+ onSpaceCreated?: unknown;
56
+ onSpaceCreationFailed?: unknown;
57
+ }>;
58
+ export type ISpaceCreationHandler = z.infer<typeof SpaceCreationHandlerSchema>;
59
+ /**
60
+ * Validates a SpaceCreationContext object and returns a Result.
61
+ */
62
+ export declare function validateSpaceCreationContext(data: unknown): Result<SpaceCreationContext, ValidationError>;
63
+ /**
64
+ * Validates an ISpaceCreationHandler object and returns a Result.
65
+ */
66
+ export declare function validateSpaceCreationHandler(data: unknown): Result<ISpaceCreationHandler, ValidationError>;
67
+ //# sourceMappingURL=spaceCreation.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCreation.schema.d.ts","sourceRoot":"","sources":["../../src/authorization/spaceCreation.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAezD;;GAEG;AACH,eAAO,MAAM,0BAA0B;IACrC,wDAAwD;;IAExD,sDAAsD;;IAEtD,wCAAwC;;IAExC,+CAA+C;;;;;;;;;;;;EAE/C,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM9E;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;IACrC,kDAAkD;+DAExB,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC;IAInE,wDAAwD;wEAI3B,oBAAoB,KAAK,IAAI;IAK1D,gDAAgD;+EAInB,oBAAoB,SAAS,KAAK,KAAK,IAAI;;oCAjB9C,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC;gCAQtC,oBAAoB,KAAK,IAAI;uCAS7B,oBAAoB,SAAS,KAAK,KAAK,IAAI;;;;;EAKxE,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM/E;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,OAAO,GACZ,MAAM,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAc/C;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,OAAO,GACZ,MAAM,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAchD"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Zod schemas for space creation handler types.
3
+ *
4
+ * These schemas provide runtime validation for space creation configuration.
5
+ * Types are derived from schemas using z.infer<>.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ import { z } from "zod";
10
+ // =============================================================================
11
+ // Shared Patterns
12
+ // =============================================================================
13
+ /**
14
+ * Ethereum address pattern (checksummed or lowercase).
15
+ */
16
+ const ethereumAddressPattern = /^0x[a-fA-F0-9]{40}$/;
17
+ // =============================================================================
18
+ // Space Creation Context Schema
19
+ // =============================================================================
20
+ /**
21
+ * Schema for context passed to space creation handlers.
22
+ */
23
+ export const SpaceCreationContextSchema = z.object({
24
+ /** The unique identifier for the space being created */
25
+ spaceId: z.string(),
26
+ /** Ethereum address of the user creating the space */
27
+ address: z.string().regex(ethereumAddressPattern, "Invalid Ethereum address"),
28
+ /** Chain ID for the creation context */
29
+ chainId: z.number().int().positive(),
30
+ /** Host URL where the space will be created */
31
+ host: z.string().url(),
32
+ });
33
+ // =============================================================================
34
+ // Space Creation Handler Schema
35
+ // =============================================================================
36
+ /**
37
+ * Schema for ISpaceCreationHandler interface.
38
+ *
39
+ * Note: Since this is an interface with methods, we validate shape only.
40
+ * The actual implementation is not validated at runtime.
41
+ */
42
+ export const SpaceCreationHandlerSchema = z.object({
43
+ /** Called when a new space needs to be created */
44
+ confirmSpaceCreation: z.unknown().refine((val) => typeof val === "function", { message: "Expected a confirmSpaceCreation function" }),
45
+ /** Called after successful space creation (optional) */
46
+ onSpaceCreated: z
47
+ .unknown()
48
+ .refine((val) => val === undefined || typeof val === "function", { message: "Expected an onSpaceCreated function or undefined" })
49
+ .optional(),
50
+ /** Called if space creation fails (optional) */
51
+ onSpaceCreationFailed: z
52
+ .unknown()
53
+ .refine((val) => val === undefined || typeof val === "function", { message: "Expected an onSpaceCreationFailed function or undefined" })
54
+ .optional(),
55
+ });
56
+ // =============================================================================
57
+ // Validation Helpers
58
+ // =============================================================================
59
+ /**
60
+ * Validates a SpaceCreationContext object and returns a Result.
61
+ */
62
+ export function validateSpaceCreationContext(data) {
63
+ const result = SpaceCreationContextSchema.safeParse(data);
64
+ if (!result.success) {
65
+ return {
66
+ ok: false,
67
+ error: {
68
+ code: "VALIDATION_ERROR",
69
+ message: result.error.message,
70
+ service: "authorization",
71
+ meta: { issues: result.error.issues },
72
+ },
73
+ };
74
+ }
75
+ return { ok: true, data: result.data };
76
+ }
77
+ /**
78
+ * Validates an ISpaceCreationHandler object and returns a Result.
79
+ */
80
+ export function validateSpaceCreationHandler(data) {
81
+ const result = SpaceCreationHandlerSchema.safeParse(data);
82
+ if (!result.success) {
83
+ return {
84
+ ok: false,
85
+ error: {
86
+ code: "VALIDATION_ERROR",
87
+ message: result.error.message,
88
+ service: "authorization",
89
+ meta: { issues: result.error.issues },
90
+ },
91
+ };
92
+ }
93
+ return { ok: true, data: result.data };
94
+ }
95
+ //# sourceMappingURL=spaceCreation.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCreation.schema.js","sourceRoot":"","sources":["../../src/authorization/spaceCreation.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAErD,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,wDAAwD;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,sDAAsD;IACtD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,sBAAsB,EAAE,0BAA0B,CAAC;IAC7E,wCAAwC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACpC,+CAA+C;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CACvB,CAAC,CAAC;AAIH,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CA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AC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAa;IAEb,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;gBAC7B,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE;aACtC;SACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tests for space creation schemas.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=spaceCreation.schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCreation.schema.test.d.ts","sourceRoot":"","sources":["../../src/authorization/spaceCreation.schema.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Tests for space creation schemas.
3
+ */
4
+ import { describe, it, expect } from "bun:test";
5
+ import { SpaceCreationContextSchema, SpaceCreationHandlerSchema, validateSpaceCreationContext, validateSpaceCreationHandler, } from "./spaceCreation.schema";
6
+ describe("SpaceCreationContextSchema", () => {
7
+ const validContext = {
8
+ spaceId: "space-123",
9
+ address: "0x1234567890123456789012345678901234567890",
10
+ chainId: 1,
11
+ host: "https://node.tinycloud.xyz",
12
+ };
13
+ it("should accept valid context", () => {
14
+ const result = SpaceCreationContextSchema.safeParse(validContext);
15
+ expect(result.success).toBe(true);
16
+ });
17
+ it("should accept lowercase address", () => {
18
+ const result = SpaceCreationContextSchema.safeParse({
19
+ ...validContext,
20
+ address: "0xabcdef1234567890123456789012345678901234",
21
+ });
22
+ expect(result.success).toBe(true);
23
+ });
24
+ it("should accept uppercase address", () => {
25
+ const result = SpaceCreationContextSchema.safeParse({
26
+ ...validContext,
27
+ address: "0xABCDEF1234567890123456789012345678901234",
28
+ });
29
+ expect(result.success).toBe(true);
30
+ });
31
+ it("should reject invalid Ethereum address", () => {
32
+ const result = SpaceCreationContextSchema.safeParse({
33
+ ...validContext,
34
+ address: "not-an-address",
35
+ });
36
+ expect(result.success).toBe(false);
37
+ });
38
+ it("should reject short address", () => {
39
+ const result = SpaceCreationContextSchema.safeParse({
40
+ ...validContext,
41
+ address: "0x1234",
42
+ });
43
+ expect(result.success).toBe(false);
44
+ });
45
+ it("should reject missing spaceId", () => {
46
+ const { spaceId, ...rest } = validContext;
47
+ expect(SpaceCreationContextSchema.safeParse(rest).success).toBe(false);
48
+ });
49
+ it("should reject missing address", () => {
50
+ const { address, ...rest } = validContext;
51
+ expect(SpaceCreationContextSchema.safeParse(rest).success).toBe(false);
52
+ });
53
+ it("should reject missing chainId", () => {
54
+ const { chainId, ...rest } = validContext;
55
+ expect(SpaceCreationContextSchema.safeParse(rest).success).toBe(false);
56
+ });
57
+ it("should reject missing host", () => {
58
+ const { host, ...rest } = validContext;
59
+ expect(SpaceCreationContextSchema.safeParse(rest).success).toBe(false);
60
+ });
61
+ it("should reject negative chainId", () => {
62
+ const result = SpaceCreationContextSchema.safeParse({
63
+ ...validContext,
64
+ chainId: -1,
65
+ });
66
+ expect(result.success).toBe(false);
67
+ });
68
+ it("should reject zero chainId", () => {
69
+ const result = SpaceCreationContextSchema.safeParse({
70
+ ...validContext,
71
+ chainId: 0,
72
+ });
73
+ expect(result.success).toBe(false);
74
+ });
75
+ it("should reject invalid host URL", () => {
76
+ const result = SpaceCreationContextSchema.safeParse({
77
+ ...validContext,
78
+ host: "not-a-url",
79
+ });
80
+ expect(result.success).toBe(false);
81
+ });
82
+ });
83
+ describe("SpaceCreationHandlerSchema", () => {
84
+ it("should accept handler with only confirmSpaceCreation", () => {
85
+ const handler = {
86
+ confirmSpaceCreation: async () => true,
87
+ };
88
+ const result = SpaceCreationHandlerSchema.safeParse(handler);
89
+ expect(result.success).toBe(true);
90
+ });
91
+ it("should accept handler with all methods", () => {
92
+ const handler = {
93
+ confirmSpaceCreation: async () => true,
94
+ onSpaceCreated: () => { },
95
+ onSpaceCreationFailed: () => { },
96
+ };
97
+ const result = SpaceCreationHandlerSchema.safeParse(handler);
98
+ expect(result.success).toBe(true);
99
+ });
100
+ it("should reject non-function confirmSpaceCreation", () => {
101
+ const handler = {
102
+ confirmSpaceCreation: "not a function",
103
+ };
104
+ const result = SpaceCreationHandlerSchema.safeParse(handler);
105
+ expect(result.success).toBe(false);
106
+ });
107
+ it("should reject missing confirmSpaceCreation", () => {
108
+ const handler = {
109
+ onSpaceCreated: () => { },
110
+ };
111
+ const result = SpaceCreationHandlerSchema.safeParse(handler);
112
+ expect(result.success).toBe(false);
113
+ });
114
+ it("should reject non-function onSpaceCreated", () => {
115
+ const handler = {
116
+ confirmSpaceCreation: async () => true,
117
+ onSpaceCreated: "not a function",
118
+ };
119
+ const result = SpaceCreationHandlerSchema.safeParse(handler);
120
+ expect(result.success).toBe(false);
121
+ });
122
+ it("should reject non-function onSpaceCreationFailed", () => {
123
+ const handler = {
124
+ confirmSpaceCreation: async () => true,
125
+ onSpaceCreationFailed: "not a function",
126
+ };
127
+ const result = SpaceCreationHandlerSchema.safeParse(handler);
128
+ expect(result.success).toBe(false);
129
+ });
130
+ });
131
+ describe("validateSpaceCreationContext", () => {
132
+ it("should return ok result for valid context", () => {
133
+ const result = validateSpaceCreationContext({
134
+ spaceId: "space-123",
135
+ address: "0x1234567890123456789012345678901234567890",
136
+ chainId: 1,
137
+ host: "https://node.tinycloud.xyz",
138
+ });
139
+ expect(result.ok).toBe(true);
140
+ if (result.ok) {
141
+ expect(result.data.spaceId).toBe("space-123");
142
+ }
143
+ });
144
+ it("should return error result for invalid context", () => {
145
+ const result = validateSpaceCreationContext({});
146
+ expect(result.ok).toBe(false);
147
+ if (!result.ok) {
148
+ expect(result.error.code).toBe("VALIDATION_ERROR");
149
+ expect(result.error.service).toBe("authorization");
150
+ }
151
+ });
152
+ });
153
+ describe("validateSpaceCreationHandler", () => {
154
+ it("should return ok result for valid handler", () => {
155
+ const result = validateSpaceCreationHandler({
156
+ confirmSpaceCreation: async () => true,
157
+ });
158
+ expect(result.ok).toBe(true);
159
+ });
160
+ it("should return error result for invalid handler", () => {
161
+ const result = validateSpaceCreationHandler({});
162
+ expect(result.ok).toBe(false);
163
+ if (!result.ok) {
164
+ expect(result.error.code).toBe("VALIDATION_ERROR");
165
+ }
166
+ });
167
+ });
168
+ //# sourceMappingURL=spaceCreation.schema.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spaceCreation.schema.test.js","sourceRoot":"","sources":["../../src/authorization/spaceCreation.schema.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAEhC,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,YAAY,GAAG;QACnB,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,4CAA4C;QACrD,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,4BAA4B;KACnC,CAAC;IAEF,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,MAAM,GAAG,0BAA0B,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAClE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,MAAM,GAAG,0BA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