@docstack/client 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.
Files changed (60) hide show
  1. package/lib/core/attribute.d.ts +4 -4
  2. package/lib/core/class.d.ts +13 -12
  3. package/lib/core/crypto-engine/index.d.ts +5 -5
  4. package/lib/core/query-engine/executor.d.ts +1 -1
  5. package/lib/core/query-engine/index.d.ts +3 -3
  6. package/lib/core/stack.d.ts +6 -6
  7. package/lib/index.d.ts +1 -1
  8. package/lib/index.js +7530 -7536
  9. package/lib/index.js.map +1 -1
  10. package/lib/index.umd.js +8256 -0
  11. package/lib/utils/index.d.ts +1 -1
  12. package/package.json +11 -4
  13. package/lib/core/attribute.js +0 -296
  14. package/lib/core/attribute.js.map +0 -1
  15. package/lib/core/class.js +0 -540
  16. package/lib/core/class.js.map +0 -1
  17. package/lib/core/crypto-engine/index.js +0 -130
  18. package/lib/core/crypto-engine/index.js.map +0 -1
  19. package/lib/core/crypto-engine/utils.js +0 -76
  20. package/lib/core/crypto-engine/utils.js.map +0 -1
  21. package/lib/core/datamodel/index.js +0 -1186
  22. package/lib/core/datamodel/index.js.map +0 -1
  23. package/lib/core/domain.js +0 -285
  24. package/lib/core/domain.js.map +0 -1
  25. package/lib/core/index.js +0 -379
  26. package/lib/core/index.js.map +0 -1
  27. package/lib/core/job-engine/index.js +0 -116
  28. package/lib/core/job-engine/index.js.map +0 -1
  29. package/lib/core/policy-engine/index.js +0 -150
  30. package/lib/core/policy-engine/index.js.map +0 -1
  31. package/lib/core/query-engine/accumulators.js +0 -258
  32. package/lib/core/query-engine/accumulators.js.map +0 -1
  33. package/lib/core/query-engine/evaluator.js +0 -179
  34. package/lib/core/query-engine/evaluator.js.map +0 -1
  35. package/lib/core/query-engine/executor.js +0 -405
  36. package/lib/core/query-engine/executor.js.map +0 -1
  37. package/lib/core/query-engine/index.js +0 -4
  38. package/lib/core/query-engine/index.js.map +0 -1
  39. package/lib/core/query-engine/parser.js +0 -515
  40. package/lib/core/query-engine/parser.js.map +0 -1
  41. package/lib/core/query-engine/planner.js +0 -330
  42. package/lib/core/query-engine/planner.js.map +0 -1
  43. package/lib/core/stack.js +0 -1507
  44. package/lib/core/stack.js.map +0 -1
  45. package/lib/core/test-utils/docstack.js +0 -222
  46. package/lib/core/test-utils/docstack.js.map +0 -1
  47. package/lib/core/trigger/index.js +0 -81
  48. package/lib/core/trigger/index.js.map +0 -1
  49. package/lib/plugins/pouchdb.js +0 -403
  50. package/lib/plugins/pouchdb.js.map +0 -1
  51. package/lib/utils/crypto/index.js +0 -34
  52. package/lib/utils/crypto/index.js.map +0 -1
  53. package/lib/utils/index.js +0 -58
  54. package/lib/utils/index.js.map +0 -1
  55. package/lib/utils/logger/index.js +0 -20
  56. package/lib/utils/logger/index.js.map +0 -1
  57. package/lib/utils/logger/transport.js +0 -28
  58. package/lib/utils/logger/transport.js.map +0 -1
  59. package/lib/workers/dataModel.js +0 -48
  60. package/lib/workers/dataModel.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import z, { ZodType } from "zod";
1
+ import { SafeParseReturnType } from "zod";
2
2
  import Class from "./class.js";
3
3
  import { Attribute as Attribute_, AttributeModel, AttributeType, AttributeTypeConfig } from "@docstack/shared";
4
4
  /**
@@ -35,7 +35,7 @@ declare class Attribute extends Attribute_ {
35
35
  /** The underlying AttributeModel containing type and configuration. */
36
36
  model: AttributeModel;
37
37
  /** Zod schema for runtime validation of this field. */
38
- field: ZodType;
38
+ field: any;
39
39
  /** Reference to the parent Class that owns this attribute. */
40
40
  class: Class | null;
41
41
  /** Default value to use when the field is not provided. */
@@ -120,7 +120,7 @@ declare class Attribute extends Attribute_ {
120
120
  * }
