@nymphjs/client 1.0.0-beta.97 → 1.0.0-beta.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.99](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.98...v1.0.0-beta.99) (2025-11-26)
7
+
8
+ ### Features
9
+
10
+ - add full-text-search, but this is interim and will be redesigned ([56333db](https://github.com/sciactive/nymphjs/commit/56333dbe6a25755baed4e108ba4d71b3187fe8d0))
11
+
12
+ # [1.0.0-beta.98](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.97...v1.0.0-beta.98) (2025-10-24)
13
+
14
+ **Note:** Version bump only for package @nymphjs/client
15
+
6
16
  # [1.0.0-beta.97](https://github.com/sciactive/nymphjs/compare/v1.0.0-beta.96...v1.0.0-beta.97) (2025-10-04)
7
17
 
8
18
  **Note:** Version bump only for package @nymphjs/client
@@ -110,6 +110,8 @@ type PrimitiveSelector = {
110
110
  '!equal'?: PrimitiveSelector['equal'];
111
111
  contain?: [string, any];
112
112
  '!contain'?: PrimitiveSelector['contain'];
113
+ search?: [string, string];
114
+ '!search'?: PrimitiveSelector['search'];
113
115
  match?: [string, string];
114
116
  '!match'?: PrimitiveSelector['match'];
115
117
  imatch?: [string, string];
@@ -147,6 +149,8 @@ export type Selector = {
147
149
  '!equal'?: Clause<OrWithTime<PrimitiveSelector['equal']>>;
148
150
  contain?: Clause<OrWithTime<PrimitiveSelector['contain']>>;
149
151
  '!contain'?: Clause<OrWithTime<PrimitiveSelector['contain']>>;
152
+ search?: Clause<PrimitiveSelector['search']>;
153
+ '!search'?: Clause<PrimitiveSelector['search']>;
150
154
  match?: Clause<PrimitiveSelector['match']>;
151
155
  '!match'?: Clause<PrimitiveSelector['match']>;
152
156
  imatch?: Clause<PrimitiveSelector['imatch']>;
@@ -0,0 +1,155 @@
1
+ import type Nymph from './Nymph';
2
+ import { EntityConstructor, EntityData, EntityInterface, EntityJson, EntityPatch, EntityReference } from './Entity.types';
3
+ export type EntityDataType<T> = T extends Entity<infer DataType> ? DataType : never;
4
+ export type EntityInstanceType<T extends EntityConstructor> = T extends new () => infer E ? E & EntityDataType<E> : never;
5
+ export default class Entity<T extends EntityData = EntityData> implements EntityInterface {
6
+ /**
7
+ * The instance of Nymph to use for queries.
8
+ */
9
+ static nymph: Nymph;
10
+ /**
11
+ * The lookup name for this entity.
12
+ *
13
+ * This is used for reference arrays (and sleeping references) and server
14
+ * requests.
15
+ */
16
+ static class: string;
17
+ /**
18
+ * The instance of Nymph to use for queries.
19
+ */
20
+ $nymph: Nymph;
21
+ /**
22
+ * The entity's Globally Unique ID.
23
+ */
24
+ guid: string | null;
25
+ /**
26
+ * The creation date of the entity as a high precision Unix timestamp.
27
+ */
28
+ cdate: number | null;
29
+ /**
30
+ * The modified date of the entity as a high precision Unix timestamp.
31
+ */
32
+ mdate: number | null;
33
+ /**
34
+ * Array of the entity's tags.
35
+ */
36
+ tags: string[];
37
+ /**
38
+ * Array of the entity's original tags (for patch).
39
+ */
40
+ protected $originalTags: string[];
41
+ /**
42
+ * A map of props to whether they're dirty (for patch).
43
+ */
44
+ protected $dirty: {
45
+ [k: string]: boolean;
46
+ };
47
+ /**
48
+ * The data proxy handler.
49
+ */
50
+ protected $dataHandler: Object;
51
+ /**
52
+ * The actual data store.
53
+ */
54
+ protected $dataStore: T;
55
+ /**
56
+ * The data proxy object.
57
+ */
58
+ protected $data: T;
59
+ /**
60
+ * Whether this instance is a sleeping reference.
61
+ */
62
+ protected $isASleepingReference: boolean;
63
+ /**
64
+ * The reference to use to wake.
65
+ */
66
+ protected $sleepingReference: EntityReference | null;
67
+ /**
68
+ * A promise that resolved when the entity's data is wake.
69
+ */
70
+ protected $wakePromise: Promise<Entity<T>> | null;
71
+ /**
72
+ * Initialize an entity.
73
+ */
74
+ constructor(..._rest: any[]);
75
+ /**
76
+ * Create or retrieve a new entity instance.
77
+ *
78
+ * Note that this will always return an entity, even if the GUID is not found.
79
+ *
80
+ * @param guid An optional GUID to retrieve.
81
+ */
82
+ static factory<E extends Entity>(this: {
83
+ new (): E;
84
+ }, guid?: string): Promise<E & EntityDataType<E>>;
85
+ /**
86
+ * Create a new entity instance.
87
+ */
88
+ static factorySync<E extends Entity>(this: {
89
+ new (): E;
90
+ }): E & EntityDataType<E>;
91
+ /**
92
+ * Create a new sleeping reference instance.
93
+ *
94
+ * Sleeping references won't retrieve their data from the server until they
95
+ * are readied with `$wake()` or a parent's `$wakeAll()`.
96
+ *
97
+ * @param reference The Nymph Entity Reference to use to wake.
98
+ * @returns The new instance.
99
+ */
100
+ static factoryReference<E extends Entity>(this: {
101
+ new (): E;
102
+ }, reference: EntityReference): E & EntityDataType<E>;
103
+ /**
104
+ * Call a static method on the server version of this entity.
105
+ *
106
+ * @param method The name of the method.
107
+ * @param params The parameters to call the method with.
108
+ * @returns The value that the method on the server returned.
109
+ */
110
+ static serverCallStatic(method: string, params: Iterable<any>): Promise<any>;
111
+ /**
112
+ * Call a static iterator method on the server version of this entity.
113
+ *
114
+ * @param method The name of the method.
115
+ * @param params The parameters to call the method with.
116
+ * @returns An iterator that iterates over values that the method on the server yields.
117
+ */
118
+ static serverCallStaticIterator(method: string, params: Iterable<any>): Promise<import("./HttpRequester").AbortableAsyncIterator<any>>;
119
+ toJSON(): EntityJson;
120
+ $init(entityJson: EntityJson | null): Entity<T>;
121
+ $addTag(...tags: string[]): void;
122
+ $arraySearch(array: any[], strict?: boolean): number;
123
+ $delete(): Promise<boolean>;
124
+ $equals(object: any): boolean;
125
+ $getPatch(): EntityPatch;
126
+ $hasTag(...tags: string[]): boolean;
127
+ $inArray(array: any[], strict?: boolean): boolean;
128
+ $is(object: any): boolean;
129
+ $patch(): Promise<boolean>;
130
+ /**
131
+ * Check if this is a sleeping reference and throw an error if so.
132
+ */
133
+ protected $check(): void;
134
+ /**
135
+ * Check if this is a sleeping reference.
136
+ */
137
+ $asleep(): boolean;
138
+ /**
139
+ * Wake from a sleeping reference.
140
+ */
141
+ $wake(): Promise<Entity<T>>;
142
+ $wakeAll(level?: number): Promise<Entity<T>>;
143
+ protected $referenceSleep(reference: EntityReference): void;
144
+ $refresh(): Promise<boolean | 0>;
145
+ $removeTag(...tags: string[]): void;
146
+ $save(): Promise<boolean>;
147
+ $serverCall(method: string, params: Iterable<any>, stateless?: boolean): Promise<any>;
148
+ $toReference(): EntityReference | EntityInterface;
149
+ }
150
+ export declare class EntityIsSleepingReferenceError extends Error {
151
+ constructor(message: string);
152
+ }
153
+ export declare class InvalidStateError extends Error {
154
+ constructor(message: string);
155
+ }