@chevre/domain 21.23.0-alpha.1 → 21.23.0

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.
@@ -19,6 +19,10 @@ const schemaDefinition = {
19
19
  type: mongoose_1.SchemaTypes.Mixed,
20
20
  required: true
21
21
  },
22
+ provider: {
23
+ type: mongoose_1.SchemaTypes.Mixed,
24
+ required: true
25
+ },
22
26
  about: {
23
27
  type: mongoose_1.SchemaTypes.Mixed,
24
28
  required: true
@@ -22,7 +22,7 @@ export declare class MongoRepository {
22
22
  /**
23
23
  * コードをキーにしてなければ作成する(複数対応)
24
24
  */
25
- upsertByIdentifier(params: Pick<INoteDigitalDocument, 'about' | 'creator' | 'identifier' | 'project' | 'text' | 'version'>[], options: {
25
+ upsertByIdentifier(params: Pick<INoteDigitalDocument, 'about' | 'creator' | 'identifier' | 'project' | 'provider' | 'text' | 'version'>[], options: {
26
26
  overwrite: boolean;
27
27
  }): Promise<BulkWriteResult | void>;
28
28
  updateById(params: {
@@ -21,7 +21,7 @@ class MongoRepository {
21
21
  this.noteModel = connection.model(note_1.modelName, (0, note_1.createSchema)());
22
22
  }
23
23
  static CREATE_MONGO_CONDITIONS(params) {
24
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
24
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
25
25
  const andConditions = [];
26
26
  const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
27
27
  if (Array.isArray(idIn)) {
@@ -31,27 +31,31 @@ class MongoRepository {
31
31
  if (typeof projectIdEq === 'string') {
32
32
  andConditions.push({ 'project.id': { $eq: projectIdEq } });
33
33
  }
34
- const aboutIdEq = (_e = (_d = params.about) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
34
+ const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
35
+ if (typeof providerIdEq === 'string') {
36
+ andConditions.push({ 'provider.id': { $eq: providerIdEq } });
37
+ }
38
+ const aboutIdEq = (_g = (_f = params.about) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.$eq;
35
39
  if (typeof aboutIdEq === 'string') {
36
40
  andConditions.push({ 'about.id': { $eq: aboutIdEq } });
37
41
  }
38
- const aboutIdIn = (_g = (_f = params.about) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.$in;
42
+ const aboutIdIn = (_j = (_h = params.about) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.$in;
39
43
  if (Array.isArray(aboutIdIn)) {
40
44
  andConditions.push({ 'about.id': { $in: aboutIdIn } });
41
45
  }
42
- const aboutOrderNumberEq = (_j = (_h = params.about) === null || _h === void 0 ? void 0 : _h.orderNumber) === null || _j === void 0 ? void 0 : _j.$eq;
46
+ const aboutOrderNumberEq = (_l = (_k = params.about) === null || _k === void 0 ? void 0 : _k.orderNumber) === null || _l === void 0 ? void 0 : _l.$eq;
43
47
  if (typeof aboutOrderNumberEq === 'string') {
44
48
  andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
45
49
  }
46
- const aboutOrderNumberIn = (_l = (_k = params.about) === null || _k === void 0 ? void 0 : _k.orderNumber) === null || _l === void 0 ? void 0 : _l.$in;
50
+ const aboutOrderNumberIn = (_o = (_m = params.about) === null || _m === void 0 ? void 0 : _m.orderNumber) === null || _o === void 0 ? void 0 : _o.$in;
47
51
  if (Array.isArray(aboutOrderNumberIn)) {
48
52
  andConditions.push({ 'about.orderNumber': { $exists: true, $in: aboutOrderNumberIn } });
49
53
  }
50
- const identifierEq = (_m = params.identifier) === null || _m === void 0 ? void 0 : _m.$eq;
54
+ const identifierEq = (_p = params.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
51
55
  if (typeof identifierEq === 'string') {
52
56
  andConditions.push({ identifier: { $eq: identifierEq } });
53
57
  }
54
- const identifierIn = (_o = params.identifier) === null || _o === void 0 ? void 0 : _o.$in;
58
+ const identifierIn = (_q = params.identifier) === null || _q === void 0 ? void 0 : _q.$in;
55
59
  if (Array.isArray(identifierIn)) {
56
60
  andConditions.push({ identifier: { $in: identifierIn } });
57
61
  }
@@ -99,19 +103,6 @@ class MongoRepository {
99
103
  .then((docs) => docs.map((doc) => doc.toObject()));
100
104
  });
101
105
  }
102
- // public async create(params: Pick<
103
- // INoteDigitalDocument,
104
- // 'about' | 'creator' | 'identifier' | 'project' | 'text' | 'version'
105
- // >): Promise<INoteDigitalDocument> {
106
- // const { about, creator, identifier, project, text, version } = params;
107
- // const creatingDoc: INoteDigitalDocument = {
108
- // about, creator, identifier, project, text, version,
109
- // dateCreated: new Date(),
110
- // typeOf: factory.creativeWorkType.NoteDigitalDocument
111
- // };
112
- // const doc = await this.noteModel.create(creatingDoc);
113
- // return doc.toObject();
114
- // }
115
106
  /**
116
107
  * コードをキーにしてなければ作成する(複数対応)
117
108
  */
@@ -121,7 +112,7 @@ class MongoRepository {
121
112
  const bulkWriteOps = [];
122
113
  if (Array.isArray(params)) {
123
114
  params.forEach((creatingNoteParams) => {
124
- const { about, creator, identifier, project, text, version } = creatingNoteParams;
115
+ const { about, creator, identifier, project, provider, text, version } = creatingNoteParams;
125
116
  if (typeof identifier !== 'string' || identifier.length === 0) {
126
117
  throw new factory.errors.ArgumentNull('identifier');
127
118
  }
@@ -139,7 +130,7 @@ class MongoRepository {
139
130
  identifier: { $eq: identifier },
140
131
  version: { $eq: version }
141
132
  };
142
- const setOnInsert = Object.assign({ about, creator, identifier, project, version, dateCreated: now, typeOf: factory.creativeWorkType.NoteDigitalDocument }, (!options.overwrite) ? { text } : undefined // overwriteでない場合はinsert時にtextをセット
133
+ const setOnInsert = Object.assign({ about, creator, identifier, project, provider, version, dateCreated: now, typeOf: factory.creativeWorkType.NoteDigitalDocument }, (!options.overwrite) ? { text } : undefined // overwriteでない場合はinsert時にtextをセット
143
134
  );
144
135
  // 変更可能な属性のみ上書き
145
136
  const setFields = {
package/package.json CHANGED
@@ -10,8 +10,8 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.356.0",
14
- "@cinerino/sdk": "5.12.0-alpha.2",
13
+ "@chevre/factory": "4.357.0",
14
+ "@cinerino/sdk": "5.12.0",
15
15
  "@motionpicture/coa-service": "9.3.0-alpha.5",
16
16
  "@motionpicture/gmo-service": "5.3.0-alpha.4",
17
17
  "@sendgrid/mail": "6.4.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.23.0-alpha.1"
113
+ "version": "21.23.0"
114
114
  }