@prisma-next/target-mongo 0.4.0-dev.9 → 0.4.2

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.
@@ -1,76 +1,77 @@
1
1
  import { MongoSchemaCollection, MongoSchemaIndex } from "@prisma-next/mongo-schema-ir";
2
- import { CollModOptions, CreateCollectionOptions, CreateIndexOptions, MongoIndexKey } from "@prisma-next/mongo-query-ast/control";
3
- import { MigrationOperationClass } from "@prisma-next/framework-components/control";
2
+ import { CollModOptions, CreateCollectionOptions, CreateIndexOptions, MongoIndexKey, MongoMigrationPlanOperation } from "@prisma-next/mongo-query-ast/control";
3
+ import { ImportRequirement, TsExpression } from "@prisma-next/ts-render";
4
+ import { MigrationOperationClass, OpFactoryCall } from "@prisma-next/framework-components/control";
4
5
 
5
6
  //#region src/core/op-factory-call.d.ts
7
+
6
8
  interface CollModMeta {
7
9
  readonly id?: string;
8
10
  readonly label?: string;
9
11
  readonly operationClass?: MigrationOperationClass;
10
12
  }
11
- interface OpFactoryCallVisitor<R> {
12
- createIndex(call: CreateIndexCall): R;
13
- dropIndex(call: DropIndexCall): R;
14
- createCollection(call: CreateCollectionCall): R;
15
- dropCollection(call: DropCollectionCall): R;
16
- collMod(call: CollModCall): R;
17
- }
18
- declare abstract class OpFactoryCallNode {
19
- abstract readonly factory: string;
13
+ declare abstract class OpFactoryCallNode extends TsExpression implements OpFactoryCall {
14
+ abstract readonly factoryName: string;
20
15
  abstract readonly operationClass: MigrationOperationClass;
21
16
  abstract readonly label: string;
22
- abstract accept<R>(visitor: OpFactoryCallVisitor<R>): R;
17
+ abstract toOp(): MongoMigrationPlanOperation;
18
+ importRequirements(): readonly ImportRequirement[];
23
19
  protected freeze(): void;
24
20
  }
25
21
  declare class CreateIndexCall extends OpFactoryCallNode {
26
- readonly factory: "createIndex";
22
+ readonly factoryName: "createIndex";
27
23
  readonly operationClass: "additive";
28
24
  readonly collection: string;
29
25
  readonly keys: ReadonlyArray<MongoIndexKey>;
30
26
  readonly options: CreateIndexOptions | undefined;
31
27
  readonly label: string;
32
28
  constructor(collection: string, keys: ReadonlyArray<MongoIndexKey>, options?: CreateIndexOptions);
33
- accept<R>(visitor: OpFactoryCallVisitor<R>): R;
29
+ toOp(): MongoMigrationPlanOperation;
30
+ renderTypeScript(): string;
34
31
  }
35
32
  declare class DropIndexCall extends OpFactoryCallNode {
36
- readonly factory: "dropIndex";
33
+ readonly factoryName: "dropIndex";
37
34
  readonly operationClass: "destructive";
38
35
  readonly collection: string;
39
36
  readonly keys: ReadonlyArray<MongoIndexKey>;
40
37
  readonly label: string;
41
38
  constructor(collection: string, keys: ReadonlyArray<MongoIndexKey>);
42
- accept<R>(visitor: OpFactoryCallVisitor<R>): R;
39
+ toOp(): MongoMigrationPlanOperation;
40
+ renderTypeScript(): string;
43
41
  }
44
42
  declare class CreateCollectionCall extends OpFactoryCallNode {
45
- readonly factory: "createCollection";
43
+ readonly factoryName: "createCollection";
46
44
  readonly operationClass: "additive";
47
45
  readonly collection: string;
48
46
  readonly options: CreateCollectionOptions | undefined;
49
47
  readonly label: string;
50
48
  constructor(collection: string, options?: CreateCollectionOptions);
51
- accept<R>(visitor: OpFactoryCallVisitor<R>): R;
49
+ toOp(): MongoMigrationPlanOperation;
50
+ renderTypeScript(): string;
52
51
  }
53
52
  declare class DropCollectionCall extends OpFactoryCallNode {
54
- readonly factory: "dropCollection";
53
+ readonly factoryName: "dropCollection";
55
54
  readonly operationClass: "destructive";
56
55
  readonly collection: string;
57
56
  readonly label: string;
58
57
  constructor(collection: string);
59
- accept<R>(visitor: OpFactoryCallVisitor<R>): R;
58
+ toOp(): MongoMigrationPlanOperation;
59
+ renderTypeScript(): string;
60
60
  }
61
61
  declare class CollModCall extends OpFactoryCallNode {
62
- readonly factory: "collMod";
62
+ readonly factoryName: "collMod";
63
63
  readonly collection: string;
64
64
  readonly options: CollModOptions;
65
65
  readonly meta: CollModMeta | undefined;
66
66
  readonly operationClass: MigrationOperationClass;
67
67
  readonly label: string;
68
68
  constructor(collection: string, options: CollModOptions, meta?: CollModMeta);
69
- accept<R>(visitor: OpFactoryCallVisitor<R>): R;
69
+ toOp(): MongoMigrationPlanOperation;
70
+ renderTypeScript(): string;
70
71
  }
71
- type OpFactoryCall = CreateIndexCall | DropIndexCall | CreateCollectionCall | DropCollectionCall | CollModCall;
72
+ type OpFactoryCall$1 = CreateIndexCall | DropIndexCall | CreateCollectionCall | DropCollectionCall | CollModCall;
72
73
  declare function schemaIndexToCreateIndexOptions(index: MongoSchemaIndex): CreateIndexOptions;
73
74
  declare function schemaCollectionToCreateCollectionOptions(coll: MongoSchemaCollection): CreateCollectionOptions | undefined;
74
75
  //#endregion
75
- export { DropCollectionCall as a, OpFactoryCallVisitor as c, CreateIndexCall as i, schemaCollectionToCreateCollectionOptions as l, CollModMeta as n, DropIndexCall as o, CreateCollectionCall as r, OpFactoryCall as s, CollModCall as t, schemaIndexToCreateIndexOptions as u };
76
- //# sourceMappingURL=op-factory-call-CfPGebEH.d.mts.map
76
+ export { DropCollectionCall as a, schemaCollectionToCreateCollectionOptions as c, CreateIndexCall as i, schemaIndexToCreateIndexOptions as l, CollModMeta as n, DropIndexCall as o, CreateCollectionCall as r, OpFactoryCall$1 as s, CollModCall as t };
77
+ //# sourceMappingURL=op-factory-call-CVgzmLJh.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"op-factory-call-CVgzmLJh.d.mts","names":[],"sources":["../src/core/op-factory-call.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwEqC,UA3BpB,WAAA,CA2BoB;EAAiB,SAAA,EAAA,CAAA,EAAA,MAAA;EAgCzC,SAAA,KAAA,CAAA,EAAc,MAAA;EAII,SAAA,cAAA,CAAA,EA5DH,uBA4DG;;uBAvDhB,iBAAA,SAA0B,YAAA,YAAwB,aA0DX,CAAA;EAAd,kBAAA,WAAA,EAAA,MAAA;EAQ9B,kBAAA,cAAA,EAhE0B,uBAgE1B;EAfyB,kBAAA,KAA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,gBACA,uBACA,qBACA;iBAEY,+BAAA,QAAuC,mBAAmB;iBAc1D,yCAAA,OACR,wBACL"}
@@ -0,0 +1,22 @@
1
+ import { MongoSchemaIR } from "@prisma-next/mongo-schema-ir";
2
+ import { OperationContext, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
3
+ import { MongoContract } from "@prisma-next/mongo-contract";
4
+ import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
5
+
6
+ //#region src/core/schema-verify/verify-mongo-schema.d.ts
7
+ interface VerifyMongoSchemaOptions {
8
+ readonly contract: MongoContract;
9
+ readonly schema: MongoSchemaIR;
10
+ readonly strict: boolean;
11
+ readonly context?: OperationContext;
12
+ /**
13
+ * Active framework components participating in this composition. Mongo
14
+ * verification does not currently consult them, but the parameter exists
15
+ * for parity with `verifySqlSchema` so callers can pass the same envelope.
16
+ */
17
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', string>>;
18
+ }
19
+ declare function verifyMongoSchema(options: VerifyMongoSchemaOptions): VerifyDatabaseSchemaResult;
20
+ //#endregion
21
+ export { type VerifyMongoSchemaOptions, verifyMongoSchema };
22
+ //# sourceMappingURL=schema-verify.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-mongo-schema.ts"],"sourcesContent":[],"mappings":";;;;;;UAaiB,wBAAA;qBACI;EADJ,SAAA,MAAA,EAEE,aAFsB;EACpB,SAAA,MAAA,EAAA,OAAA;EACF,SAAA,OAAA,CAAA,EAEE,gBAFF;EAEE;;;;AASrB;gCAHgC,cAAc;;iBAG9B,iBAAA,UAA2B,2BAA2B"}
@@ -0,0 +1,3 @@
1
+ import { t as verifyMongoSchema } from "./verify-mongo-schema-P0TRBJNs.mjs";
2
+
3
+ export { verifyMongoSchema };