@snowtop/ent 0.1.0-alpha140 → 0.1.0-alpha142

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.
@@ -28,10 +28,10 @@ export declare class DeleteNodeOperation implements DataOperation {
28
28
  performWrite(queryer: Queryer, context?: Context): Promise<void>;
29
29
  performWriteSync(queryer: SyncQueryer, context?: Context): void;
30
30
  }
31
- export declare class RawQueryOperation implements DataOperation {
32
- builder: Builder<Ent>;
31
+ export declare class RawQueryOperation<TEnt extends Ent<TViewer>, TViewer extends Viewer = Viewer> implements DataOperation<TEnt> {
32
+ builder: Builder<TEnt, TViewer>;
33
33
  private queries;
34
- constructor(builder: Builder<Ent>, queries: (string | parameterizedQueryOptions)[]);
34
+ constructor(builder: Builder<TEnt, TViewer>, queries: (string | parameterizedQueryOptions)[]);
35
35
  performWrite(queryer: Queryer, context?: Context): Promise<void>;
36
36
  performWriteSync(queryer: SyncQueryer, context?: Context): void;
37
37
  }
@@ -1,4 +1,5 @@
1
1
  import { ID, Data, Ent, Viewer, LoadEntOptions, CreateRowOptions } from "../core/base";
2
+ import { parameterizedQueryOptions } from "../core/ent";
2
3
  import { SchemaInputType, FieldInfoMap } from "../schema/schema";
3
4
  import { Changeset, ChangesetOptions, Executor } from "../action/action";
4
5
  import { AssocEdgeInputOptions, DataOperation, AssocEdgeOptions } from "./operations";
@@ -118,6 +119,7 @@ export declare class EntChangeset<T extends Ent> implements Changeset {
118
119
  private _executor;
119
120
  constructor(viewer: Viewer, builder: Builder<T>, placeholderID: ID, conditionalOverride: boolean, operations: DataOperation[], dependencies?: Map<ID, Builder<Ent<Viewer<Ent<any> | null, ID | null>>, Viewer<Ent<any> | null, ID | null>, Ent<Viewer<Ent<any> | null, ID | null>> | null>> | undefined, changesets?: Changeset[] | undefined, options?: OrchestratorOptions<T, Data, Viewer<Ent<any> | null, ID | null>, MaybeNull<T>> | undefined);
120
121
  static changesetFrom(builder: Builder<any, any, any>, ops: DataOperation[]): EntChangeset<any>;
122
+ static changesetFromQueries(builder: Builder<any, any, any>, queries: Array<string | parameterizedQueryOptions>): EntChangeset<any>;
121
123
  executor(): Executor;
122
124
  }
123
125
  export {};
@@ -37,6 +37,7 @@ const logger_1 = require("../core/logger");
37
37
  const memoizee_1 = __importDefault(require("memoizee"));
38
38
  const clause = __importStar(require("../core/clause"));
39
39
  const util_1 = require("util");
40
+ const operations_2 = require("./operations");
40
41
  var edgeDirection;
41
42
  (function (edgeDirection) {
42
43
  edgeDirection[edgeDirection["inboundEdge"] = 0] = "inboundEdge";
@@ -883,6 +884,11 @@ class EntChangeset {
883
884
  // need unique placeholderID different from the builder. see comment above EntChangeset
884
885
  `$ent.idPlaceholderID$ ${randomNum()}-${builder.ent.name}`, false, ops);
885
886
  }
887
+ static changesetFromQueries(builder, queries) {
888
+ return new EntChangeset(builder.viewer, builder,
889
+ // need unique placeholderID different from the builder. see comment above EntChangeset
890
+ `$ent.idPlaceholderID$ ${randomNum()}-${builder.ent.name}`, false, [new operations_2.RawQueryOperation(builder, queries)]);
891
+ }
886
892
  executor() {
887
893
  if (this._executor) {
888
894
  return this._executor;
package/core/viewer.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ID, Ent, Viewer, Context } from "./base";
2
2
  export declare class LoggedOutViewer implements Viewer {
3
3
  context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined;
4
+ marker: string;
4
5
  constructor(context?: Context<Viewer<Ent<any> | null, ID | null>> | undefined);
5
6
  viewerID: null;
6
7
  viewer(): Promise<null>;
@@ -12,6 +13,7 @@ export interface IDViewerOptions {
12
13
  ent?: Ent | null;
13
14
  }
14
15
  export declare class IDViewer implements Viewer {
16
+ marker: string;
15
17
  viewerID: ID;
16
18
  private ent;
17
19
  context?: Context;
package/core/viewer.js CHANGED
@@ -4,6 +4,7 @@ exports.IDViewer = exports.LoggedOutViewer = void 0;
4
4
  class LoggedOutViewer {
5
5
  constructor(context) {
6
6
  this.context = context;
7
+ this.marker = "loggedout";
7
8
  this.viewerID = null;
8
9
  }
9
10
  async viewer() {
@@ -16,6 +17,7 @@ class LoggedOutViewer {
16
17
  exports.LoggedOutViewer = LoggedOutViewer;
17
18
  class IDViewer {
18
19
  constructor(args, opts) {
20
+ this.marker = "idviewer";
19
21
  this.ent = null;
20
22
  if (typeof args === "object") {
21
23
  this.viewerID = args.viewerID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha140",
3
+ "version": "0.1.0-alpha142",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -205,6 +205,7 @@ export interface FieldEdge {
205
205
  enforceSchema?: boolean;
206
206
  getLoaderInfoFromSchema?: getLoaderInfoFn;
207
207
  disableBuilderType?: boolean;
208
+ edgeConstName?: string;
208
209
  }
209
210
  interface PrivateOptions {
210
211
  exposeToActions?: boolean;
@@ -244,6 +245,7 @@ export interface PolymorphicOptions {
244
245
  hideFromInverseGraphQL?: boolean;
245
246
  disableBuilderType?: boolean;
246
247
  serverDefault?: any;
248
+ edgeConstName?: string;
247
249
  }
248
250
  export interface Field extends FieldOptions {
249
251
  type: Type;