@synapseone/sdk 0.8.0 → 0.9.0-dev.78

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/dist/base.d.ts CHANGED
@@ -104,6 +104,73 @@ export declare function objectToData(obj: Record<string, unknown> | null | undef
104
104
  export declare class BaseService {
105
105
  private readonly http;
106
106
  constructor(http: HttpClient);
107
+ graphUpsertNodes(collection: string, nodes: unknown[]): Promise<{
108
+ nodes: unknown[];
109
+ }>;
110
+ graphUpsertEdges(collection: string, edges: unknown[]): Promise<{
111
+ edges: unknown[];
112
+ }>;
113
+ graphNode(collection: string, id: string, opts?: {
114
+ depth?: number;
115
+ limit?: number;
116
+ }): Promise<{
117
+ node: unknown;
118
+ nodes: unknown[];
119
+ edges: unknown[];
120
+ next?: boolean;
121
+ }>;
122
+ graphQuery(collection: string, opts: {
123
+ start: string[];
124
+ depth?: number;
125
+ limit?: number;
126
+ edgeTypes?: string[];
127
+ }): Promise<{
128
+ nodes: unknown[];
129
+ edges: unknown[];
130
+ next?: boolean;
131
+ }>;
132
+ graphStats(collection: string): Promise<{
133
+ nodes: number;
134
+ edges: number;
135
+ }>;
136
+ graphDeleteNode(collection: string, id: string): Promise<{
137
+ ok: boolean;
138
+ id: string;
139
+ }>;
140
+ geoUpsert(collection: string, features: unknown[]): Promise<{
141
+ features: unknown[];
142
+ }>;
143
+ geoList(collection: string, opts?: {
144
+ bbox?: string;
145
+ limit?: number;
146
+ }): Promise<{
147
+ type: string;
148
+ features: unknown[];
149
+ }>;
150
+ geoNear(collection: string, opts: {
151
+ lat: number;
152
+ lng: number;
153
+ radiusMeters: number;
154
+ limit?: number;
155
+ }): Promise<{
156
+ type: string;
157
+ features: unknown[];
158
+ }>;
159
+ geoWithin(collection: string, opts: {
160
+ geometry: Record<string, unknown>;
161
+ limit?: number;
162
+ }): Promise<{
163
+ type: string;
164
+ features: unknown[];
165
+ }>;
166
+ geoStats(collection: string): Promise<{
167
+ features: number;
168
+ extent?: unknown;
169
+ }>;
170
+ geoDelete(collection: string, id: string): Promise<{
171
+ ok: boolean;
172
+ id: string;
173
+ }>;
107
174
  /** Bind a collection name (plus optional model/mapping) for typed use. */
108
175
  collection<T = Record<string, unknown>>(name: string, opts?: BaseCollectionOptions<T>): BaseCollection<T>;
109
176
  listCollections(query?: {
package/dist/base.js CHANGED
@@ -101,6 +101,62 @@ class BaseService {
101
101
  constructor(http) {
102
102
  this.http = http;
103
103
  }
104
+ // ---- graph (property graph per collection) ----
105
+ graphUpsertNodes(collection, nodes) {
106
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/graph/nodes`, {
107
+ method: 'POST',
108
+ body: JSON.stringify({ nodes }),
109
+ });
110
+ }
111
+ graphUpsertEdges(collection, edges) {
112
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/graph/edges`, {
113
+ method: 'POST',
114
+ body: JSON.stringify({ edges }),
115
+ });
116
+ }
117
+ graphNode(collection, id, opts = {}) {
118
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/graph/nodes/${encodeURIComponent(id)}${queryString({ depth: opts.depth, limit: opts.limit })}`);
119
+ }
120
+ graphQuery(collection, opts) {
121
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/graph/query`, {
122
+ method: 'POST',
123
+ body: JSON.stringify(opts),
124
+ });
125
+ }
126
+ graphStats(collection) {
127
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/graph/stats`);
128
+ }
129
+ graphDeleteNode(collection, id) {
130
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/graph/nodes/${encodeURIComponent(id)}`, { method: 'DELETE' });
131
+ }
132
+ // ---- GIS (PostGIS GeoJSON per collection) ----
133
+ geoUpsert(collection, features) {
134
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/geo/features`, {
135
+ method: 'POST',
136
+ body: JSON.stringify({ features }),
137
+ });
138
+ }
139
+ geoList(collection, opts = {}) {
140
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/geo/features${queryString({ bbox: opts.bbox, limit: opts.limit })}`);
141
+ }
142
+ geoNear(collection, opts) {
143
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/geo/near`, {
144
+ method: 'POST',
145
+ body: JSON.stringify(opts),
146
+ });
147
+ }
148
+ geoWithin(collection, opts) {
149
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/geo/within`, {
150
+ method: 'POST',
151
+ body: JSON.stringify(opts),
152
+ });
153
+ }
154
+ geoStats(collection) {
155
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/geo/stats`);
156
+ }
157
+ geoDelete(collection, id) {
158
+ return this.http.req(`/v1/base/collections/${encodeURIComponent(collection)}/geo/features/${encodeURIComponent(id)}`, { method: 'DELETE' });
159
+ }
104
160
  /** Bind a collection name (plus optional model/mapping) for typed use. */
105
161
  collection(name, opts = {}) {
106
162
  return new BaseCollection(this, name, opts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapseone/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0-dev.78",
4
4
  "license": "Apache-2.0",
5
5
  "description": "synapseone SDK for JavaScript/TypeScript",
6
6
  "homepage": "https://synapseone.space",