@mpgd/catalog 0.1.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.
- package/LICENSE +21 -0
- package/catalog.json +46 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +395 -0
- package/package.json +59 -0
- package/placements.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 imjlk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/catalog.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2026-07-03",
|
|
3
|
+
"products": [
|
|
4
|
+
{
|
|
5
|
+
"id": "COINS_100",
|
|
6
|
+
"type": "consumable",
|
|
7
|
+
"grant": {
|
|
8
|
+
"type": "currency",
|
|
9
|
+
"currency": "coin",
|
|
10
|
+
"amount": 100
|
|
11
|
+
},
|
|
12
|
+
"platformProductIds": {
|
|
13
|
+
"android": "coins_100",
|
|
14
|
+
"ios": "com.mpgd.game.coins100",
|
|
15
|
+
"ait": "coins_100"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "COINS_500",
|
|
20
|
+
"type": "consumable",
|
|
21
|
+
"grant": {
|
|
22
|
+
"type": "currency",
|
|
23
|
+
"currency": "coin",
|
|
24
|
+
"amount": 500
|
|
25
|
+
},
|
|
26
|
+
"platformProductIds": {
|
|
27
|
+
"android": "coins_500",
|
|
28
|
+
"ios": "com.mpgd.game.coins500",
|
|
29
|
+
"ait": "coins_500"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "REMOVE_ADS",
|
|
34
|
+
"type": "non_consumable",
|
|
35
|
+
"grant": {
|
|
36
|
+
"type": "entitlement",
|
|
37
|
+
"entitlement": "remove_ads"
|
|
38
|
+
},
|
|
39
|
+
"platformProductIds": {
|
|
40
|
+
"android": "remove_ads",
|
|
41
|
+
"ios": "com.mpgd.game.remove_ads",
|
|
42
|
+
"ait": "remove_ads"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { LogicalAdPlacementId, LogicalProductId, ProductType } from '@mpgd/platform';
|
|
2
|
+
export type CatalogTarget = 'android' | 'ios' | 'ait';
|
|
3
|
+
export type AdPlacementTarget = CatalogTarget;
|
|
4
|
+
export type ProductGrant = {
|
|
5
|
+
readonly type: 'currency';
|
|
6
|
+
readonly currency: 'coin' | 'gem';
|
|
7
|
+
readonly amount: number;
|
|
8
|
+
} | {
|
|
9
|
+
readonly type: 'entitlement';
|
|
10
|
+
readonly entitlement: string;
|
|
11
|
+
};
|
|
12
|
+
export interface ProductCatalogEntry {
|
|
13
|
+
readonly id: LogicalProductId;
|
|
14
|
+
readonly type: ProductType;
|
|
15
|
+
readonly grant: ProductGrant;
|
|
16
|
+
readonly platformProductIds: Partial<Record<CatalogTarget, string>>;
|
|
17
|
+
}
|
|
18
|
+
export interface ProductCatalog {
|
|
19
|
+
readonly version: string;
|
|
20
|
+
readonly products: readonly ProductCatalogEntry[];
|
|
21
|
+
}
|
|
22
|
+
export interface FrequencyCap {
|
|
23
|
+
readonly cooldownSeconds: number;
|
|
24
|
+
readonly maxPerSession?: number;
|
|
25
|
+
readonly minStageInterval?: number;
|
|
26
|
+
}
|
|
27
|
+
export type AdReward = {
|
|
28
|
+
readonly type: 'continue';
|
|
29
|
+
readonly amount: number;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: 'currency';
|
|
32
|
+
readonly amount: number;
|
|
33
|
+
readonly currency: 'coin' | 'gem';
|
|
34
|
+
};
|
|
35
|
+
export interface AdPlacementEntry {
|
|
36
|
+
readonly id: LogicalAdPlacementId;
|
|
37
|
+
readonly type: 'rewarded' | 'interstitial';
|
|
38
|
+
readonly reward?: AdReward;
|
|
39
|
+
readonly frequencyCap: FrequencyCap;
|
|
40
|
+
readonly platformPlacementIds: Partial<Record<AdPlacementTarget, string>>;
|
|
41
|
+
}
|
|
42
|
+
export interface AdPlacements {
|
|
43
|
+
readonly version: string;
|
|
44
|
+
readonly placements: readonly AdPlacementEntry[];
|
|
45
|
+
}
|
|
46
|
+
export declare const assertProductCatalog: (input: unknown) => ProductCatalog;
|
|
47
|
+
export declare const assertAdPlacements: (input: unknown) => AdPlacements;
|
|
48
|
+
export declare const assertProductGrant: (input: unknown) => ProductGrant;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import * as _a from "typia/lib/internal/_assertGuard";
|
|
2
|
+
import typia from 'typia';
|
|
3
|
+
export const assertProductCatalog = (() => {
|
|
4
|
+
const _ae0 = "({ readonly type: \"currency\"; readonly currency: \"coin\" | \"gem\"; readonly amount: number; } | { readonly type: \"entitlement\"; readonly entitlement: string; })";
|
|
5
|
+
const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.version || _a._assertGuard(_exceptionable, {
|
|
6
|
+
method: "typia.createAssert",
|
|
7
|
+
path: _path + ".version",
|
|
8
|
+
expected: "string",
|
|
9
|
+
value: input.version
|
|
10
|
+
}, _errorFactory)) && ((Array.isArray(input.products) || _a._assertGuard(_exceptionable, {
|
|
11
|
+
method: "typia.createAssert",
|
|
12
|
+
path: _path + ".products",
|
|
13
|
+
expected: "ReadonlyArray<ProductCatalogEntry>",
|
|
14
|
+
value: input.products
|
|
15
|
+
}, _errorFactory)) && input.products.every((elem, _index2) => ("object" === typeof elem && null !== elem || _a._assertGuard(_exceptionable, {
|
|
16
|
+
method: "typia.createAssert",
|
|
17
|
+
path: _path + ".products[" + _index2 + "]",
|
|
18
|
+
expected: "ProductCatalogEntry",
|
|
19
|
+
value: elem
|
|
20
|
+
}, _errorFactory)) && _ao1(elem, _path + ".products[" + _index2 + "]", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
21
|
+
method: "typia.createAssert",
|
|
22
|
+
path: _path + ".products[" + _index2 + "]",
|
|
23
|
+
expected: "ProductCatalogEntry",
|
|
24
|
+
value: elem
|
|
25
|
+
}, _errorFactory)) || _a._assertGuard(_exceptionable, {
|
|
26
|
+
method: "typia.createAssert",
|
|
27
|
+
path: _path + ".products",
|
|
28
|
+
expected: "ReadonlyArray<ProductCatalogEntry>",
|
|
29
|
+
value: input.products
|
|
30
|
+
}, _errorFactory));
|
|
31
|
+
const _ao1 = (input, _path, _exceptionable = true) => ("COINS_100" === input.id || "COINS_500" === input.id || "REMOVE_ADS" === input.id || _a._assertGuard(_exceptionable, {
|
|
32
|
+
method: "typia.createAssert",
|
|
33
|
+
path: _path + ".id",
|
|
34
|
+
expected: "(\"COINS_100\" | \"COINS_500\" | \"REMOVE_ADS\")",
|
|
35
|
+
value: input.id
|
|
36
|
+
}, _errorFactory)) && ("consumable" === input.type || "non_consumable" === input.type || "subscription" === input.type || _a._assertGuard(_exceptionable, {
|
|
37
|
+
method: "typia.createAssert",
|
|
38
|
+
path: _path + ".type",
|
|
39
|
+
expected: "(\"consumable\" | \"non_consumable\" | \"subscription\")",
|
|
40
|
+
value: input.type
|
|
41
|
+
}, _errorFactory)) && (("object" === typeof input.grant && null !== input.grant || _a._assertGuard(_exceptionable, {
|
|
42
|
+
method: "typia.createAssert",
|
|
43
|
+
path: _path + ".grant",
|
|
44
|
+
expected: _ae0,
|
|
45
|
+
value: input.grant
|
|
46
|
+
}, _errorFactory)) && _au0(input.grant, _path + ".grant", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
47
|
+
method: "typia.createAssert",
|
|
48
|
+
path: _path + ".grant",
|
|
49
|
+
expected: _ae0,
|
|
50
|
+
value: input.grant
|
|
51
|
+
}, _errorFactory)) && (("object" === typeof input.platformProductIds && null !== input.platformProductIds && false === Array.isArray(input.platformProductIds) || _a._assertGuard(_exceptionable, {
|
|
52
|
+
method: "typia.createAssert",
|
|
53
|
+
path: _path + ".platformProductIds",
|
|
54
|
+
expected: "Partial<Record<CatalogTarget, string>>",
|
|
55
|
+
value: input.platformProductIds
|
|
56
|
+
}, _errorFactory)) && _ao4(input.platformProductIds, _path + ".platformProductIds", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
57
|
+
method: "typia.createAssert",
|
|
58
|
+
path: _path + ".platformProductIds",
|
|
59
|
+
expected: "Partial<Record<CatalogTarget, string>>",
|
|
60
|
+
value: input.platformProductIds
|
|
61
|
+
}, _errorFactory));
|
|
62
|
+
const _ao2 = (input, _path, _exceptionable = true) => ("currency" === input.type || _a._assertGuard(_exceptionable, {
|
|
63
|
+
method: "typia.createAssert",
|
|
64
|
+
path: _path + ".type",
|
|
65
|
+
expected: "\"currency\"",
|
|
66
|
+
value: input.type
|
|
67
|
+
}, _errorFactory)) && ("coin" === input.currency || "gem" === input.currency || _a._assertGuard(_exceptionable, {
|
|
68
|
+
method: "typia.createAssert",
|
|
69
|
+
path: _path + ".currency",
|
|
70
|
+
expected: "(\"coin\" | \"gem\")",
|
|
71
|
+
value: input.currency
|
|
72
|
+
}, _errorFactory)) && ("number" === typeof input.amount || _a._assertGuard(_exceptionable, {
|
|
73
|
+
method: "typia.createAssert",
|
|
74
|
+
path: _path + ".amount",
|
|
75
|
+
expected: "number",
|
|
76
|
+
value: input.amount
|
|
77
|
+
}, _errorFactory));
|
|
78
|
+
const _ao3 = (input, _path, _exceptionable = true) => ("entitlement" === input.type || _a._assertGuard(_exceptionable, {
|
|
79
|
+
method: "typia.createAssert",
|
|
80
|
+
path: _path + ".type",
|
|
81
|
+
expected: "\"entitlement\"",
|
|
82
|
+
value: input.type
|
|
83
|
+
}, _errorFactory)) && ("string" === typeof input.entitlement || _a._assertGuard(_exceptionable, {
|
|
84
|
+
method: "typia.createAssert",
|
|
85
|
+
path: _path + ".entitlement",
|
|
86
|
+
expected: "string",
|
|
87
|
+
value: input.entitlement
|
|
88
|
+
}, _errorFactory));
|
|
89
|
+
const _ao4 = (input, _path, _exceptionable = true) => (undefined === input.ait || "string" === typeof input.ait || _a._assertGuard(_exceptionable, {
|
|
90
|
+
method: "typia.createAssert",
|
|
91
|
+
path: _path + ".ait",
|
|
92
|
+
expected: "(string | undefined)",
|
|
93
|
+
value: input.ait
|
|
94
|
+
}, _errorFactory)) && (undefined === input.android || "string" === typeof input.android || _a._assertGuard(_exceptionable, {
|
|
95
|
+
method: "typia.createAssert",
|
|
96
|
+
path: _path + ".android",
|
|
97
|
+
expected: "(string | undefined)",
|
|
98
|
+
value: input.android
|
|
99
|
+
}, _errorFactory)) && (undefined === input.ios || "string" === typeof input.ios || _a._assertGuard(_exceptionable, {
|
|
100
|
+
method: "typia.createAssert",
|
|
101
|
+
path: _path + ".ios",
|
|
102
|
+
expected: "(string | undefined)",
|
|
103
|
+
value: input.ios
|
|
104
|
+
}, _errorFactory));
|
|
105
|
+
const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
106
|
+
if ("currency" === input.type)
|
|
107
|
+
return _ao2(input, _path, true && _exceptionable);
|
|
108
|
+
else if ("entitlement" === input.type)
|
|
109
|
+
return _ao3(input, _path, true && _exceptionable);
|
|
110
|
+
else
|
|
111
|
+
return _a._assertGuard(_exceptionable, {
|
|
112
|
+
method: "typia.createAssert",
|
|
113
|
+
path: _path,
|
|
114
|
+
expected: _ae0,
|
|
115
|
+
value: input
|
|
116
|
+
}, _errorFactory);
|
|
117
|
+
})();
|
|
118
|
+
const _io0 = input => "string" === typeof input.version && (Array.isArray(input.products) && input.products.every(elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
119
|
+
const _io1 = input => ("COINS_100" === input.id || "COINS_500" === input.id || "REMOVE_ADS" === input.id) && ("consumable" === input.type || "non_consumable" === input.type || "subscription" === input.type) && ("object" === typeof input.grant && null !== input.grant && _iu0(input.grant)) && ("object" === typeof input.platformProductIds && null !== input.platformProductIds && false === Array.isArray(input.platformProductIds) && _io4(input.platformProductIds));
|
|
120
|
+
const _io2 = input => "currency" === input.type && ("coin" === input.currency || "gem" === input.currency) && "number" === typeof input.amount;
|
|
121
|
+
const _io3 = input => "entitlement" === input.type && "string" === typeof input.entitlement;
|
|
122
|
+
const _io4 = input => (undefined === input.ait || "string" === typeof input.ait) && (undefined === input.android || "string" === typeof input.android) && (undefined === input.ios || "string" === typeof input.ios);
|
|
123
|
+
const _iu0 = input => (() => {
|
|
124
|
+
if ("currency" === input.type)
|
|
125
|
+
return _io2(input);
|
|
126
|
+
else if ("entitlement" === input.type)
|
|
127
|
+
return _io3(input);
|
|
128
|
+
else
|
|
129
|
+
return false;
|
|
130
|
+
})();
|
|
131
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
132
|
+
let _errorFactory;
|
|
133
|
+
return (input, errorFactory) => {
|
|
134
|
+
if (false === __is(input)) {
|
|
135
|
+
_errorFactory = errorFactory;
|
|
136
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _a._assertGuard(true, {
|
|
137
|
+
method: "typia.createAssert",
|
|
138
|
+
path: _path + "",
|
|
139
|
+
expected: "ProductCatalog",
|
|
140
|
+
value: input
|
|
141
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _a._assertGuard(true, {
|
|
142
|
+
method: "typia.createAssert",
|
|
143
|
+
path: _path + "",
|
|
144
|
+
expected: "ProductCatalog",
|
|
145
|
+
value: input
|
|
146
|
+
}, _errorFactory))(input, "$input", true);
|
|
147
|
+
}
|
|
148
|
+
return input;
|
|
149
|
+
};
|
|
150
|
+
})();
|
|
151
|
+
export const assertAdPlacements = (() => {
|
|
152
|
+
const _ip0 = input => "number" === typeof input["amount"];
|
|
153
|
+
const _ae0 = "(undefined | { readonly type: \"continue\"; readonly amount: number; } | { readonly type: \"currency\"; readonly amount: number; readonly currency: \"coin\" | \"gem\"; })";
|
|
154
|
+
const _ap0 = (input, _path, _exceptionable = true) => "number" === typeof input["amount"] || _a._assertGuard(_exceptionable, {
|
|
155
|
+
method: "typia.createAssert",
|
|
156
|
+
path: _path + ".amount",
|
|
157
|
+
expected: "number",
|
|
158
|
+
value: input["amount"]
|
|
159
|
+
}, _errorFactory);
|
|
160
|
+
const _ae1 = "({ readonly type: \"continue\"; readonly amount: number; } | { readonly type: \"currency\"; readonly amount: number; readonly currency: \"coin\" | \"gem\"; })";
|
|
161
|
+
const _ao0 = (input, _path, _exceptionable = true) => ("string" === typeof input.version || _a._assertGuard(_exceptionable, {
|
|
162
|
+
method: "typia.createAssert",
|
|
163
|
+
path: _path + ".version",
|
|
164
|
+
expected: "string",
|
|
165
|
+
value: input.version
|
|
166
|
+
}, _errorFactory)) && ((Array.isArray(input.placements) || _a._assertGuard(_exceptionable, {
|
|
167
|
+
method: "typia.createAssert",
|
|
168
|
+
path: _path + ".placements",
|
|
169
|
+
expected: "ReadonlyArray<AdPlacementEntry>",
|
|
170
|
+
value: input.placements
|
|
171
|
+
}, _errorFactory)) && input.placements.every((elem, _index2) => ("object" === typeof elem && null !== elem || _a._assertGuard(_exceptionable, {
|
|
172
|
+
method: "typia.createAssert",
|
|
173
|
+
path: _path + ".placements[" + _index2 + "]",
|
|
174
|
+
expected: "AdPlacementEntry",
|
|
175
|
+
value: elem
|
|
176
|
+
}, _errorFactory)) && _ao1(elem, _path + ".placements[" + _index2 + "]", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
177
|
+
method: "typia.createAssert",
|
|
178
|
+
path: _path + ".placements[" + _index2 + "]",
|
|
179
|
+
expected: "AdPlacementEntry",
|
|
180
|
+
value: elem
|
|
181
|
+
}, _errorFactory)) || _a._assertGuard(_exceptionable, {
|
|
182
|
+
method: "typia.createAssert",
|
|
183
|
+
path: _path + ".placements",
|
|
184
|
+
expected: "ReadonlyArray<AdPlacementEntry>",
|
|
185
|
+
value: input.placements
|
|
186
|
+
}, _errorFactory));
|
|
187
|
+
const _ao1 = (input, _path, _exceptionable = true) => ("CONTINUE_AFTER_FAIL" === input.id || "STAGE_END_INTERSTITIAL" === input.id || _a._assertGuard(_exceptionable, {
|
|
188
|
+
method: "typia.createAssert",
|
|
189
|
+
path: _path + ".id",
|
|
190
|
+
expected: "(\"CONTINUE_AFTER_FAIL\" | \"STAGE_END_INTERSTITIAL\")",
|
|
191
|
+
value: input.id
|
|
192
|
+
}, _errorFactory)) && ("interstitial" === input.type || "rewarded" === input.type || _a._assertGuard(_exceptionable, {
|
|
193
|
+
method: "typia.createAssert",
|
|
194
|
+
path: _path + ".type",
|
|
195
|
+
expected: "(\"interstitial\" | \"rewarded\")",
|
|
196
|
+
value: input.type
|
|
197
|
+
}, _errorFactory)) && (undefined === input.reward || ("object" === typeof input.reward && null !== input.reward || _a._assertGuard(_exceptionable, {
|
|
198
|
+
method: "typia.createAssert",
|
|
199
|
+
path: _path + ".reward",
|
|
200
|
+
expected: _ae0,
|
|
201
|
+
value: input.reward
|
|
202
|
+
}, _errorFactory)) && _au0(input.reward, _path + ".reward", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
203
|
+
method: "typia.createAssert",
|
|
204
|
+
path: _path + ".reward",
|
|
205
|
+
expected: _ae0,
|
|
206
|
+
value: input.reward
|
|
207
|
+
}, _errorFactory)) && (("object" === typeof input.frequencyCap && null !== input.frequencyCap || _a._assertGuard(_exceptionable, {
|
|
208
|
+
method: "typia.createAssert",
|
|
209
|
+
path: _path + ".frequencyCap",
|
|
210
|
+
expected: "FrequencyCap",
|
|
211
|
+
value: input.frequencyCap
|
|
212
|
+
}, _errorFactory)) && _ao4(input.frequencyCap, _path + ".frequencyCap", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
213
|
+
method: "typia.createAssert",
|
|
214
|
+
path: _path + ".frequencyCap",
|
|
215
|
+
expected: "FrequencyCap",
|
|
216
|
+
value: input.frequencyCap
|
|
217
|
+
}, _errorFactory)) && (("object" === typeof input.platformPlacementIds && null !== input.platformPlacementIds && false === Array.isArray(input.platformPlacementIds) || _a._assertGuard(_exceptionable, {
|
|
218
|
+
method: "typia.createAssert",
|
|
219
|
+
path: _path + ".platformPlacementIds",
|
|
220
|
+
expected: "Partial<Record<CatalogTarget, string>>",
|
|
221
|
+
value: input.platformPlacementIds
|
|
222
|
+
}, _errorFactory)) && _ao5(input.platformPlacementIds, _path + ".platformPlacementIds", true && _exceptionable) || _a._assertGuard(_exceptionable, {
|
|
223
|
+
method: "typia.createAssert",
|
|
224
|
+
path: _path + ".platformPlacementIds",
|
|
225
|
+
expected: "Partial<Record<CatalogTarget, string>>",
|
|
226
|
+
value: input.platformPlacementIds
|
|
227
|
+
}, _errorFactory));
|
|
228
|
+
const _ao2 = (input, _path, _exceptionable = true) => ("continue" === input.type || _a._assertGuard(_exceptionable, {
|
|
229
|
+
method: "typia.createAssert",
|
|
230
|
+
path: _path + ".type",
|
|
231
|
+
expected: "\"continue\"",
|
|
232
|
+
value: input.type
|
|
233
|
+
}, _errorFactory)) && _ap0(input, _path, true && _exceptionable);
|
|
234
|
+
const _ao3 = (input, _path, _exceptionable = true) => ("currency" === input.type || _a._assertGuard(_exceptionable, {
|
|
235
|
+
method: "typia.createAssert",
|
|
236
|
+
path: _path + ".type",
|
|
237
|
+
expected: "\"currency\"",
|
|
238
|
+
value: input.type
|
|
239
|
+
}, _errorFactory)) && _ap0(input, _path, true && _exceptionable) && ("coin" === input.currency || "gem" === input.currency || _a._assertGuard(_exceptionable, {
|
|
240
|
+
method: "typia.createAssert",
|
|
241
|
+
path: _path + ".currency",
|
|
242
|
+
expected: "(\"coin\" | \"gem\")",
|
|
243
|
+
value: input.currency
|
|
244
|
+
}, _errorFactory));
|
|
245
|
+
const _ao4 = (input, _path, _exceptionable = true) => ("number" === typeof input.cooldownSeconds || _a._assertGuard(_exceptionable, {
|
|
246
|
+
method: "typia.createAssert",
|
|
247
|
+
path: _path + ".cooldownSeconds",
|
|
248
|
+
expected: "number",
|
|
249
|
+
value: input.cooldownSeconds
|
|
250
|
+
}, _errorFactory)) && (undefined === input.maxPerSession || "number" === typeof input.maxPerSession || _a._assertGuard(_exceptionable, {
|
|
251
|
+
method: "typia.createAssert",
|
|
252
|
+
path: _path + ".maxPerSession",
|
|
253
|
+
expected: "(number | undefined)",
|
|
254
|
+
value: input.maxPerSession
|
|
255
|
+
}, _errorFactory)) && (undefined === input.minStageInterval || "number" === typeof input.minStageInterval || _a._assertGuard(_exceptionable, {
|
|
256
|
+
method: "typia.createAssert",
|
|
257
|
+
path: _path + ".minStageInterval",
|
|
258
|
+
expected: "(number | undefined)",
|
|
259
|
+
value: input.minStageInterval
|
|
260
|
+
}, _errorFactory));
|
|
261
|
+
const _ao5 = (input, _path, _exceptionable = true) => (undefined === input.ait || "string" === typeof input.ait || _a._assertGuard(_exceptionable, {
|
|
262
|
+
method: "typia.createAssert",
|
|
263
|
+
path: _path + ".ait",
|
|
264
|
+
expected: "(string | undefined)",
|
|
265
|
+
value: input.ait
|
|
266
|
+
}, _errorFactory)) && (undefined === input.android || "string" === typeof input.android || _a._assertGuard(_exceptionable, {
|
|
267
|
+
method: "typia.createAssert",
|
|
268
|
+
path: _path + ".android",
|
|
269
|
+
expected: "(string | undefined)",
|
|
270
|
+
value: input.android
|
|
271
|
+
}, _errorFactory)) && (undefined === input.ios || "string" === typeof input.ios || _a._assertGuard(_exceptionable, {
|
|
272
|
+
method: "typia.createAssert",
|
|
273
|
+
path: _path + ".ios",
|
|
274
|
+
expected: "(string | undefined)",
|
|
275
|
+
value: input.ios
|
|
276
|
+
}, _errorFactory));
|
|
277
|
+
const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
278
|
+
if ("continue" === input.type)
|
|
279
|
+
return _ao2(input, _path, true && _exceptionable);
|
|
280
|
+
else if ("currency" === input.type)
|
|
281
|
+
return _ao3(input, _path, true && _exceptionable);
|
|
282
|
+
else
|
|
283
|
+
return _a._assertGuard(_exceptionable, {
|
|
284
|
+
method: "typia.createAssert",
|
|
285
|
+
path: _path,
|
|
286
|
+
expected: _ae1,
|
|
287
|
+
value: input
|
|
288
|
+
}, _errorFactory);
|
|
289
|
+
})();
|
|
290
|
+
const _io0 = input => "string" === typeof input.version && (Array.isArray(input.placements) && input.placements.every(elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
291
|
+
const _io1 = input => ("CONTINUE_AFTER_FAIL" === input.id || "STAGE_END_INTERSTITIAL" === input.id) && ("interstitial" === input.type || "rewarded" === input.type) && (undefined === input.reward || "object" === typeof input.reward && null !== input.reward && _iu0(input.reward)) && ("object" === typeof input.frequencyCap && null !== input.frequencyCap && _io4(input.frequencyCap)) && ("object" === typeof input.platformPlacementIds && null !== input.platformPlacementIds && false === Array.isArray(input.platformPlacementIds) && _io5(input.platformPlacementIds));
|
|
292
|
+
const _io2 = input => "continue" === input.type && _ip0(input);
|
|
293
|
+
const _io3 = input => "currency" === input.type && _ip0(input) && ("coin" === input.currency || "gem" === input.currency);
|
|
294
|
+
const _io4 = input => "number" === typeof input.cooldownSeconds && (undefined === input.maxPerSession || "number" === typeof input.maxPerSession) && (undefined === input.minStageInterval || "number" === typeof input.minStageInterval);
|
|
295
|
+
const _io5 = input => (undefined === input.ait || "string" === typeof input.ait) && (undefined === input.android || "string" === typeof input.android) && (undefined === input.ios || "string" === typeof input.ios);
|
|
296
|
+
const _iu0 = input => (() => {
|
|
297
|
+
if ("continue" === input.type)
|
|
298
|
+
return _io2(input);
|
|
299
|
+
else if ("currency" === input.type)
|
|
300
|
+
return _io3(input);
|
|
301
|
+
else
|
|
302
|
+
return false;
|
|
303
|
+
})();
|
|
304
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
305
|
+
let _errorFactory;
|
|
306
|
+
return (input, errorFactory) => {
|
|
307
|
+
if (false === __is(input)) {
|
|
308
|
+
_errorFactory = errorFactory;
|
|
309
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _a._assertGuard(true, {
|
|
310
|
+
method: "typia.createAssert",
|
|
311
|
+
path: _path + "",
|
|
312
|
+
expected: "AdPlacements",
|
|
313
|
+
value: input
|
|
314
|
+
}, _errorFactory)) && _ao0(input, _path + "", true) || _a._assertGuard(true, {
|
|
315
|
+
method: "typia.createAssert",
|
|
316
|
+
path: _path + "",
|
|
317
|
+
expected: "AdPlacements",
|
|
318
|
+
value: input
|
|
319
|
+
}, _errorFactory))(input, "$input", true);
|
|
320
|
+
}
|
|
321
|
+
return input;
|
|
322
|
+
};
|
|
323
|
+
})();
|
|
324
|
+
export const assertProductGrant = (() => {
|
|
325
|
+
const _ae0 = "({ readonly type: \"currency\"; readonly currency: \"coin\" | \"gem\"; readonly amount: number; } | { readonly type: \"entitlement\"; readonly entitlement: string; })";
|
|
326
|
+
const _ao0 = (input, _path, _exceptionable = true) => ("currency" === input.type || _a._assertGuard(_exceptionable, {
|
|
327
|
+
method: "typia.createAssert",
|
|
328
|
+
path: _path + ".type",
|
|
329
|
+
expected: "\"currency\"",
|
|
330
|
+
value: input.type
|
|
331
|
+
}, _errorFactory)) && ("coin" === input.currency || "gem" === input.currency || _a._assertGuard(_exceptionable, {
|
|
332
|
+
method: "typia.createAssert",
|
|
333
|
+
path: _path + ".currency",
|
|
334
|
+
expected: "(\"coin\" | \"gem\")",
|
|
335
|
+
value: input.currency
|
|
336
|
+
}, _errorFactory)) && ("number" === typeof input.amount || _a._assertGuard(_exceptionable, {
|
|
337
|
+
method: "typia.createAssert",
|
|
338
|
+
path: _path + ".amount",
|
|
339
|
+
expected: "number",
|
|
340
|
+
value: input.amount
|
|
341
|
+
}, _errorFactory));
|
|
342
|
+
const _ao1 = (input, _path, _exceptionable = true) => ("entitlement" === input.type || _a._assertGuard(_exceptionable, {
|
|
343
|
+
method: "typia.createAssert",
|
|
344
|
+
path: _path + ".type",
|
|
345
|
+
expected: "\"entitlement\"",
|
|
346
|
+
value: input.type
|
|
347
|
+
}, _errorFactory)) && ("string" === typeof input.entitlement || _a._assertGuard(_exceptionable, {
|
|
348
|
+
method: "typia.createAssert",
|
|
349
|
+
path: _path + ".entitlement",
|
|
350
|
+
expected: "string",
|
|
351
|
+
value: input.entitlement
|
|
352
|
+
}, _errorFactory));
|
|
353
|
+
const _au0 = (input, _path, _exceptionable = true) => (() => {
|
|
354
|
+
if ("currency" === input.type)
|
|
355
|
+
return _ao0(input, _path, true && _exceptionable);
|
|
356
|
+
else if ("entitlement" === input.type)
|
|
357
|
+
return _ao1(input, _path, true && _exceptionable);
|
|
358
|
+
else
|
|
359
|
+
return _a._assertGuard(_exceptionable, {
|
|
360
|
+
method: "typia.createAssert",
|
|
361
|
+
path: _path,
|
|
362
|
+
expected: _ae0,
|
|
363
|
+
value: input
|
|
364
|
+
}, _errorFactory);
|
|
365
|
+
})();
|
|
366
|
+
const _io0 = input => "currency" === input.type && ("coin" === input.currency || "gem" === input.currency) && "number" === typeof input.amount;
|
|
367
|
+
const _io1 = input => "entitlement" === input.type && "string" === typeof input.entitlement;
|
|
368
|
+
const _iu0 = input => (() => {
|
|
369
|
+
if ("currency" === input.type)
|
|
370
|
+
return _io0(input);
|
|
371
|
+
else if ("entitlement" === input.type)
|
|
372
|
+
return _io1(input);
|
|
373
|
+
else
|
|
374
|
+
return false;
|
|
375
|
+
})();
|
|
376
|
+
const __is = input => "object" === typeof input && null !== input && _iu0(input);
|
|
377
|
+
let _errorFactory;
|
|
378
|
+
return (input, errorFactory) => {
|
|
379
|
+
if (false === __is(input)) {
|
|
380
|
+
_errorFactory = errorFactory;
|
|
381
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _a._assertGuard(true, {
|
|
382
|
+
method: "typia.createAssert",
|
|
383
|
+
path: _path + "",
|
|
384
|
+
expected: _ae0,
|
|
385
|
+
value: input
|
|
386
|
+
}, _errorFactory)) && _au0(input, _path + "", true) || _a._assertGuard(true, {
|
|
387
|
+
method: "typia.createAssert",
|
|
388
|
+
path: _path + "",
|
|
389
|
+
expected: _ae0,
|
|
390
|
+
value: input
|
|
391
|
+
}, _errorFactory))(input, "$input", true);
|
|
392
|
+
}
|
|
393
|
+
return input;
|
|
394
|
+
};
|
|
395
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mpgd/catalog",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Product catalog and ad placement configuration schemas for mpgd games.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/imjlk/mpgd-kit.git",
|
|
9
|
+
"directory": "packages/catalog"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/imjlk/mpgd-kit/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/imjlk/mpgd-kit#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mpgd",
|
|
17
|
+
"phaser",
|
|
18
|
+
"vite",
|
|
19
|
+
"typescript",
|
|
20
|
+
"capacitor",
|
|
21
|
+
"apps-in-toss",
|
|
22
|
+
"game-development",
|
|
23
|
+
"game-distribution"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./catalog.json": "./catalog.json",
|
|
33
|
+
"./placements.json": "./placements.json"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"catalog.json",
|
|
38
|
+
"placements.json"
|
|
39
|
+
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"typia": "rc",
|
|
42
|
+
"@mpgd/platform": "0.1.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"ttsc": "0.16.9",
|
|
46
|
+
"typescript": "7.0.1-rc"
|
|
47
|
+
},
|
|
48
|
+
"main": "./dist/index.js",
|
|
49
|
+
"types": "./dist/index.d.ts",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"check": "ttsc --noEmit",
|
|
55
|
+
"lint": "ttsc --noEmit",
|
|
56
|
+
"format": "ttsc format",
|
|
57
|
+
"fix": "ttsc fix"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/placements.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2026-07-03",
|
|
3
|
+
"placements": [
|
|
4
|
+
{
|
|
5
|
+
"id": "CONTINUE_AFTER_FAIL",
|
|
6
|
+
"type": "rewarded",
|
|
7
|
+
"reward": {
|
|
8
|
+
"type": "continue",
|
|
9
|
+
"amount": 1
|
|
10
|
+
},
|
|
11
|
+
"frequencyCap": {
|
|
12
|
+
"cooldownSeconds": 60,
|
|
13
|
+
"maxPerSession": 3
|
|
14
|
+
},
|
|
15
|
+
"platformPlacementIds": {
|
|
16
|
+
"android": "ca-app-pub-xxx/reward_continue",
|
|
17
|
+
"ios": "ca-app-pub-yyy/reward_continue",
|
|
18
|
+
"ait": "ait_reward_continue"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "STAGE_END_INTERSTITIAL",
|
|
23
|
+
"type": "interstitial",
|
|
24
|
+
"frequencyCap": {
|
|
25
|
+
"cooldownSeconds": 120,
|
|
26
|
+
"minStageInterval": 3
|
|
27
|
+
},
|
|
28
|
+
"platformPlacementIds": {
|
|
29
|
+
"android": "ca-app-pub-xxx/inter_stage_end",
|
|
30
|
+
"ios": "ca-app-pub-yyy/inter_stage_end",
|
|
31
|
+
"ait": "ait_inter_stage_end"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|