121
121
  * ```
122
122
  */
123
- validate: (data: any) => Promise<z.ZodSafeParseResult<unknown>>;
123
+ validate: (data: any) => Promise<SafeParseReturnType<any, any>>;
124
124
  /**
125
125
  * Adds an attribute to its parent class and persists to the database.
126
126
  * Used internally by {@link Attribute.create}.
@@ -138,7 +138,7 @@ declare class Attribute extends Attribute_ {
138
138
  * @returns Object with attribute name as key and default/null value
139
139
  */
140
140
  getEmpty: () => {
141
- [x: string]: unknown;
141
+ [x: string]: any;
142
142
  };
143
143
  /**
144
144
  * Returns the attribute name.
@@ -1,9 +1,10 @@
1
1
  import { Class as Class_, TriggerModel } from "@docstack/shared";
2
- import { Stack, ClassModel, AttributeModel, Document } from "@docstack/shared";
3
- import Attribute from "./attribute.js";
2
+ import { ClassModel, AttributeModel, Document } from "@docstack/shared";
3
+ import Attribute from "./attribute";
4
4
  import { Logger } from 'winston';
5
- import { Trigger } from "./trigger/index.js";
5
+ import { Trigger } from "./trigger/index";
6
6
  import { z } from "zod";
7
+ import ClientStack from "./stack";
7
8
  /**
8
9
  * Represents a data class (schema definition) in the DocStack database.
9
10
  *
@@ -30,7 +31,7 @@ import { z } from "zod";
30
31
  */
31
32
  declare class Class extends Class_ {
32
33
  /** Reference to the parent stack instance. */
33
- stack: Stack | undefined;
34
+ stack: ClientStack | undefined;
34
35
  /** The name of this class (e.g., 'Task', 'User'). */
35
36
  name: string;
36
37
  /** The class type (e.g., 'class', '~self'). */
@@ -44,7 +45,7 @@ declare class Class extends Class_ {
44
45
  /** The raw schema definition from the ClassModel. */
45
46
  schema: ClassModel["schema"];
46
47
  /** Zod schema for runtime validation of document data. */
47
- schemaZOD: z.ZodObject;
48
+ schemaZOD: z.ZodObject<any, any, any>;
48
49
  /** The unique identifier for this class (e.g., 'Task', 'Class-123'). */
49
50
  id?: string;
50
51
  /** The underlying ClassModel document. */
@@ -57,7 +58,7 @@ declare class Class extends Class_ {
57
58
  triggers: Trigger[];
58
59
  private constructor();
59
60
  build: () => Promise<Class>;
60
- init: (stack: Stack | null, id: string, name: string, type: ClassModel["~class"], description?: string, schema?: ClassModel["schema"]) => void;
61
+ init: (stack: ClientStack | null, id: string, name: string, type: ClassModel["~class"], description?: string, schema?: ClassModel["schema"]) => void;
61
62
  /**
62
63
  * Gets a Class instance without persisting it to the database.
63
64
  * Use this for working with existing class models or for testing.
@@ -71,7 +72,7 @@ declare class Class extends Class_ {
71
72
  * @param schema - Initial schema definition
72
73
  * @returns A new Class instance (not persisted)
73
74
  */
74
- static get: (stack: Stack, id: string, name: string, type: ClassModel["~class"], description?: string, schema?: ClassModel["schema"]) => Class;
75
+ static get: (stack: ClientStack, id: string, name: string, type: ClassModel["~class"], description?: string, schema?: ClassModel["schema"]) => Class;
75
76
  /**
76
77
  * Creates a new class and persists it to the database.
77
78
  * This is the primary factory method for creating new classes.
@@ -88,7 +89,7 @@ declare class Class extends Class_ {
88
89
  * const userClass = await Class.create(stack, 'User', 'class', 'Application users');
89
90
  * ```
90
91
  */
91
- static create: (stack: Stack, name: string, type: ClassModel["~class"], description?: string, schema?: ClassModel["schema"]) => Promise<Class>;
92
+ static create: (stack: ClientStack, name: string, type: ClassModel["~class"], description?: string, schema?: ClassModel["schema"]) => Promise<Class>;
92
93
  /**
93
94
  * Builds a Class instance from an existing ClassModel document.
94
95
  * Hydrates attributes and triggers from the model.
@@ -97,7 +98,7 @@ declare class Class extends Class_ {
97
98
  * @param classModel - The ClassModel document from the database
98
99
  * @returns The hydrated Class instance
99
100
  */
100
- static buildFromModel: (stack: Stack, classModel: ClassModel) => Promise<Class>;
101
+ static buildFromModel: (stack: ClientStack, classModel: ClassModel) => Promise<Class>;
101
102
  /**
102
103
  * Fetches a class by its document ID.
103
104
  *
@@ -106,7 +107,7 @@ declare class Class extends Class_ {
106
107
  * @returns The Class instance
107
108
  * @throws Error if the class is not found
108
109
  */
