@purpleschool/gptbot 0.19.21-stage-2-push-msg-apple-pay → 0.19.22-stage-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.
- package/build/api/controllers/http/index.d.ts +0 -2
- package/build/api/controllers/http/index.js +0 -2
- package/build/commands/index.d.ts +0 -1
- package/build/commands/index.js +0 -1
- package/build/constants/index.d.ts +0 -1
- package/build/constants/index.js +0 -1
- package/build/models/index.d.ts +0 -1
- package/build/models/index.js +0 -1
- package/package.json +2 -2
- package/build/api/controllers/http/push-cron.d.ts +0 -5
- package/build/api/controllers/http/push-cron.js +0 -8
- package/build/api/controllers/http/push.d.ts +0 -10
- package/build/api/controllers/http/push.js +0 -13
- package/build/commands/push/check-push-receipts.command.d.ts +0 -18
- package/build/commands/push/check-push-receipts.command.js +0 -28
- package/build/commands/push/delete-push-device.command.d.ts +0 -13
- package/build/commands/push/delete-push-device.command.js +0 -10
- package/build/commands/push/get-push-settings.command.d.ts +0 -11
- package/build/commands/push/get-push-settings.command.js +0 -9
- package/build/commands/push/index.d.ts +0 -8
- package/build/commands/push/index.js +0 -24
- package/build/commands/push/mark-push-message-opened.command.d.ts +0 -13
- package/build/commands/push/mark-push-message-opened.command.js +0 -11
- package/build/commands/push/register-push-device.command.d.ts +0 -19
- package/build/commands/push/register-push-device.command.js +0 -38
- package/build/commands/push/send-daily-push-reminders.command.d.ts +0 -12
- package/build/commands/push/send-daily-push-reminders.command.js +0 -15
- package/build/commands/push/send-test-push.command.d.ts +0 -26
- package/build/commands/push/send-test-push.command.js +0 -28
- package/build/commands/push/update-push-settings.command.d.ts +0 -17
- package/build/commands/push/update-push-settings.command.js +0 -10
- package/build/constants/push/enums/index.d.ts +0 -7
- package/build/constants/push/enums/index.js +0 -23
- package/build/constants/push/enums/push-category.enum.d.ts +0 -9
- package/build/constants/push/enums/push-category.enum.js +0 -13
- package/build/constants/push/enums/push-daily-reminder-start-status.enum.d.ts +0 -7
- package/build/constants/push/enums/push-daily-reminder-start-status.enum.js +0 -11
- package/build/constants/push/enums/push-message-status.enum.d.ts +0 -13
- package/build/constants/push/enums/push-message-status.enum.js +0 -17
- package/build/constants/push/enums/push-message-type.enum.d.ts +0 -15
- package/build/constants/push/enums/push-message-type.enum.js +0 -19
- package/build/constants/push/enums/push-platform.enum.d.ts +0 -7
- package/build/constants/push/enums/push-platform.enum.js +0 -11
- package/build/constants/push/enums/push-provider.enum.d.ts +0 -7
- package/build/constants/push/enums/push-provider.enum.js +0 -11
- package/build/constants/push/enums/push-skip-reason.enum.d.ts +0 -11
- package/build/constants/push/enums/push-skip-reason.enum.js +0 -15
- package/build/constants/push/index.d.ts +0 -2
- package/build/constants/push/index.js +0 -18
- package/build/constants/push/push-settings-defaults.d.ts +0 -5
- package/build/constants/push/push-settings-defaults.js +0 -8
- package/build/helpers/image-generation/calculate-gpt-image-2-price-with-margin.helper.d.ts +0 -62
- package/build/helpers/image-generation/calculate-gpt-image-2-price-with-margin.helper.js +0 -137
- package/build/models/push/index.d.ts +0 -2
- package/build/models/push/index.js +0 -18
- package/build/models/push/push-device.schema.d.ts +0 -17
- package/build/models/push/push-device.schema.js +0 -34
- package/build/models/push/push-settings.schema.d.ts +0 -7
- package/build/models/push/push-settings.schema.js +0 -9
|
@@ -88,8 +88,6 @@ export * from './photo-session';
|
|
|
88
88
|
export * from './photo-studio';
|
|
89
89
|
export * from './canvas-template';
|
|
90
90
|
export * from './app-login';
|
|
91
|
-
export * from './push';
|
|
92
|
-
export * from './push-cron';
|
|
93
91
|
export * from './greetings';
|
|
94
92
|
export * from './motion-control';
|
|
95
93
|
export * from './onboarding';
|
|
@@ -104,8 +104,6 @@ __exportStar(require("./photo-session"), exports);
|
|
|
104
104
|
__exportStar(require("./photo-studio"), exports);
|
|
105
105
|
__exportStar(require("./canvas-template"), exports);
|
|
106
106
|
__exportStar(require("./app-login"), exports);
|
|
107
|
-
__exportStar(require("./push"), exports);
|
|
108
|
-
__exportStar(require("./push-cron"), exports);
|
|
109
107
|
__exportStar(require("./greetings"), exports);
|
|
110
108
|
__exportStar(require("./motion-control"), exports);
|
|
111
109
|
__exportStar(require("./onboarding"), exports);
|
package/build/commands/index.js
CHANGED
|
@@ -76,6 +76,5 @@ __exportStar(require("./team-account"), exports);
|
|
|
76
76
|
__exportStar(require("./team-to-subscription"), exports);
|
|
77
77
|
__exportStar(require("./team-to-product"), exports);
|
|
78
78
|
__exportStar(require("./app-login"), exports);
|
|
79
|
-
__exportStar(require("./push"), exports);
|
|
80
79
|
__exportStar(require("./partner-codes"), exports);
|
|
81
80
|
__exportStar(require("./onboarding"), exports);
|
package/build/constants/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ai-model"), exports);
|
|
18
|
-
__exportStar(require("./push"), exports);
|
|
19
18
|
__exportStar(require("./ai-vendor"), exports);
|
|
20
19
|
__exportStar(require("./apple-iap"), exports);
|
|
21
20
|
__exportStar(require("./b2b"), exports);
|
package/build/models/index.d.ts
CHANGED
package/build/models/index.js
CHANGED
|
@@ -102,5 +102,4 @@ __exportStar(require("./team-account"), exports);
|
|
|
102
102
|
__exportStar(require("./partner-codes"), exports);
|
|
103
103
|
__exportStar(require("./canvas-template.schema"), exports);
|
|
104
104
|
__exportStar(require("./user-loyalty-status.schema"), exports);
|
|
105
|
-
__exportStar(require("./push"), exports);
|
|
106
105
|
__exportStar(require("./onboarding.schema"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purpleschool/gptbot",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.22-stage-2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@purpleschool/rugpt-lib-common": "0.0.
|
|
18
|
+
"@purpleschool/rugpt-lib-common": "0.0.103",
|
|
19
19
|
"zod": "4.6.5"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_CRON_ROUTES = exports.PUSH_CRON_CONTROLLER = void 0;
|
|
4
|
-
exports.PUSH_CRON_CONTROLLER = 'push/cron';
|
|
5
|
-
exports.PUSH_CRON_ROUTES = {
|
|
6
|
-
CHECK_RECEIPTS: 'check-receipts',
|
|
7
|
-
SEND_DAILY_REMINDERS: 'send-daily-reminders',
|
|
8
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const PUSH_PRIVATE_CONTROLLER: 'push';
|
|
2
|
-
export declare const PUSH_ROUTES: {
|
|
3
|
-
readonly DEVICES: 'devices';
|
|
4
|
-
readonly DEVICE: 'devices/:token';
|
|
5
|
-
readonly DELETE_DEVICE: (token: string) => string;
|
|
6
|
-
readonly SETTINGS: 'settings';
|
|
7
|
-
readonly TEST: 'test';
|
|
8
|
-
readonly MESSAGE_OPENED: 'messages/:uuid/opened';
|
|
9
|
-
readonly MARK_MESSAGE_OPENED: (uuid: string) => string;
|
|
10
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_ROUTES = exports.PUSH_PRIVATE_CONTROLLER = void 0;
|
|
4
|
-
exports.PUSH_PRIVATE_CONTROLLER = 'push';
|
|
5
|
-
exports.PUSH_ROUTES = {
|
|
6
|
-
DEVICES: 'devices',
|
|
7
|
-
DEVICE: 'devices/:token',
|
|
8
|
-
DELETE_DEVICE: (token) => `devices/${encodeURIComponent(token)}`,
|
|
9
|
-
SETTINGS: 'settings',
|
|
10
|
-
TEST: 'test',
|
|
11
|
-
MESSAGE_OPENED: 'messages/:uuid/opened',
|
|
12
|
-
MARK_MESSAGE_OPENED: (uuid) => `messages/${encodeURIComponent(uuid)}/opened`,
|
|
13
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare namespace CheckPushReceiptsCommand {
|
|
3
|
-
const RequestBodySchema: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
4
|
-
type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
5
|
-
const ResponseSchema: z.ZodObject<{
|
|
6
|
-
data: z.ZodObject<{
|
|
7
|
-
selected: z.ZodNumber;
|
|
8
|
-
delivered: z.ZodNumber;
|
|
9
|
-
failed: z.ZodNumber;
|
|
10
|
-
missing: z.ZodNumber;
|
|
11
|
-
unchanged: z.ZodNumber;
|
|
12
|
-
invalidatedDevices: z.ZodNumber;
|
|
13
|
-
skippedInvalidations: z.ZodNumber;
|
|
14
|
-
limitReached: z.ZodBoolean;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CheckPushReceiptsCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
var CheckPushReceiptsCommand;
|
|
6
|
-
(function (CheckPushReceiptsCommand) {
|
|
7
|
-
CheckPushReceiptsCommand.RequestBodySchema = zod_1.z.object({}).strict().default({});
|
|
8
|
-
CheckPushReceiptsCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
-
data: zod_1.z.object({
|
|
10
|
-
/** Записи журнала в выбранной пачке, включая разные записи с одинаковым ticket. */
|
|
11
|
-
selected: zod_1.z.number().int().nonnegative(),
|
|
12
|
-
/** Сохранённые подтверждения передачи в FCM/APNs; показ и прочтение не подтверждены. */
|
|
13
|
-
delivered: zod_1.z.number().int().nonnegative(),
|
|
14
|
-
/** Сохранённые отказы из квитанций; не ошибки HTTP-запроса всей пачки. */
|
|
15
|
-
failed: zod_1.z.number().int().nonnegative(),
|
|
16
|
-
/** Проверки без квитанции: сообщения остаются SENT для последующей проверки. */
|
|
17
|
-
missing: zod_1.z.number().int().nonnegative(),
|
|
18
|
-
/** Записи, пропущенные при сохранении из-за параллельного изменения. */
|
|
19
|
-
unchanged: zod_1.z.number().int().nonnegative(),
|
|
20
|
-
/** Регистрации, фактически отключённые по DeviceNotRegistered. */
|
|
21
|
-
invalidatedDevices: zod_1.z.number().int().nonnegative(),
|
|
22
|
-
/** Сохранённые DeviceNotRegistered без отключения уже изменённой или отключённой регистрации. */
|
|
23
|
-
skippedInvalidations: zod_1.z.number().int().nonnegative(),
|
|
24
|
-
/** Размер пачки равен лимиту; наличие оставшихся записей отдельно не проверялось. */
|
|
25
|
-
limitReached: zod_1.z.boolean(),
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
})(CheckPushReceiptsCommand || (exports.CheckPushReceiptsCommand = CheckPushReceiptsCommand = {}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare namespace DeletePushDeviceCommand {
|
|
3
|
-
const RequestParamsSchema: z.ZodObject<{
|
|
4
|
-
token: z.ZodString;
|
|
5
|
-
}, z.core.$strict>;
|
|
6
|
-
type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
7
|
-
const ResponseSchema: z.ZodObject<{
|
|
8
|
-
data: z.ZodObject<{
|
|
9
|
-
deleted: z.ZodLiteral<true>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeletePushDeviceCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const push_1 = require("../../models/push");
|
|
6
|
-
var DeletePushDeviceCommand;
|
|
7
|
-
(function (DeletePushDeviceCommand) {
|
|
8
|
-
DeletePushDeviceCommand.RequestParamsSchema = push_1.PushDeviceSchema.pick({ token: true }).strict();
|
|
9
|
-
DeletePushDeviceCommand.ResponseSchema = zod_1.z.object({ data: zod_1.z.object({ deleted: zod_1.z.literal(true) }) });
|
|
10
|
-
})(DeletePushDeviceCommand || (exports.DeletePushDeviceCommand = DeletePushDeviceCommand = {}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare namespace GetPushSettingsCommand {
|
|
3
|
-
const ResponseSchema: z.ZodObject<{
|
|
4
|
-
data: z.ZodObject<{
|
|
5
|
-
results: z.ZodBoolean;
|
|
6
|
-
daily: z.ZodBoolean;
|
|
7
|
-
promo: z.ZodBoolean;
|
|
8
|
-
}, z.core.$strict>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetPushSettingsCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const push_1 = require("../../models/push");
|
|
6
|
-
var GetPushSettingsCommand;
|
|
7
|
-
(function (GetPushSettingsCommand) {
|
|
8
|
-
GetPushSettingsCommand.ResponseSchema = zod_1.z.object({ data: push_1.PushSettingsSchema });
|
|
9
|
-
})(GetPushSettingsCommand || (exports.GetPushSettingsCommand = GetPushSettingsCommand = {}));
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './register-push-device.command';
|
|
2
|
-
export * from './delete-push-device.command';
|
|
3
|
-
export * from './get-push-settings.command';
|
|
4
|
-
export * from './update-push-settings.command';
|
|
5
|
-
export * from './mark-push-message-opened.command';
|
|
6
|
-
export * from './send-test-push.command';
|
|
7
|
-
export * from './check-push-receipts.command';
|
|
8
|
-
export * from './send-daily-push-reminders.command';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./register-push-device.command"), exports);
|
|
18
|
-
__exportStar(require("./delete-push-device.command"), exports);
|
|
19
|
-
__exportStar(require("./get-push-settings.command"), exports);
|
|
20
|
-
__exportStar(require("./update-push-settings.command"), exports);
|
|
21
|
-
__exportStar(require("./mark-push-message-opened.command"), exports);
|
|
22
|
-
__exportStar(require("./send-test-push.command"), exports);
|
|
23
|
-
__exportStar(require("./check-push-receipts.command"), exports);
|
|
24
|
-
__exportStar(require("./send-daily-push-reminders.command"), exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare namespace MarkPushMessageOpenedCommand {
|
|
3
|
-
const RequestParamsSchema: z.ZodObject<{
|
|
4
|
-
uuid: z.ZodUUID;
|
|
5
|
-
}, z.core.$strict>;
|
|
6
|
-
type RequestParams = z.infer<typeof RequestParamsSchema>;
|
|
7
|
-
const ResponseSchema: z.ZodObject<{
|
|
8
|
-
data: z.ZodObject<{
|
|
9
|
-
openedAt: z.ZodISODateTime;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MarkPushMessageOpenedCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
var MarkPushMessageOpenedCommand;
|
|
6
|
-
(function (MarkPushMessageOpenedCommand) {
|
|
7
|
-
MarkPushMessageOpenedCommand.RequestParamsSchema = zod_1.z.object({ uuid: zod_1.z.uuid() }).strict();
|
|
8
|
-
MarkPushMessageOpenedCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
-
data: zod_1.z.object({ openedAt: zod_1.z.iso.datetime() }),
|
|
10
|
-
});
|
|
11
|
-
})(MarkPushMessageOpenedCommand || (exports.MarkPushMessageOpenedCommand = MarkPushMessageOpenedCommand = {}));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PUSH_PLATFORM, PUSH_PROVIDER } from '../../constants/push';
|
|
3
|
-
export declare namespace RegisterPushDeviceCommand {
|
|
4
|
-
const RequestBodySchema: z.ZodObject<{
|
|
5
|
-
token: z.ZodString;
|
|
6
|
-
provider: z.ZodEnum<typeof PUSH_PROVIDER>;
|
|
7
|
-
platform: z.ZodEnum<typeof PUSH_PLATFORM>;
|
|
8
|
-
appVersion: z.ZodString;
|
|
9
|
-
locale: z.ZodString;
|
|
10
|
-
timezone: z.ZodString;
|
|
11
|
-
}, z.core.$strict>;
|
|
12
|
-
type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
13
|
-
const ResponseSchema: z.ZodObject<{
|
|
14
|
-
data: z.ZodObject<{
|
|
15
|
-
registered: z.ZodLiteral<true>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
}, z.core.$strip>;
|
|
18
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RegisterPushDeviceCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const push_1 = require("../../constants/push");
|
|
6
|
-
const push_2 = require("../../models/push");
|
|
7
|
-
var RegisterPushDeviceCommand;
|
|
8
|
-
(function (RegisterPushDeviceCommand) {
|
|
9
|
-
RegisterPushDeviceCommand.RequestBodySchema = push_2.PushDeviceSchema.pick({
|
|
10
|
-
token: true,
|
|
11
|
-
provider: true,
|
|
12
|
-
platform: true,
|
|
13
|
-
appVersion: true,
|
|
14
|
-
locale: true,
|
|
15
|
-
timezone: true,
|
|
16
|
-
})
|
|
17
|
-
.strict()
|
|
18
|
-
.superRefine(({ provider, token, platform }, ctx) => {
|
|
19
|
-
// Formats accepted by the Expo server SDK, with empty/whitespace tokens rejected.
|
|
20
|
-
const isExpoToken = /^(?:ExponentPushToken|ExpoPushToken)\[[^\s\[\]]+\]$/u.test(token) ||
|
|
21
|
-
/^[a-z\d]{8}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{12}$/iu.test(token);
|
|
22
|
-
if (provider === push_1.PUSH_PROVIDER.EXPO && !isExpoToken) {
|
|
23
|
-
ctx.addIssue({
|
|
24
|
-
code: 'custom',
|
|
25
|
-
path: ['token'],
|
|
26
|
-
message: 'Invalid Expo push token',
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
if (provider === push_1.PUSH_PROVIDER.RUSTORE && platform !== push_1.PUSH_PLATFORM.ANDROID) {
|
|
30
|
-
ctx.addIssue({
|
|
31
|
-
code: 'custom',
|
|
32
|
-
path: ['platform'],
|
|
33
|
-
message: 'RuStore push requires Android',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
RegisterPushDeviceCommand.ResponseSchema = zod_1.z.object({ data: zod_1.z.object({ registered: zod_1.z.literal(true) }) });
|
|
38
|
-
})(RegisterPushDeviceCommand || (exports.RegisterPushDeviceCommand = RegisterPushDeviceCommand = {}));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PUSH_DAILY_REMINDER_START_STATUS } from '../../constants/push';
|
|
3
|
-
export declare namespace SendDailyPushRemindersCommand {
|
|
4
|
-
const RequestBodySchema: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
5
|
-
type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
6
|
-
const ResponseSchema: z.ZodObject<{
|
|
7
|
-
data: z.ZodObject<{
|
|
8
|
-
status: z.ZodEnum<typeof PUSH_DAILY_REMINDER_START_STATUS>;
|
|
9
|
-
}, z.core.$strip>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SendDailyPushRemindersCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const push_1 = require("../../constants/push");
|
|
6
|
-
var SendDailyPushRemindersCommand;
|
|
7
|
-
(function (SendDailyPushRemindersCommand) {
|
|
8
|
-
SendDailyPushRemindersCommand.RequestBodySchema = zod_1.z.object({}).strict().default({});
|
|
9
|
-
SendDailyPushRemindersCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
-
data: zod_1.z.object({
|
|
11
|
-
/** Принятие фонового обхода в процессе API; не подтверждает его завершение или доставку. */
|
|
12
|
-
status: zod_1.z.enum(push_1.PUSH_DAILY_REMINDER_START_STATUS),
|
|
13
|
-
}),
|
|
14
|
-
});
|
|
15
|
-
})(SendDailyPushRemindersCommand || (exports.SendDailyPushRemindersCommand = SendDailyPushRemindersCommand = {}));
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PUSH_MESSAGE_STATUS, PUSH_SKIP_REASON } from '../../constants/push';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
export declare namespace SendTestPushCommand {
|
|
4
|
-
const RequestBodySchema: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
5
|
-
type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
6
|
-
const ResponseSchema: z.ZodObject<{
|
|
7
|
-
data: z.ZodObject<{
|
|
8
|
-
total: z.ZodNumber;
|
|
9
|
-
sent: z.ZodNumber;
|
|
10
|
-
failed: z.ZodNumber;
|
|
11
|
-
skipped: z.ZodNumber;
|
|
12
|
-
skipReason: z.ZodNullable<z.ZodEnum<typeof PUSH_SKIP_REASON>>;
|
|
13
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
14
|
-
messageId: z.ZodUUID;
|
|
15
|
-
deviceId: z.ZodUUID;
|
|
16
|
-
status: z.ZodEnum<{
|
|
17
|
-
failed: PUSH_MESSAGE_STATUS.FAILED;
|
|
18
|
-
sent: PUSH_MESSAGE_STATUS.SENT;
|
|
19
|
-
skipped: PUSH_MESSAGE_STATUS.SKIPPED;
|
|
20
|
-
}>;
|
|
21
|
-
skipReason: z.ZodNullable<z.ZodEnum<typeof PUSH_SKIP_REASON>>;
|
|
22
|
-
}, z.core.$strip>>;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
26
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SendTestPushCommand = void 0;
|
|
4
|
-
const push_1 = require("../../constants/push");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
var SendTestPushCommand;
|
|
7
|
-
(function (SendTestPushCommand) {
|
|
8
|
-
SendTestPushCommand.RequestBodySchema = zod_1.z.object({}).strict().default({});
|
|
9
|
-
SendTestPushCommand.ResponseSchema = zod_1.z.object({
|
|
10
|
-
data: zod_1.z.object({
|
|
11
|
-
total: zod_1.z.number().int().nonnegative(),
|
|
12
|
-
sent: zod_1.z.number().int().nonnegative(),
|
|
13
|
-
failed: zod_1.z.number().int().nonnegative(),
|
|
14
|
-
skipped: zod_1.z.number().int().nonnegative(),
|
|
15
|
-
skipReason: zod_1.z.enum(push_1.PUSH_SKIP_REASON).nullable(),
|
|
16
|
-
messages: zod_1.z.array(zod_1.z.object({
|
|
17
|
-
messageId: zod_1.z.uuid(),
|
|
18
|
-
deviceId: zod_1.z.uuid(),
|
|
19
|
-
status: zod_1.z.enum([
|
|
20
|
-
push_1.PUSH_MESSAGE_STATUS.SENT,
|
|
21
|
-
push_1.PUSH_MESSAGE_STATUS.FAILED,
|
|
22
|
-
push_1.PUSH_MESSAGE_STATUS.SKIPPED,
|
|
23
|
-
]),
|
|
24
|
-
skipReason: zod_1.z.enum(push_1.PUSH_SKIP_REASON).nullable(),
|
|
25
|
-
})),
|
|
26
|
-
}),
|
|
27
|
-
});
|
|
28
|
-
})(SendTestPushCommand || (exports.SendTestPushCommand = SendTestPushCommand = {}));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare namespace UpdatePushSettingsCommand {
|
|
3
|
-
const RequestBodySchema: z.ZodObject<{
|
|
4
|
-
results: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
-
daily: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
-
promo: z.ZodOptional<z.ZodBoolean>;
|
|
7
|
-
}, z.core.$strict>;
|
|
8
|
-
type RequestBody = z.infer<typeof RequestBodySchema>;
|
|
9
|
-
const ResponseSchema: z.ZodObject<{
|
|
10
|
-
data: z.ZodObject<{
|
|
11
|
-
results: z.ZodBoolean;
|
|
12
|
-
daily: z.ZodBoolean;
|
|
13
|
-
promo: z.ZodBoolean;
|
|
14
|
-
}, z.core.$strict>;
|
|
15
|
-
}, z.core.$strip>;
|
|
16
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpdatePushSettingsCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const push_1 = require("../../models/push");
|
|
6
|
-
var UpdatePushSettingsCommand;
|
|
7
|
-
(function (UpdatePushSettingsCommand) {
|
|
8
|
-
UpdatePushSettingsCommand.RequestBodySchema = push_1.PushSettingsSchema.partial();
|
|
9
|
-
UpdatePushSettingsCommand.ResponseSchema = zod_1.z.object({ data: push_1.PushSettingsSchema });
|
|
10
|
-
})(UpdatePushSettingsCommand || (exports.UpdatePushSettingsCommand = UpdatePushSettingsCommand = {}));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './push-platform.enum';
|
|
2
|
-
export * from './push-provider.enum';
|
|
3
|
-
export * from './push-category.enum';
|
|
4
|
-
export * from './push-message-type.enum';
|
|
5
|
-
export * from './push-message-status.enum';
|
|
6
|
-
export * from './push-skip-reason.enum';
|
|
7
|
-
export * from './push-daily-reminder-start-status.enum';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./push-platform.enum"), exports);
|
|
18
|
-
__exportStar(require("./push-provider.enum"), exports);
|
|
19
|
-
__exportStar(require("./push-category.enum"), exports);
|
|
20
|
-
__exportStar(require("./push-message-type.enum"), exports);
|
|
21
|
-
__exportStar(require("./push-message-status.enum"), exports);
|
|
22
|
-
__exportStar(require("./push-skip-reason.enum"), exports);
|
|
23
|
-
__exportStar(require("./push-daily-reminder-start-status.enum"), exports);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Категория настроек уведомлений; также задаёт канал уведомлений Android. */
|
|
2
|
-
export declare enum PUSH_CATEGORY {
|
|
3
|
-
/** Результаты генераций инструментов и готовые ответы чата. */
|
|
4
|
-
RESULTS = "results",
|
|
5
|
-
/** Напоминания о ежедневной награде и сохранении серии. */
|
|
6
|
-
DAILY = "daily",
|
|
7
|
-
/** Маркетинговые уведомления, для которых требуется отдельное согласие. */
|
|
8
|
-
PROMO = "promo"
|
|
9
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_CATEGORY = void 0;
|
|
4
|
-
/** Категория настроек уведомлений; также задаёт канал уведомлений Android. */
|
|
5
|
-
var PUSH_CATEGORY;
|
|
6
|
-
(function (PUSH_CATEGORY) {
|
|
7
|
-
/** Результаты генераций инструментов и готовые ответы чата. */
|
|
8
|
-
PUSH_CATEGORY["RESULTS"] = "results";
|
|
9
|
-
/** Напоминания о ежедневной награде и сохранении серии. */
|
|
10
|
-
PUSH_CATEGORY["DAILY"] = "daily";
|
|
11
|
-
/** Маркетинговые уведомления, для которых требуется отдельное согласие. */
|
|
12
|
-
PUSH_CATEGORY["PROMO"] = "promo";
|
|
13
|
-
})(PUSH_CATEGORY || (exports.PUSH_CATEGORY = PUSH_CATEGORY = {}));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Результат принятия обхода в текущем процессе API, а не результат доставки уведомлений. */
|
|
2
|
-
export declare enum PUSH_DAILY_REMINDER_START_STATUS {
|
|
3
|
-
/** Новый обход принят для фонового выполнения; завершение ещё не подтверждено. */
|
|
4
|
-
STARTED = "STARTED",
|
|
5
|
-
/** В этом процессе уже есть принятый или выполняющийся обход; второй не запущен. */
|
|
6
|
-
ALREADY_RUNNING = "ALREADY_RUNNING"
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_DAILY_REMINDER_START_STATUS = void 0;
|
|
4
|
-
/** Результат принятия обхода в текущем процессе API, а не результат доставки уведомлений. */
|
|
5
|
-
var PUSH_DAILY_REMINDER_START_STATUS;
|
|
6
|
-
(function (PUSH_DAILY_REMINDER_START_STATUS) {
|
|
7
|
-
/** Новый обход принят для фонового выполнения; завершение ещё не подтверждено. */
|
|
8
|
-
PUSH_DAILY_REMINDER_START_STATUS["STARTED"] = "STARTED";
|
|
9
|
-
/** В этом процессе уже есть принятый или выполняющийся обход; второй не запущен. */
|
|
10
|
-
PUSH_DAILY_REMINDER_START_STATUS["ALREADY_RUNNING"] = "ALREADY_RUNNING";
|
|
11
|
-
})(PUSH_DAILY_REMINDER_START_STATUS || (exports.PUSH_DAILY_REMINDER_START_STATUS = PUSH_DAILY_REMINDER_START_STATUS = {}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/** Результат отправки; подтверждение открытия хранится отдельно в openedAt. */
|
|
2
|
-
export declare enum PUSH_MESSAGE_STATUS {
|
|
3
|
-
/** Сообщение подготовлено в БД; попытка отправки провайдеру ещё не зафиксирована. */
|
|
4
|
-
PENDING = "pending",
|
|
5
|
-
/** Expo принял сообщение; результат передачи в APNs/FCM ещё не проверен. */
|
|
6
|
-
SENT = "sent",
|
|
7
|
-
/** По квитанции Expo сообщение принято APNs/FCM; получение устройством не подтверждено. */
|
|
8
|
-
DELIVERED = "delivered",
|
|
9
|
-
/** Отправка или дальнейшая передача провайдеру завершилась ошибкой. */
|
|
10
|
-
FAILED = "failed",
|
|
11
|
-
/** Отправка пропущена из-за настроек или других правил отбора. */
|
|
12
|
-
SKIPPED = "skipped"
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_MESSAGE_STATUS = void 0;
|
|
4
|
-
/** Результат отправки; подтверждение открытия хранится отдельно в openedAt. */
|
|
5
|
-
var PUSH_MESSAGE_STATUS;
|
|
6
|
-
(function (PUSH_MESSAGE_STATUS) {
|
|
7
|
-
/** Сообщение подготовлено в БД; попытка отправки провайдеру ещё не зафиксирована. */
|
|
8
|
-
PUSH_MESSAGE_STATUS["PENDING"] = "pending";
|
|
9
|
-
/** Expo принял сообщение; результат передачи в APNs/FCM ещё не проверен. */
|
|
10
|
-
PUSH_MESSAGE_STATUS["SENT"] = "sent";
|
|
11
|
-
/** По квитанции Expo сообщение принято APNs/FCM; получение устройством не подтверждено. */
|
|
12
|
-
PUSH_MESSAGE_STATUS["DELIVERED"] = "delivered";
|
|
13
|
-
/** Отправка или дальнейшая передача провайдеру завершилась ошибкой. */
|
|
14
|
-
PUSH_MESSAGE_STATUS["FAILED"] = "failed";
|
|
15
|
-
/** Отправка пропущена из-за настроек или других правил отбора. */
|
|
16
|
-
PUSH_MESSAGE_STATUS["SKIPPED"] = "skipped";
|
|
17
|
-
})(PUSH_MESSAGE_STATUS || (exports.PUSH_MESSAGE_STATUS = PUSH_MESSAGE_STATUS = {}));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Событие, из-за которого сформировано уведомление. */
|
|
2
|
-
export declare enum PUSH_MESSAGE_TYPE {
|
|
3
|
-
/** Результат генерации инструмента готов к открытию. */
|
|
4
|
-
JOB_COMPLETED = "job_completed",
|
|
5
|
-
/** Генерация инструмента завершилась ошибкой. */
|
|
6
|
-
JOB_FAILED = "job_failed",
|
|
7
|
-
/** Ответ в чате сохранён и готов к чтению. */
|
|
8
|
-
CHAT_ANSWER = "chat_answer",
|
|
9
|
-
/** Напоминание забрать ежедневную награду и сохранить серию. */
|
|
10
|
-
STREAK_REMINDER = "streak_reminder",
|
|
11
|
-
/** Уведомление в рамках административной кампании. */
|
|
12
|
-
CAMPAIGN = "campaign",
|
|
13
|
-
/** Служебное уведомление для проверки доставки администратору себе. */
|
|
14
|
-
TEST = "test"
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_MESSAGE_TYPE = void 0;
|
|
4
|
-
/** Событие, из-за которого сформировано уведомление. */
|
|
5
|
-
var PUSH_MESSAGE_TYPE;
|
|
6
|
-
(function (PUSH_MESSAGE_TYPE) {
|
|
7
|
-
/** Результат генерации инструмента готов к открытию. */
|
|
8
|
-
PUSH_MESSAGE_TYPE["JOB_COMPLETED"] = "job_completed";
|
|
9
|
-
/** Генерация инструмента завершилась ошибкой. */
|
|
10
|
-
PUSH_MESSAGE_TYPE["JOB_FAILED"] = "job_failed";
|
|
11
|
-
/** Ответ в чате сохранён и готов к чтению. */
|
|
12
|
-
PUSH_MESSAGE_TYPE["CHAT_ANSWER"] = "chat_answer";
|
|
13
|
-
/** Напоминание забрать ежедневную награду и сохранить серию. */
|
|
14
|
-
PUSH_MESSAGE_TYPE["STREAK_REMINDER"] = "streak_reminder";
|
|
15
|
-
/** Уведомление в рамках административной кампании. */
|
|
16
|
-
PUSH_MESSAGE_TYPE["CAMPAIGN"] = "campaign";
|
|
17
|
-
/** Служебное уведомление для проверки доставки администратору себе. */
|
|
18
|
-
PUSH_MESSAGE_TYPE["TEST"] = "test";
|
|
19
|
-
})(PUSH_MESSAGE_TYPE || (exports.PUSH_MESSAGE_TYPE = PUSH_MESSAGE_TYPE = {}));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Платформа установки приложения; сервис доставки задаётся отдельно в provider. */
|
|
2
|
-
export declare enum PUSH_PLATFORM {
|
|
3
|
-
/** iOS; регистрация поддерживает только провайдер Expo. */
|
|
4
|
-
IOS = "ios",
|
|
5
|
-
/** Android; провайдером может быть Expo или RuStore. */
|
|
6
|
-
ANDROID = "android"
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_PLATFORM = void 0;
|
|
4
|
-
/** Платформа установки приложения; сервис доставки задаётся отдельно в provider. */
|
|
5
|
-
var PUSH_PLATFORM;
|
|
6
|
-
(function (PUSH_PLATFORM) {
|
|
7
|
-
/** iOS; регистрация поддерживает только провайдер Expo. */
|
|
8
|
-
PUSH_PLATFORM["IOS"] = "ios";
|
|
9
|
-
/** Android; провайдером может быть Expo или RuStore. */
|
|
10
|
-
PUSH_PLATFORM["ANDROID"] = "android";
|
|
11
|
-
})(PUSH_PLATFORM || (exports.PUSH_PLATFORM = PUSH_PLATFORM = {}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_PROVIDER = void 0;
|
|
4
|
-
/** Сервис, которому принадлежит push-токен установки приложения. */
|
|
5
|
-
var PUSH_PROVIDER;
|
|
6
|
-
(function (PUSH_PROVIDER) {
|
|
7
|
-
/** Expo Push Service, передающий уведомления в APNs/FCM. */
|
|
8
|
-
PUSH_PROVIDER["EXPO"] = "expo";
|
|
9
|
-
/** RuStore Push для Android. */
|
|
10
|
-
PUSH_PROVIDER["RUSTORE"] = "rustore";
|
|
11
|
-
})(PUSH_PROVIDER || (exports.PUSH_PROVIDER = PUSH_PROVIDER = {}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Причина пропуска тестовой отправки или конкретного устройства. */
|
|
2
|
-
export declare enum PUSH_SKIP_REASON {
|
|
3
|
-
/** У пользователя нет активных регистраций за последние 90 дней. */
|
|
4
|
-
NO_ACTIVE_DEVICES = "no_active_devices",
|
|
5
|
-
/** Пользователь отключил категорию результатов. */
|
|
6
|
-
RESULTS_DISABLED = "results_disabled",
|
|
7
|
-
/** Отправка через провайдер этой регистрации ещё не поддерживается. */
|
|
8
|
-
UNSUPPORTED_PROVIDER = "unsupported_provider",
|
|
9
|
-
/** Регистрация отсутствует, отключена, устарела или изменилась после подготовки сообщения. */
|
|
10
|
-
DEVICE_UNAVAILABLE = "device_unavailable"
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_SKIP_REASON = void 0;
|
|
4
|
-
/** Причина пропуска тестовой отправки или конкретного устройства. */
|
|
5
|
-
var PUSH_SKIP_REASON;
|
|
6
|
-
(function (PUSH_SKIP_REASON) {
|
|
7
|
-
/** У пользователя нет активных регистраций за последние 90 дней. */
|
|
8
|
-
PUSH_SKIP_REASON["NO_ACTIVE_DEVICES"] = "no_active_devices";
|
|
9
|
-
/** Пользователь отключил категорию результатов. */
|
|
10
|
-
PUSH_SKIP_REASON["RESULTS_DISABLED"] = "results_disabled";
|
|
11
|
-
/** Отправка через провайдер этой регистрации ещё не поддерживается. */
|
|
12
|
-
PUSH_SKIP_REASON["UNSUPPORTED_PROVIDER"] = "unsupported_provider";
|
|
13
|
-
/** Регистрация отсутствует, отключена, устарела или изменилась после подготовки сообщения. */
|
|
14
|
-
PUSH_SKIP_REASON["DEVICE_UNAVAILABLE"] = "device_unavailable";
|
|
15
|
-
})(PUSH_SKIP_REASON || (exports.PUSH_SKIP_REASON = PUSH_SKIP_REASON = {}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./enums"), exports);
|
|
18
|
-
__exportStar(require("./push-settings-defaults"), exports);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { ImageModelPricingRules } from '../../models';
|
|
2
|
-
export type GptImage2Quality = 'low' | 'medium' | 'high';
|
|
3
|
-
export type GptImage2AspectRatio = '1:1' | '4:3' | '5:4' | '16:9' | '21:9' | '3:4' | '4:5' | '9:16' | '9:21';
|
|
4
|
-
export type GptImage2ResolutionTier = '1K' | '2K' | '4K';
|
|
5
|
-
export type GptImage2Size = {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const GPT_IMAGE_2_DEFAULT_OUTPUT_PRICE_PER_1M_USD = 30;
|
|
10
|
-
export declare const DEFAULT_STAR_PRICE_USD = 0.018;
|
|
11
|
-
export declare const DEFAULT_TARGET_MARGIN = 0.6;
|
|
12
|
-
export declare const GPT_IMAGE_2_INPUT_IMAGE_SURCHARGE_STARS = 2;
|
|
13
|
-
export declare function getGptImage2OutputTokensByTier(params: {
|
|
14
|
-
quality: GptImage2Quality;
|
|
15
|
-
aspectRatio: GptImage2AspectRatio;
|
|
16
|
-
resolutionTier: GptImage2ResolutionTier;
|
|
17
|
-
}): number;
|
|
18
|
-
export declare function normalizeGptImage2SizeToOpenAILimits(size: GptImage2Size): GptImage2Size;
|
|
19
|
-
export declare function calculateGptImage2OutputTokensFromSize(params: {
|
|
20
|
-
quality: GptImage2Quality;
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
}): number;
|
|
24
|
-
export declare function estimateGptImage2OutputCostUsdFromTokens(params: {
|
|
25
|
-
outputTokens: number;
|
|
26
|
-
outputPricePer1MUsd?: number;
|
|
27
|
-
}): number;
|
|
28
|
-
export declare function applyTargetMargin(params: {
|
|
29
|
-
cost: number;
|
|
30
|
-
targetMargin?: number;
|
|
31
|
-
}): number;
|
|
32
|
-
export declare function convertUsdToStarsCeil(params: {
|
|
33
|
-
usd: number;
|
|
34
|
-
starPriceUsd?: number;
|
|
35
|
-
}): number;
|
|
36
|
-
export declare function calculateGptImage2PriceInStarsFromTokens(params: {
|
|
37
|
-
outputTokens: number;
|
|
38
|
-
hasAttachedImage?: boolean;
|
|
39
|
-
outputPricePer1MUsd?: number;
|
|
40
|
-
targetMargin?: number;
|
|
41
|
-
starPriceUsd?: number;
|
|
42
|
-
}): {
|
|
43
|
-
costUsd: number;
|
|
44
|
-
sellUsd: number;
|
|
45
|
-
costStars: number;
|
|
46
|
-
sellStars: number;
|
|
47
|
-
};
|
|
48
|
-
export declare function calculateGptImage2PriceInStarsByTier(params: {
|
|
49
|
-
quality: GptImage2Quality;
|
|
50
|
-
aspectRatio: GptImage2AspectRatio;
|
|
51
|
-
resolutionTier: GptImage2ResolutionTier;
|
|
52
|
-
hasAttachedImage?: boolean;
|
|
53
|
-
outputPricePer1MUsd?: number;
|
|
54
|
-
targetMargin?: number;
|
|
55
|
-
starPriceUsd?: number;
|
|
56
|
-
}, rules: ImageModelPricingRules, userHasActiveSubscriptionOrProduct: boolean): {
|
|
57
|
-
outputTokens: number;
|
|
58
|
-
costUsd: number;
|
|
59
|
-
sellUsd: number;
|
|
60
|
-
costStars: number;
|
|
61
|
-
sellStars: number;
|
|
62
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GPT_IMAGE_2_INPUT_IMAGE_SURCHARGE_STARS = exports.DEFAULT_TARGET_MARGIN = exports.DEFAULT_STAR_PRICE_USD = exports.GPT_IMAGE_2_DEFAULT_OUTPUT_PRICE_PER_1M_USD = void 0;
|
|
4
|
-
exports.getGptImage2OutputTokensByTier = getGptImage2OutputTokensByTier;
|
|
5
|
-
exports.normalizeGptImage2SizeToOpenAILimits = normalizeGptImage2SizeToOpenAILimits;
|
|
6
|
-
exports.calculateGptImage2OutputTokensFromSize = calculateGptImage2OutputTokensFromSize;
|
|
7
|
-
exports.estimateGptImage2OutputCostUsdFromTokens = estimateGptImage2OutputCostUsdFromTokens;
|
|
8
|
-
exports.applyTargetMargin = applyTargetMargin;
|
|
9
|
-
exports.convertUsdToStarsCeil = convertUsdToStarsCeil;
|
|
10
|
-
exports.calculateGptImage2PriceInStarsFromTokens = calculateGptImage2PriceInStarsFromTokens;
|
|
11
|
-
exports.calculateGptImage2PriceInStarsByTier = calculateGptImage2PriceInStarsByTier;
|
|
12
|
-
exports.GPT_IMAGE_2_DEFAULT_OUTPUT_PRICE_PER_1M_USD = 30;
|
|
13
|
-
exports.DEFAULT_STAR_PRICE_USD = 0.018;
|
|
14
|
-
exports.DEFAULT_TARGET_MARGIN = 0.6;
|
|
15
|
-
exports.GPT_IMAGE_2_INPUT_IMAGE_SURCHARGE_STARS = 2;
|
|
16
|
-
const GPT_IMAGE_2_BASE_SIZE_BY_ASPECT_RATIO = {
|
|
17
|
-
'1:1': { width: 1024, height: 1024 },
|
|
18
|
-
'4:3': { width: 1344, height: 1024 },
|
|
19
|
-
'5:4': { width: 1280, height: 1024 },
|
|
20
|
-
'16:9': { width: 1280, height: 720 },
|
|
21
|
-
'21:9': { width: 1680, height: 720 },
|
|
22
|
-
'3:4': { width: 1024, height: 1344 },
|
|
23
|
-
'4:5': { width: 1024, height: 1280 },
|
|
24
|
-
'9:16': { width: 720, height: 1280 },
|
|
25
|
-
'9:21': { width: 720, height: 1680 },
|
|
26
|
-
};
|
|
27
|
-
const GPT_IMAGE_2_QUALITY_BASE_TOKENS = {
|
|
28
|
-
low: 16,
|
|
29
|
-
medium: 48,
|
|
30
|
-
high: 96,
|
|
31
|
-
};
|
|
32
|
-
const GPT_IMAGE_2_RESOLUTION_MULTIPLIER = {
|
|
33
|
-
'1K': 1,
|
|
34
|
-
'2K': 2,
|
|
35
|
-
'4K': 4,
|
|
36
|
-
};
|
|
37
|
-
const GPT_IMAGE_2_MAX_EDGE = 3840;
|
|
38
|
-
const GPT_IMAGE_2_MAX_PIXEL_BUDGET = 8294400;
|
|
39
|
-
const GPT_IMAGE_2_SIZE_STEP = 16;
|
|
40
|
-
function getGptImage2OutputTokensByTier(params) {
|
|
41
|
-
const { quality, aspectRatio, resolutionTier } = params;
|
|
42
|
-
const baseSize = GPT_IMAGE_2_BASE_SIZE_BY_ASPECT_RATIO[aspectRatio];
|
|
43
|
-
const multiplier = GPT_IMAGE_2_RESOLUTION_MULTIPLIER[resolutionTier];
|
|
44
|
-
const normalizedSize = normalizeGptImage2SizeToOpenAILimits({
|
|
45
|
-
width: Math.round(baseSize.width * multiplier),
|
|
46
|
-
height: Math.round(baseSize.height * multiplier),
|
|
47
|
-
});
|
|
48
|
-
return calculateGptImage2OutputTokensFromSize(Object.assign({ quality }, normalizedSize));
|
|
49
|
-
}
|
|
50
|
-
function normalizeGptImage2SizeToOpenAILimits(size) {
|
|
51
|
-
let scale = 1;
|
|
52
|
-
const longestEdge = Math.max(size.width, size.height);
|
|
53
|
-
if (longestEdge > GPT_IMAGE_2_MAX_EDGE) {
|
|
54
|
-
scale = Math.min(scale, GPT_IMAGE_2_MAX_EDGE / longestEdge);
|
|
55
|
-
}
|
|
56
|
-
const pixelCount = size.width * size.height;
|
|
57
|
-
if (pixelCount > GPT_IMAGE_2_MAX_PIXEL_BUDGET) {
|
|
58
|
-
scale = Math.min(scale, Math.sqrt(GPT_IMAGE_2_MAX_PIXEL_BUDGET / pixelCount));
|
|
59
|
-
}
|
|
60
|
-
const normalizedWidth = Math.floor((size.width * scale) / GPT_IMAGE_2_SIZE_STEP) * GPT_IMAGE_2_SIZE_STEP;
|
|
61
|
-
const normalizedHeight = Math.floor((size.height * scale) / GPT_IMAGE_2_SIZE_STEP) * GPT_IMAGE_2_SIZE_STEP;
|
|
62
|
-
return {
|
|
63
|
-
width: Math.max(GPT_IMAGE_2_SIZE_STEP, normalizedWidth),
|
|
64
|
-
height: Math.max(GPT_IMAGE_2_SIZE_STEP, normalizedHeight),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function calculateGptImage2OutputTokensFromSize(params) {
|
|
68
|
-
const { quality, width, height } = params;
|
|
69
|
-
const longestEdge = Math.max(width, height);
|
|
70
|
-
const shortestEdge = Math.min(width, height);
|
|
71
|
-
const qualityBaseTokens = GPT_IMAGE_2_QUALITY_BASE_TOKENS[quality];
|
|
72
|
-
const scaledShortEdgeTokens = Math.round((qualityBaseTokens * shortestEdge) / longestEdge);
|
|
73
|
-
const widthTokens = width >= height ? qualityBaseTokens : scaledShortEdgeTokens;
|
|
74
|
-
const heightTokens = width >= height ? scaledShortEdgeTokens : qualityBaseTokens;
|
|
75
|
-
return Math.ceil((widthTokens * heightTokens * (2000000 + width * height)) / 4000000);
|
|
76
|
-
}
|
|
77
|
-
function estimateGptImage2OutputCostUsdFromTokens(params) {
|
|
78
|
-
const { outputTokens, outputPricePer1MUsd = exports.GPT_IMAGE_2_DEFAULT_OUTPUT_PRICE_PER_1M_USD } = params;
|
|
79
|
-
return (outputTokens / 1000000) * outputPricePer1MUsd;
|
|
80
|
-
}
|
|
81
|
-
function applyTargetMargin(params) {
|
|
82
|
-
const { cost, targetMargin = exports.DEFAULT_TARGET_MARGIN } = params;
|
|
83
|
-
if (targetMargin < 0 || targetMargin >= 1) {
|
|
84
|
-
throw new Error(`targetMargin must be in [0, 1), got ${targetMargin}`);
|
|
85
|
-
}
|
|
86
|
-
return cost / (1 - targetMargin);
|
|
87
|
-
}
|
|
88
|
-
function convertUsdToStarsCeil(params) {
|
|
89
|
-
const { usd, starPriceUsd = exports.DEFAULT_STAR_PRICE_USD } = params;
|
|
90
|
-
if (starPriceUsd <= 0) {
|
|
91
|
-
throw new Error(`starPriceUsd must be > 0, got ${starPriceUsd}`);
|
|
92
|
-
}
|
|
93
|
-
return Math.max(1, Math.ceil(usd / starPriceUsd));
|
|
94
|
-
}
|
|
95
|
-
function calculateGptImage2PriceInStarsFromTokens(params) {
|
|
96
|
-
const costUsd = estimateGptImage2OutputCostUsdFromTokens({
|
|
97
|
-
outputTokens: params.outputTokens,
|
|
98
|
-
outputPricePer1MUsd: params.outputPricePer1MUsd,
|
|
99
|
-
});
|
|
100
|
-
const sellUsd = applyTargetMargin({
|
|
101
|
-
cost: costUsd,
|
|
102
|
-
targetMargin: params.targetMargin,
|
|
103
|
-
});
|
|
104
|
-
const sellStars = convertUsdToStarsCeil({ usd: sellUsd, starPriceUsd: params.starPriceUsd });
|
|
105
|
-
const finalSellStars = sellStars + (params.hasAttachedImage ? exports.GPT_IMAGE_2_INPUT_IMAGE_SURCHARGE_STARS : 0);
|
|
106
|
-
return {
|
|
107
|
-
costUsd,
|
|
108
|
-
sellUsd,
|
|
109
|
-
costStars: convertUsdToStarsCeil({ usd: costUsd, starPriceUsd: params.starPriceUsd }),
|
|
110
|
-
sellStars: finalSellStars,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
function calculateGptImage2PriceInStarsByTier(params, rules, userHasActiveSubscriptionOrProduct) {
|
|
114
|
-
const outputTokens = getGptImage2OutputTokensByTier({
|
|
115
|
-
quality: params.quality,
|
|
116
|
-
aspectRatio: params.aspectRatio,
|
|
117
|
-
resolutionTier: params.resolutionTier,
|
|
118
|
-
});
|
|
119
|
-
const priced = calculateGptImage2PriceInStarsFromTokens({
|
|
120
|
-
outputTokens,
|
|
121
|
-
hasAttachedImage: params.hasAttachedImage,
|
|
122
|
-
outputPricePer1MUsd: params.outputPricePer1MUsd,
|
|
123
|
-
targetMargin: params.targetMargin,
|
|
124
|
-
starPriceUsd: params.starPriceUsd,
|
|
125
|
-
});
|
|
126
|
-
let finalSellStars = priced.sellStars;
|
|
127
|
-
for (const rule of rules !== null && rules !== void 0 ? rules : []) {
|
|
128
|
-
const condition = rule.condition;
|
|
129
|
-
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
130
|
-
finalSellStars += rule.value;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (params.quality === 'low') {
|
|
134
|
-
finalSellStars += 2;
|
|
135
|
-
}
|
|
136
|
-
return Object.assign(Object.assign({ outputTokens }, priced), { sellStars: finalSellStars });
|
|
137
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./push-device.schema"), exports);
|
|
18
|
-
__exportStar(require("./push-settings.schema"), exports);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { PUSH_PLATFORM, PUSH_PROVIDER } from '../../constants/push';
|
|
3
|
-
export declare const PushTokenSchema: z.ZodString;
|
|
4
|
-
export declare const PushDeviceSchema: z.ZodObject<{
|
|
5
|
-
uuid: z.ZodUUID;
|
|
6
|
-
userId: z.ZodUUID;
|
|
7
|
-
token: z.ZodString;
|
|
8
|
-
provider: z.ZodEnum<typeof PUSH_PROVIDER>;
|
|
9
|
-
platform: z.ZodEnum<typeof PUSH_PLATFORM>;
|
|
10
|
-
appVersion: z.ZodString;
|
|
11
|
-
locale: z.ZodString;
|
|
12
|
-
timezone: z.ZodString;
|
|
13
|
-
lastSeenAt: z.ZodDate;
|
|
14
|
-
createdAt: z.ZodDate;
|
|
15
|
-
invalidatedAt: z.ZodNullable<z.ZodDate>;
|
|
16
|
-
}, z.core.$strip>;
|
|
17
|
-
export type PushDevice = z.infer<typeof PushDeviceSchema>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PushDeviceSchema = exports.PushTokenSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const push_1 = require("../../constants/push");
|
|
6
|
-
exports.PushTokenSchema = zod_1.z.string().min(1).max(4096).regex(/^\S+$/u);
|
|
7
|
-
const timezoneSchema = zod_1.z
|
|
8
|
-
.string()
|
|
9
|
-
.min(1)
|
|
10
|
-
.max(128)
|
|
11
|
-
.refine((value) => {
|
|
12
|
-
if (/^[+-]/u.test(value))
|
|
13
|
-
return false;
|
|
14
|
-
try {
|
|
15
|
-
new Intl.DateTimeFormat('en', { timeZone: value });
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
catch (_a) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}, 'Invalid IANA timezone');
|
|
22
|
-
exports.PushDeviceSchema = zod_1.z.object({
|
|
23
|
-
uuid: zod_1.z.uuid(),
|
|
24
|
-
userId: zod_1.z.uuid(),
|
|
25
|
-
token: exports.PushTokenSchema,
|
|
26
|
-
provider: zod_1.z.enum(push_1.PUSH_PROVIDER),
|
|
27
|
-
platform: zod_1.z.enum(push_1.PUSH_PLATFORM),
|
|
28
|
-
appVersion: zod_1.z.string().trim().min(1).max(64),
|
|
29
|
-
locale: zod_1.z.string().trim().min(1).max(32),
|
|
30
|
-
timezone: timezoneSchema,
|
|
31
|
-
lastSeenAt: zod_1.z.date(),
|
|
32
|
-
createdAt: zod_1.z.date(),
|
|
33
|
-
invalidatedAt: zod_1.z.date().nullable(),
|
|
34
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PushSettingsSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.PushSettingsSchema = zod_1.z.strictObject({
|
|
6
|
-
results: zod_1.z.boolean(),
|
|
7
|
-
daily: zod_1.z.boolean(),
|
|
8
|
-
promo: zod_1.z.boolean(),
|
|
9
|
-
});
|