@chevre/domain 22.8.0 → 22.9.0-alpha.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.
@@ -0,0 +1,66 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+
4
+ import { chevre } from '../../../lib/index';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+ const IDENTIFIER = '12345abcde';
8
+
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const applicationRepo = await chevre.repository.Application.createInstance(mongoose.connection);
13
+
14
+ let applications = await applicationRepo.projectFields(
15
+ {
16
+ project: { id: { $eq: project.id } },
17
+ clientId: { $eq: IDENTIFIER }
18
+ },
19
+ ['clientId', 'issuer', 'typeOf', 'verified', 'project']
20
+ );
21
+ console.log('applications:', applications);
22
+ console.log(applications.length, 'applications found');
23
+
24
+ if (applications.length > 0) {
25
+ await applicationRepo.deleteById({
26
+ project: { id: applications[0].project.id },
27
+ id: applications[0].id
28
+ });
29
+ console.log('application deleted', applications[0].id);
30
+ }
31
+
32
+ await applicationRepo.projectFields(
33
+ {
34
+ project: { id: { $eq: project.id } },
35
+ clientId: { $eq: IDENTIFIER }
36
+ },
37
+ ['clientId', 'issuer', 'typeOf', 'verified', 'project']
38
+ );
39
+ console.log('applications:', applications);
40
+ console.log(applications.length, 'applications found');
41
+
42
+ await applicationRepo.save({
43
+ attributes: {
44
+ project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
45
+ typeOf: chevre.factory.creativeWorkType.WebApplication,
46
+ clientId: IDENTIFIER,
47
+ issuer: 'https://example.com',
48
+ verified: false
49
+ }
50
+ });
51
+ console.log('application created');
52
+
53
+ applications = await await applicationRepo.projectFields(
54
+ {
55
+ project: { id: { $eq: project.id } },
56
+ clientId: { $eq: IDENTIFIER }
57
+ },
58
+ ['clientId', 'issuer', 'typeOf', 'verified', 'project']
59
+ );
60
+ console.log('applications:', applications);
61
+ console.log(applications.length, 'applications found');
62
+ }
63
+
64
+ main()
65
+ .then()
66
+ .catch(console.error);
@@ -0,0 +1,36 @@
1
+ import { Connection, FilterQuery } from 'mongoose';
2
+ import { IApplication, ISearchConditions } from './mongoose/schemas/application';
3
+ export type ISavingApplication = Pick<IApplication, 'clientId' | 'issuer' | 'project' | 'typeOf' | 'verified'> & {
4
+ id?: never;
5
+ };
6
+ interface IUnset {
7
+ $unset?: {
8
+ [key: string]: 1;
9
+ };
10
+ }
11
+ type IApplicationWithId = IApplication & {
12
+ id: string;
13
+ };
14
+ type IKeyOfProjection = keyof IApplicationWithId;
15
+ /**
16
+ * アプリケーションリポジトリ
17
+ */
18
+ export declare class ApplicationRepo {
19
+ private readonly applicationModel;
20
+ constructor(connection: Connection);
21
+ static CREATE_FILTER_QUERY(params: ISearchConditions): FilterQuery<IApplication>[];
22
+ save(params: {
23
+ id?: string;
24
+ attributes: ISavingApplication & IUnset;
25
+ }): Promise<{
26
+ id: string;
27
+ }>;
28
+ projectFields(conditions: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IApplicationWithId[]>;
29
+ deleteById(params: {
30
+ id: string;
31
+ project: {
32
+ id: string;
33
+ };
34
+ }): Promise<void>;
35
+ }
36
+ export {};
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.ApplicationRepo = void 0;
24
+ const factory = require("../factory");
25
+ const settings_1 = require("../settings");
26
+ const application_1 = require("./mongoose/schemas/application");
27
+ /**
28
+ * アプリケーションリポジトリ
29
+ */
30
+ class ApplicationRepo {
31
+ constructor(connection) {
32
+ this.applicationModel = connection.model(application_1.modelName, (0, application_1.createSchema)());
33
+ }
34
+ // tslint:disable-next-line:max-func-body-length
35
+ static CREATE_FILTER_QUERY(params) {
36
+ var _a, _b, _c, _d, _e, _f, _g;
37
+ const andConditions = [];
38
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
39
+ if (typeof projectIdEq === 'string') {
40
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
41
+ }
42
+ const idEq = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$eq;
43
+ if (typeof idEq === 'string') {
44
+ andConditions.push({ _id: { $eq: idEq } });
45
+ }
46
+ const idIn = (_d = params.id) === null || _d === void 0 ? void 0 : _d.$in;
47
+ if (Array.isArray(idIn)) {
48
+ andConditions.push({ _id: { $in: idIn } });
49
+ }
50
+ const clientIdEq = (_e = params.clientId) === null || _e === void 0 ? void 0 : _e.$eq;
51
+ if (typeof clientIdEq === 'string') {
52
+ andConditions.push({ clientId: { $eq: clientIdEq } });
53
+ }
54
+ const clientIdIn = (_f = params.clientId) === null || _f === void 0 ? void 0 : _f.$in;
55
+ if (Array.isArray(clientIdIn)) {
56
+ andConditions.push({ clientId: { $in: clientIdIn } });
57
+ }
58
+ const clientIdRegex = (_g = params.clientId) === null || _g === void 0 ? void 0 : _g.$regex;
59
+ if (typeof clientIdRegex === 'string' && clientIdRegex.length > 0) {
60
+ andConditions.push({ clientId: { $regex: new RegExp(clientIdRegex) } });
61
+ }
62
+ const verified = params.verified;
63
+ if (typeof verified === 'boolean') {
64
+ andConditions.push({ verified: verified });
65
+ }
66
+ return andConditions;
67
+ }
68
+ save(params) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ var _a, _b;
71
+ let doc;
72
+ let savedId;
73
+ const savingId = params.id;
74
+ if (typeof savingId === 'string') {
75
+ if (savingId === '') {
76
+ throw new factory.errors.ArgumentNull('id');
77
+ }
78
+ const _c = params.attributes, { id, clientId, project, typeOf, $unset } = _c, updateFields = __rest(_c, ["id", "clientId", "project", "typeOf", "$unset"]);
79
+ const filter = {
80
+ _id: { $eq: savingId },
81
+ 'project.id': { $eq: project.id }
82
+ };
83
+ const update = Object.assign({ $set: updateFields }, ($unset !== undefined && $unset !== null) ? { $unset } : undefined);
84
+ const options = {
85
+ upsert: false,
86
+ new: true,
87
+ projection: { _id: 1, id: { $toString: '$_id' } }
88
+ };
89
+ doc = yield this.applicationModel.findOneAndUpdate(filter, update, options)
90
+ .lean()
91
+ .exec();
92
+ if (doc === null) {
93
+ throw new factory.errors.NotFound(this.applicationModel.modelName);
94
+ }
95
+ savedId = savingId;
96
+ }
97
+ else {
98
+ const _d = params.attributes, { $unset, id } = _d, createParams = __rest(_d, ["$unset", "id"]);
99
+ const result = yield this.applicationModel.insertMany(createParams, { rawResult: true });
100
+ const insertedId = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
101
+ if (typeof insertedId !== 'string') {
102
+ throw new factory.errors.Internal(`seller not saved unexpectedly. result:${JSON.stringify(result)}`);
103
+ }
104
+ savedId = insertedId;
105
+ }
106
+ return { id: savedId };
107
+ });
108
+ }
109
+ projectFields(conditions, inclusion) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ var _a;
112
+ const andConditions = ApplicationRepo.CREATE_FILTER_QUERY(conditions);
113
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(inclusion.map((key) => ([key, 1]))));
114
+ const query = this.applicationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
115
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
116
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
117
+ query.limit(conditions.limit)
118
+ .skip(conditions.limit * (page - 1));
119
+ }
120
+ if (typeof ((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.clientId) === 'number') {
121
+ query.sort({ identifier: conditions.sort.clientId });
122
+ }
123
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
124
+ .lean()
125
+ .exec();
126
+ });
127
+ }
128
+ deleteById(params) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ yield this.applicationModel.findOneAndDelete({
131
+ _id: { $eq: params.id },
132
+ 'project.id': { $eq: params.project.id }
133
+ }, { projection: { _id: 1 } })
134
+ .exec();
135
+ });
136
+ }
137
+ }
138
+ exports.ApplicationRepo = ApplicationRepo;
@@ -0,0 +1,40 @@
1
+ import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
+ import * as factory from '../../../factory';
3
+ export interface ISearchConditions {
4
+ limit?: number;
5
+ page?: number;
6
+ sort?: {
7
+ clientId?: factory.sortType;
8
+ };
9
+ project?: {
10
+ id?: {
11
+ $eq?: string;
12
+ };
13
+ };
14
+ id?: {
15
+ $eq?: string;
16
+ $in?: string[];
17
+ };
18
+ clientId?: {
19
+ $eq?: string;
20
+ $in?: string[];
21
+ $regex?: string;
22
+ };
23
+ verified?: boolean;
24
+ }
25
+ export interface IApplication {
26
+ id?: string;
27
+ issuer: string;
28
+ clientId: string;
29
+ project: Pick<factory.project.IProject, 'id' | 'typeOf'>;
30
+ typeOf: factory.creativeWorkType.WebApplication;
31
+ verified: boolean;
32
+ }
33
+ type IDocType = Omit<IApplication, 'id'>;
34
+ type IModel = Model<IDocType>;
35
+ type ISchemaDefinition = SchemaDefinition<IDocType>;
36
+ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
37
+ declare const modelName = "Application";
38
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
39
+ declare function createSchema(): ISchema;
40
+ export { createSchema, IModel, indexes, modelName };
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modelName = exports.indexes = void 0;
4
+ exports.createSchema = createSchema;
5
+ const mongoose_1 = require("mongoose");
6
+ const writeConcern_1 = require("../writeConcern");
7
+ const settings_1 = require("../../../settings");
8
+ const modelName = 'Application';
9
+ exports.modelName = modelName;
10
+ const schemaDefinition = {
11
+ project: {
12
+ type: mongoose_1.SchemaTypes.Mixed,
13
+ required: true
14
+ },
15
+ typeOf: {
16
+ type: String,
17
+ required: true
18
+ },
19
+ issuer: {
20
+ type: String,
21
+ required: true
22
+ },
23
+ clientId: {
24
+ type: String,
25
+ required: true
26
+ },
27
+ verified: {
28
+ type: Boolean,
29
+ required: true
30
+ }
31
+ };
32
+ const schemaOptions = {
33
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
34
+ autoCreate: false,
35
+ collection: 'applications',
36
+ id: true,
37
+ read: settings_1.MONGO_READ_PREFERENCE,
38
+ writeConcern: writeConcern_1.writeConcern,
39
+ strict: true,
40
+ strictQuery: false,
41
+ timestamps: false,
42
+ versionKey: false,
43
+ toJSON: {
44
+ getters: false,
45
+ virtuals: false,
46
+ minimize: false,
47
+ versionKey: false
48
+ },
49
+ toObject: {
50
+ getters: false,
51
+ virtuals: true,
52
+ minimize: false,
53
+ versionKey: false
54
+ }
55
+ };
56
+ const indexes = [
57
+ [
58
+ { 'project.id': 1, clientId: 1 },
59
+ {
60
+ name: 'uniqueClientId',
61
+ unique: true
62
+ }
63
+ ]
64
+ ];
65
+ exports.indexes = indexes;
66
+ /**
67
+ * アプリケーションスキーマ
68
+ */
69
+ let schema;
70
+ function createSchema() {
71
+ if (schema === undefined) {
72
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
73
+ if (settings_1.MONGO_AUTO_INDEX) {
74
+ indexes.forEach((indexParams) => {
75
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
76
+ });
77
+ }
78
+ }
79
+ return schema;
80
+ }
@@ -11,6 +11,7 @@ import type { AdditionalPropertyRepo } from './repo/additionalProperty';
11
11
  import type { AggregateOfferRepo } from './repo/aggregateOffer';