109
- static fetchById: (stack: Stack, classId: string) => Promise<Class>;
110
+ static fetchById: (stack: ClientStack, classId: string) => Promise<Class>;
110
111
  /**
111
112
  * Fetches a class by its name.
112
113
  * This is the most common way to retrieve an existing class.
@@ -123,7 +124,7 @@ declare class Class extends Class_ {
123
124
  * }
124
125
  * ```
125
126
  */
126
- static fetch: (stack: Stack, className: string) => Promise<Class>;
127
+ static fetch: (stack: ClientStack, className: string) => Promise<Class>;
127
128
  uniqueCheck: (doc: Document) => Promise<boolean>;
128
129
  bulkUniqueCheck: (pKs: string[]) => Promise<boolean>;
129
130
  /**
@@ -137,7 +138,7 @@ declare class Class extends Class_ {
137
138
  }) => Promise<boolean>;
138
139
  setId: (id: string) => void;
139
140
  getName: () => string;
140
- getStack: () => Stack;
141
+ getStack: () => ClientStack;
141
142
  getDescription: () => string;
142
143
  getType: () => "class" | "~self";
143
144
  getId: () => string;
@@ -1,7 +1,7 @@
1
1
  import { Document } from "@docstack/shared";
2
- import Class from "../class.js";
3
- import type ClientStack from "../stack.js";
4
- import { EncryptedPayload } from "./utils.js";
2
+ import Class from "../class";
3
+ import type ClientStack from "../stack";
4
+ import { EncryptedPayload } from "./utils";
5
5
  /**
6
6
  * Engine for handling document-level encryption and decryption.
7
7
  *
@@ -117,5 +117,5 @@ export declare class CryptoEngine {
117
117
  */
118
118
  decryptDocument(document: Document, classObj?: Class, encryptedKeys?: string[]): Promise<void>;
119
119
  }
120
- export type { EncryptedPayload } from "./utils.js";
121
- export { wrapDocumentKey, unwrapDocumentKey } from "./utils.js";
120
+ export type { EncryptedPayload } from "./utils";
121
+ export { wrapDocumentKey, unwrapDocumentKey } from "./utils";
@@ -1,4 +1,4 @@
1
- import ClientStack from '../stack.js';
1
+ import ClientStack from '../stack';
2
2
  /**
3
3
  * Executes a query plan against the in-memory database.
4
4
  * This function orchestrates fetching data, joining, filtering, aggregating,
@@ -1,4 +1,4 @@
1
- export { parse } from "./parser.js";
1
+ export { parse } from "./parser";
2
2
  export type { SelectAST, UnionAST } from "@docstack/shared";
3
- export { createPlan } from "./planner.js";
4
- export { executePlan } from "./executor.js";
3
+ export { createPlan } from "./planner";
4
+ export { executePlan } from "./executor";
@@ -1,11 +1,11 @@
1
- import Class from "./class.js";
2
- import Domain from "./domain.js";
1
+ import Class from "./class";
2
+ import Domain from "./domain";
3
3
  import { Stack, StackOptions, AuthSessionProof, ClientCredentials, CachedClass, ClassModelPropagationStart, ClassModelPropagationComplete, CachedDomain, DomainModel } from "@docstack/shared";
4
4
  import { SystemDoc, Patch, ClassModel, Document, RelationDocument } from "@docstack/shared";
5
- import type { SelectAST, UnionAST } from "./query-engine/index.js";
6
- import { JobEngine } from "./job-engine/index.js";
7
- import { PolicyEngine } from "./policy-engine/index.js";
8
- import { CryptoEngine } from "./crypto-engine/index.js";
5
+ import type { SelectAST, UnionAST } from "./query-engine";
6
+ import { JobEngine } from "./job-engine";
7
+ import { PolicyEngine } from "./policy-engine";
8
+ import { CryptoEngine } from "./crypto-engine";
9
9
  export declare const BASE_SCHEMA: ClassModel["schema"];
10
10
  export declare const CLASS_SCHEMA: ClassModel["schema"];
11
11
  /**
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { DocStack } from "./core/";
2
- export { ClientStack, Class, Domain, Attribute, Trigger, DocStack } from "./core/index.js";
2
+ export { ClientStack, Class, Domain, Attribute, Trigger, DocStack } from "./core/";
3
3
  export type { AttributeType, DocstackReady, StackConfig, StackOptions } from "@docstack/shared";
4
4
  export default DocStack;