glitch-javascript-sdk 4.0.1 → 4.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/dist/cjs/index.js +129 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Preorders.d.ts +162 -0
- package/dist/esm/api/index.d.ts +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +107 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/PreordersRoute.d.ts +7 -0
- package/dist/index.d.ts +162 -1
- package/guides/microtransactions.md +157 -9
- package/package.json +2 -2
- package/src/api/Preorders.ts +234 -0
- package/src/api/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/routes/PreordersRoute.ts +34 -0
package/dist/cjs/index.js
CHANGED
|
@@ -17324,14 +17324,19 @@ function requireNode () {
|
|
|
17324
17324
|
* treat as a browser.
|
|
17325
17325
|
*/
|
|
17326
17326
|
|
|
17327
|
-
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
src$1.exports
|
|
17327
|
+
var hasRequiredSrc;
|
|
17328
|
+
|
|
17329
|
+
function requireSrc () {
|
|
17330
|
+
if (hasRequiredSrc) return src$1.exports;
|
|
17331
|
+
hasRequiredSrc = 1;
|
|
17332
|
+
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
17333
|
+
src$1.exports = requireBrowser();
|
|
17334
|
+
} else {
|
|
17335
|
+
src$1.exports = requireNode();
|
|
17336
|
+
}
|
|
17337
|
+
return src$1.exports;
|
|
17331
17338
|
}
|
|
17332
17339
|
|
|
17333
|
-
var srcExports = src$1.exports;
|
|
17334
|
-
|
|
17335
17340
|
var promisify$1 = {};
|
|
17336
17341
|
|
|
17337
17342
|
Object.defineProperty(promisify$1, "__esModule", { value: true });
|
|
@@ -17355,7 +17360,7 @@ var __importDefault$3 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
17355
17360
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17356
17361
|
};
|
|
17357
17362
|
const events_1 = require$$0$3;
|
|
17358
|
-
const debug_1$3 = __importDefault$3(
|
|
17363
|
+
const debug_1$3 = __importDefault$3(requireSrc());
|
|
17359
17364
|
const promisify_1 = __importDefault$3(promisify$1);
|
|
17360
17365
|
const debug$4 = debug_1$3.default('agent-base');
|
|
17361
17366
|
function isAgent(v) {
|
|
@@ -17559,7 +17564,7 @@ var __importDefault$2 = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
|
|
|
17559
17564
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17560
17565
|
};
|
|
17561
17566
|
Object.defineProperty(parseProxyResponse$1, "__esModule", { value: true });
|
|
17562
|
-
const debug_1$2 = __importDefault$2(
|
|
17567
|
+
const debug_1$2 = __importDefault$2(requireSrc());
|
|
17563
17568
|
const debug$3 = debug_1$2.default('https-proxy-agent:parse-proxy-response');
|
|
17564
17569
|
function parseProxyResponse(socket) {
|
|
17565
17570
|
return new Promise((resolve, reject) => {
|
|
@@ -17637,7 +17642,7 @@ const net_1 = __importDefault$1(require$$0$4);
|
|
|
17637
17642
|
const tls_1 = __importDefault$1(require$$1$2);
|
|
17638
17643
|
const url_1 = __importDefault$1(require$$5);
|
|
17639
17644
|
const assert_1 = __importDefault$1(require$$3);
|
|
17640
|
-
const debug_1$1 = __importDefault$1(
|
|
17645
|
+
const debug_1$1 = __importDefault$1(requireSrc());
|
|
17641
17646
|
const agent_base_1 = src;
|
|
17642
17647
|
const parse_proxy_response_1 = __importDefault$1(parseProxyResponse$1);
|
|
17643
17648
|
const debug$2 = debug_1$1.default('https-proxy-agent:agent');
|
|
@@ -17820,7 +17825,7 @@ var debug_1 = function () {
|
|
|
17820
17825
|
if (!debug$1) {
|
|
17821
17826
|
try {
|
|
17822
17827
|
/* eslint global-require: off */
|
|
17823
|
-
debug$1 =
|
|
17828
|
+
debug$1 = requireSrc()("follow-redirects");
|
|
17824
17829
|
}
|
|
17825
17830
|
catch (error) { /* */ }
|
|
17826
17831
|
if (typeof debug$1 !== "function") {
|
|
@@ -40039,6 +40044,119 @@ var Microtransactions = /** @class */ (function () {
|
|
|
40039
40044
|
return Microtransactions;
|
|
40040
40045
|
}());
|
|
40041
40046
|
|
|
40047
|
+
var PreordersRoute = /** @class */ (function () {
|
|
40048
|
+
function PreordersRoute() {
|
|
40049
|
+
}
|
|
40050
|
+
PreordersRoute.routes = {
|
|
40051
|
+
catalog: { url: '/titles/{title_id}/preorders', method: HTTP_METHODS.GET },
|
|
40052
|
+
purchase: { url: '/titles/{title_id}/preorders/{offer_id}/purchase', method: HTTP_METHODS.POST },
|
|
40053
|
+
myOrders: { url: '/titles/{title_id}/preorders/me/orders', method: HTTP_METHODS.GET },
|
|
40054
|
+
order: { url: '/titles/{title_id}/preorders/orders/{order_id}', method: HTTP_METHODS.GET },
|
|
40055
|
+
refundMine: { url: '/titles/{title_id}/preorders/orders/{order_id}/refund', method: HTTP_METHODS.POST },
|
|
40056
|
+
resendMine: { url: '/titles/{title_id}/preorders/orders/{order_id}/resend-access', method: HTTP_METHODS.POST },
|
|
40057
|
+
settings: { url: '/titles/{title_id}/preorders/settings', method: HTTP_METHODS.GET },
|
|
40058
|
+
updateSettings: { url: '/titles/{title_id}/preorders/settings', method: HTTP_METHODS.PUT },
|
|
40059
|
+
offers: { url: '/titles/{title_id}/preorders/admin/offers', method: HTTP_METHODS.GET },
|
|
40060
|
+
createOffer: { url: '/titles/{title_id}/preorders/admin/offers', method: HTTP_METHODS.POST },
|
|
40061
|
+
offer: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}', method: HTTP_METHODS.GET },
|
|
40062
|
+
updateOffer: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}', method: HTTP_METHODS.PUT },
|
|
40063
|
+
activateOffer: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}/activate', method: HTTP_METHODS.POST },
|
|
40064
|
+
pauseOffer: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}/pause', method: HTTP_METHODS.POST },
|
|
40065
|
+
archiveOffer: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}/archive', method: HTTP_METHODS.POST },
|
|
40066
|
+
inventory: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}/keys', method: HTTP_METHODS.GET },
|
|
40067
|
+
importKeys: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}/keys/import', method: HTTP_METHODS.POST },
|
|
40068
|
+
retireKey: { url: '/titles/{title_id}/preorders/admin/offers/{offer_id}/keys/{key_id}/retire', method: HTTP_METHODS.POST },
|
|
40069
|
+
adminOrders: { url: '/titles/{title_id}/preorders/admin/orders', method: HTTP_METHODS.GET },
|
|
40070
|
+
readiness: { url: '/titles/{title_id}/preorders/admin/readiness', method: HTTP_METHODS.GET },
|
|
40071
|
+
adminOrderAction: { url: '/titles/{title_id}/preorders/admin/orders/{order_id}/{action}', method: HTTP_METHODS.POST },
|
|
40072
|
+
mcpCapabilities: { url: '/mcp/v1/titles/{title_id}/preorders/capabilities', method: HTTP_METHODS.GET },
|
|
40073
|
+
mcpOperation: { url: '/mcp/v1/titles/{title_id}/preorders/operations/{operation}', method: HTTP_METHODS.POST },
|
|
40074
|
+
};
|
|
40075
|
+
return PreordersRoute;
|
|
40076
|
+
}());
|
|
40077
|
+
|
|
40078
|
+
var Preorders = /** @class */ (function () {
|
|
40079
|
+
function Preorders() {
|
|
40080
|
+
}
|
|
40081
|
+
Preorders.catalog = function (title_id, options) {
|
|
40082
|
+
return Requests.processRoute(PreordersRoute.routes.catalog, undefined, { title_id: title_id }, undefined, options);
|
|
40083
|
+
};
|
|
40084
|
+
Preorders.purchase = function (title_id, offer_id, data, options) {
|
|
40085
|
+
return Requests.processRoute(PreordersRoute.routes.purchase, data, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40086
|
+
};
|
|
40087
|
+
Preorders.myOrders = function (title_id, options) {
|
|
40088
|
+
return Requests.processRoute(PreordersRoute.routes.myOrders, undefined, { title_id: title_id }, undefined, options);
|
|
40089
|
+
};
|
|
40090
|
+
Preorders.order = function (title_id, order_id, options) {
|
|
40091
|
+
return Requests.processRoute(PreordersRoute.routes.order, undefined, { title_id: title_id, order_id: order_id }, undefined, options);
|
|
40092
|
+
};
|
|
40093
|
+
Preorders.refundMine = function (title_id, order_id, options) {
|
|
40094
|
+
return Requests.processRoute(PreordersRoute.routes.refundMine, {}, { title_id: title_id, order_id: order_id }, undefined, options);
|
|
40095
|
+
};
|
|
40096
|
+
Preorders.resendMine = function (title_id, order_id, options) {
|
|
40097
|
+
return Requests.processRoute(PreordersRoute.routes.resendMine, {}, { title_id: title_id, order_id: order_id }, undefined, options);
|
|
40098
|
+
};
|
|
40099
|
+
Preorders.settings = function (title_id, options) {
|
|
40100
|
+
return Requests.processRoute(PreordersRoute.routes.settings, undefined, { title_id: title_id }, undefined, options);
|
|
40101
|
+
};
|
|
40102
|
+
Preorders.updateSettings = function (title_id, data, options) {
|
|
40103
|
+
return Requests.processRoute(PreordersRoute.routes.updateSettings, data, { title_id: title_id }, undefined, options);
|
|
40104
|
+
};
|
|
40105
|
+
Preorders.offers = function (title_id, options) {
|
|
40106
|
+
return Requests.processRoute(PreordersRoute.routes.offers, undefined, { title_id: title_id }, undefined, options);
|
|
40107
|
+
};
|
|
40108
|
+
Preorders.offer = function (title_id, offer_id, options) {
|
|
40109
|
+
return Requests.processRoute(PreordersRoute.routes.offer, undefined, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40110
|
+
};
|
|
40111
|
+
Preorders.createOffer = function (title_id, data, options) {
|
|
40112
|
+
return Requests.processRoute(PreordersRoute.routes.createOffer, data, { title_id: title_id }, undefined, options);
|
|
40113
|
+
};
|
|
40114
|
+
Preorders.updateOffer = function (title_id, offer_id, data, options) {
|
|
40115
|
+
return Requests.processRoute(PreordersRoute.routes.updateOffer, data, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40116
|
+
};
|
|
40117
|
+
Preorders.activateOffer = function (title_id, offer_id, options) {
|
|
40118
|
+
return Requests.processRoute(PreordersRoute.routes.activateOffer, {}, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40119
|
+
};
|
|
40120
|
+
Preorders.pauseOffer = function (title_id, offer_id, options) {
|
|
40121
|
+
return Requests.processRoute(PreordersRoute.routes.pauseOffer, {}, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40122
|
+
};
|
|
40123
|
+
Preorders.archiveOffer = function (title_id, offer_id, options) {
|
|
40124
|
+
return Requests.processRoute(PreordersRoute.routes.archiveOffer, {}, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40125
|
+
};
|
|
40126
|
+
Preorders.inventory = function (title_id, offer_id, options) {
|
|
40127
|
+
return Requests.processRoute(PreordersRoute.routes.inventory, undefined, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40128
|
+
};
|
|
40129
|
+
Preorders.importKeys = function (title_id, offer_id, keys, options) {
|
|
40130
|
+
return Requests.processRoute(PreordersRoute.routes.importKeys, { keys: keys }, { title_id: title_id, offer_id: offer_id }, undefined, options);
|
|
40131
|
+
};
|
|
40132
|
+
Preorders.importKeyFile = function (title_id, offer_id, file) {
|
|
40133
|
+
var url = PreordersRoute.routes.importKeys.url
|
|
40134
|
+
.replace('{title_id}', title_id)
|
|
40135
|
+
.replace('{offer_id}', offer_id);
|
|
40136
|
+
return Requests.uploadFile(url, 'key_file', file, {}, undefined, undefined, { excludeCommunityContext: true });
|
|
40137
|
+
};
|
|
40138
|
+
Preorders.retireKey = function (title_id, offer_id, key_id, reason, options) {
|
|
40139
|
+
return Requests.processRoute(PreordersRoute.routes.retireKey, { reason: reason }, { title_id: title_id, offer_id: offer_id, key_id: key_id }, undefined, options);
|
|
40140
|
+
};
|
|
40141
|
+
Preorders.adminOrders = function (title_id, filters, options) {
|
|
40142
|
+
return Requests.processRoute(PreordersRoute.routes.adminOrders, undefined, { title_id: title_id }, filters, options);
|
|
40143
|
+
};
|
|
40144
|
+
Preorders.readiness = function (title_id, options) {
|
|
40145
|
+
return Requests.processRoute(PreordersRoute.routes.readiness, undefined, { title_id: title_id }, undefined, options);
|
|
40146
|
+
};
|
|
40147
|
+
Preorders.adminOrderAction = function (title_id, order_id, action, options) {
|
|
40148
|
+
return Requests.processRoute(PreordersRoute.routes.adminOrderAction, {}, { title_id: title_id, order_id: order_id, action: action }, undefined, options);
|
|
40149
|
+
};
|
|
40150
|
+
Preorders.mcpCapabilities = function (title_id, options) {
|
|
40151
|
+
return Requests.processRoute(PreordersRoute.routes.mcpCapabilities, undefined, { title_id: title_id }, undefined, options);
|
|
40152
|
+
};
|
|
40153
|
+
Preorders.mcpOperation = function (title_id, operation, argumentsData, options) {
|
|
40154
|
+
if (argumentsData === void 0) { argumentsData = {}; }
|
|
40155
|
+
return Requests.processRoute(PreordersRoute.routes.mcpOperation, { arguments: argumentsData }, { title_id: title_id, operation: operation }, undefined, options);
|
|
40156
|
+
};
|
|
40157
|
+
return Preorders;
|
|
40158
|
+
}());
|
|
40159
|
+
|
|
40042
40160
|
/** Generate a 256-bit browser nonce. Fails closed without secure Web Crypto. */
|
|
40043
40161
|
function createMicrotransactionNonce() {
|
|
40044
40162
|
var _a;
|
|
@@ -48632,6 +48750,7 @@ var Glitch = /** @class */ (function () {
|
|
|
48632
48750
|
Hosting: Hosting,
|
|
48633
48751
|
GameDesign: GameDesign,
|
|
48634
48752
|
Microtransactions: Microtransactions,
|
|
48753
|
+
Preorders: Preorders,
|
|
48635
48754
|
};
|
|
48636
48755
|
Glitch.util = {
|
|
48637
48756
|
Requests: Requests,
|