12
12
  import type { AggregateReservationRepo } from './repo/aggregateReservation';
13
13
  import type { AggregationRepo } from './repo/aggregation';
14
+ import type { ApplicationRepo } from './repo/application';
14
15
  import type { AssetTransactionRepo } from './repo/assetTransaction';
15
16
  import type { AuthorizationRepo } from './repo/authorization';
16
17
  import type { CategoryCodeRepo } from './repo/categoryCode';
@@ -116,6 +117,10 @@ export type Aggregation = AggregationRepo;
116
117
  export declare namespace Aggregation {
117
118
  function createInstance(...params: ConstructorParameters<typeof AggregationRepo>): Promise<AggregationRepo>;
118
119
  }
120
+ export type Application = ApplicationRepo;
121
+ export declare namespace Application {
122
+ function createInstance(...params: ConstructorParameters<typeof ApplicationRepo>): Promise<ApplicationRepo>;
123
+ }
119
124
  export type AssetTransaction = AssetTransactionRepo;
120
125
  export declare namespace AssetTransaction {
121
126
  function createInstance(...params: ConstructorParameters<typeof AssetTransactionRepo>): Promise<AssetTransactionRepo>;
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.Interface = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
- exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.Seller = exports.Schedule = exports.Role = exports.Reservation = exports.ProjectMakesOffer = void 0;
12
+ exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.Interface = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Application = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
+ exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.Seller = exports.Schedule = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = void 0;
14
14
  var AcceptedOffer;
15
15
  (function (AcceptedOffer) {
16
16
  let repo;
@@ -141,6 +141,19 @@ var Aggregation;
141
141
  }
142
142
  Aggregation.createInstance = createInstance;
143
143
  })(Aggregation || (exports.Aggregation = Aggregation = {}));
144
+ var Application;
145
+ (function (Application) {
146
+ let repo;
147
+ function createInstance(...params) {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ if (repo === undefined) {
150
+ repo = (yield Promise.resolve().then(() => require('./repo/application'))).ApplicationRepo;
151
+ }
152
+ return new repo(...params);
153
+ });
154
+ }
155
+ Application.createInstance = createInstance;
156
+ })(Application || (exports.Application = Application = {}));
144
157
  var AssetTransaction;
145
158
  (function (AssetTransaction) {
146
159
  let repo;
package/package.json CHANGED
@@ -112,5 +112,5 @@
112
112
  "postversion": "git push origin --tags",
113
113
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
114
114
  },
115
- "version": "22.8.0"
115
+ "version": "22.9.0-alpha.0"
116
116
  }
@@ -1,102 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../lib/index';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
- const IDENTIFIER = 'SellerReturnPolicy:20250117045254:0';
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- const sellerReturnPolicyRepo = await chevre.repository.SellerReturnPolicy.createInstance(mongoose.connection);
13
-
14
- let policies = await sellerReturnPolicyRepo.projectFields(
15
- {
16
- project: { id: { $eq: project.id } },
17
- identifier: { $eq: IDENTIFIER }
18
- },
19
- ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
20
- );
21
- console.log('policies:', policies);
22
- console.log(policies.length, 'policies found');
23
-
24
- if (policies.length > 0) {
25
- try {
26
- await sellerReturnPolicyRepo.deleteById({
27
- project: { id: policies[0].project.id },
28
- id: policies[0].id
29
- });
30
- console.log('policy deleted', policies[0].id);
31
- } catch (error) {
32
- console.error(error);
33
- }
34
- }
35
-
36
- policies = await sellerReturnPolicyRepo.projectFields(
37
- {
38
- project: { id: { $eq: project.id } },
39
- identifier: { $eq: IDENTIFIER }
40
- },
41
- ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
42
- );
43
- console.log('policies:', policies);
44
- console.log(policies.length, 'programs found');
45
-
46
- await sellerReturnPolicyRepo.save({
47
- attributes: {
48
- project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
49
- name: { ja: 'イベント2日前0時まで10円' },
50
- typeOf: 'MerchantReturnPolicy',
51
- restockingFee: {
52
- typeOf: 'MonetaryAmount',
53
- currency: 'JPY',
54
- value: 10
55
- },
56
- identifier: IDENTIFIER,
57
- // url: 'https://example.com',
58
- itemCondition: {
59
- id: '6466c23f8e7f569b623d876b',
60
- name: {
61
- ja: 'イベント2日前0時まで'
62
- },
63
- typeOf: 'OfferItemCondition'
64
- },
65
- merchantReturnDays: 100,
66
- applicablePaymentMethod: [
67
- 'au',
68
- 'CreditCard',
69
- 'CreditCardBySPS',
70
- 'MGTicket',
71
- 'MovieTicket',
72
- 'PayPay',
73
- 'CreditCard3DS'
74
- ]
75
- }
76
- });
77
- console.log('program created');
78
-
79
- policies = await sellerReturnPolicyRepo.projectFields(
80
- {
81
- project: { id: { $eq: project.id } },
82
- identifier: { $eq: IDENTIFIER }
83
- },
84
- ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
85
- );
86
- console.log('policies:', policies);
87
- console.log(policies.length, 'policies found');
88
-
89
- policies = await sellerReturnPolicyRepo.projectFields(
90
- {
91
- project: { id: { $eq: project.id } },
92
- restockingFee: { value: { $eq: 10 } }
93
- },
94
- ['applicablePaymentMethod', 'identifier', 'itemCondition', 'merchantReturnDays', 'name', 'restockingFee', 'typeOf']
95
- );
96
- console.log('policies:', policies);
97
- console.log(policies.length, 'policies found');
98
- }
99
-
100
- main()
101
- .then()
102
- .catch(console.error);