@anweather/game-plugin-ssdk 1.26.0 → 1.28.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/runtime/index.js +4 -1
- package/dist-cjs/runtime/presentation.js +31 -2
- package/dist-cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist-es/runtime/index.js +1 -1
- package/dist-es/runtime/presentation.js +30 -1
- package/dist-es/tsconfig.es.tsbuildinfo +1 -1
- package/dist-types/runtime/index.d.ts +1 -1
- package/dist-types/runtime/presentation.d.ts +27 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_MEMBERSHIP_AGE_MS = exports.FakeSpaceClient = exports.NotASpaceMemberError = exports.SpaceApiError = exports.isAlreadyASpace = exports.createMembershipGuard = exports.createSpaceClient = exports.MAX_LINK_FRAME_BYTES = exports.LinkCloseCode = exports.LIVE_PATH = exports.LIVE_PROTOCOL_VERSION = exports.assertLiveConformance = exports.runLiveConformance = exports.loadRoomCheckpoint = exports.createLiveHarness = exports.attachLive = exports.isVersionConflict = exports.BlobStoreError = exports.allBlobOwners = exports.blobOwner = exports.casUpdate = exports.createBlobClient = exports.runtimeVersion = exports.PLUGIN_PROTOCOL_VERSION = exports.MAX_PRESENTATION_BYTES = exports.PRESENTATION_CATEGORIES = exports.assertPresentation = exports.validatePresentation = exports.assertConformance = exports.runConformance = exports.createRegistrationLoop = exports.createPluginApp = exports.servePlugin = exports.createGamePluginService = exports.mountSsdkHandler = void 0;
|
|
3
|
+
exports.MAX_MEMBERSHIP_AGE_MS = exports.FakeSpaceClient = exports.NotASpaceMemberError = exports.SpaceApiError = exports.isAlreadyASpace = exports.createMembershipGuard = exports.createSpaceClient = exports.MAX_LINK_FRAME_BYTES = exports.LinkCloseCode = exports.LIVE_PATH = exports.LIVE_PROTOCOL_VERSION = exports.assertLiveConformance = exports.runLiveConformance = exports.loadRoomCheckpoint = exports.createLiveHarness = exports.attachLive = exports.isVersionConflict = exports.BlobStoreError = exports.allBlobOwners = exports.blobOwner = exports.casUpdate = exports.createBlobClient = exports.runtimeVersion = exports.PLUGIN_PROTOCOL_VERSION = exports.MAX_TUTORIAL_PLAYERS = exports.TUTORIAL_SLUG_PATTERN = exports.RESERVED_TUTORIAL_SLUGS = exports.MAX_PRESENTATION_BYTES = exports.PRESENTATION_CATEGORIES = exports.assertPresentation = exports.validatePresentation = exports.assertConformance = exports.runConformance = exports.createRegistrationLoop = exports.createPluginApp = exports.servePlugin = exports.createGamePluginService = exports.mountSsdkHandler = void 0;
|
|
4
4
|
var express_1 = require("./express");
|
|
5
5
|
Object.defineProperty(exports, "mountSsdkHandler", { enumerable: true, get: function () { return express_1.mountSsdkHandler; } });
|
|
6
6
|
var defaultService_1 = require("./defaultService");
|
|
@@ -18,6 +18,9 @@ Object.defineProperty(exports, "validatePresentation", { enumerable: true, get:
|
|
|
18
18
|
Object.defineProperty(exports, "assertPresentation", { enumerable: true, get: function () { return presentation_1.assertPresentation; } });
|
|
19
19
|
Object.defineProperty(exports, "PRESENTATION_CATEGORIES", { enumerable: true, get: function () { return presentation_1.PRESENTATION_CATEGORIES; } });
|
|
20
20
|
Object.defineProperty(exports, "MAX_PRESENTATION_BYTES", { enumerable: true, get: function () { return presentation_1.MAX_PRESENTATION_BYTES; } });
|
|
21
|
+
Object.defineProperty(exports, "RESERVED_TUTORIAL_SLUGS", { enumerable: true, get: function () { return presentation_1.RESERVED_TUTORIAL_SLUGS; } });
|
|
22
|
+
Object.defineProperty(exports, "TUTORIAL_SLUG_PATTERN", { enumerable: true, get: function () { return presentation_1.TUTORIAL_SLUG_PATTERN; } });
|
|
23
|
+
Object.defineProperty(exports, "MAX_TUTORIAL_PLAYERS", { enumerable: true, get: function () { return presentation_1.MAX_TUTORIAL_PLAYERS; } });
|
|
21
24
|
var version_1 = require("./version");
|
|
22
25
|
Object.defineProperty(exports, "PLUGIN_PROTOCOL_VERSION", { enumerable: true, get: function () { return version_1.PLUGIN_PROTOCOL_VERSION; } });
|
|
23
26
|
Object.defineProperty(exports, "runtimeVersion", { enumerable: true, get: function () { return version_1.runtimeVersion; } });
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_PRESENTATION_BYTES = exports.PRESENTATION_CATEGORIES = void 0;
|
|
3
|
+
exports.MAX_PRESENTATION_BYTES = exports.MAX_TUTORIAL_PLAYERS = exports.TUTORIAL_SLUG_PATTERN = exports.RESERVED_TUTORIAL_SLUGS = exports.PRESENTATION_CATEGORIES = void 0;
|
|
4
4
|
exports.validatePresentation = validatePresentation;
|
|
5
5
|
exports.assertPresentation = assertPresentation;
|
|
6
6
|
exports.PRESENTATION_CATEGORIES = ["classic", "strategy", "cards", "word", "wip"];
|
|
7
|
+
exports.RESERVED_TUTORIAL_SLUGS = [
|
|
8
|
+
"api", "assets", "chats", "games", "health", "icons", "leaderboard", "nerdle",
|
|
9
|
+
"players", "plugins", "save-files", "saved-data", "spaces", "style-guide",
|
|
10
|
+
"tutorial", "tutorials", "wordle",
|
|
11
|
+
];
|
|
12
|
+
exports.TUTORIAL_SLUG_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
13
|
+
exports.MAX_TUTORIAL_PLAYERS = 16;
|
|
7
14
|
exports.MAX_PRESENTATION_BYTES = 32 * 1024;
|
|
8
15
|
const str = { kind: "string" };
|
|
9
16
|
const bool = { kind: "boolean" };
|
|
10
17
|
const oneOf = (...values) => ({ kind: "oneOf", values });
|
|
11
|
-
const obj = (fields) => ({ kind: "object", fields });
|
|
18
|
+
const obj = (fields, required) => ({ kind: "object", fields, required });
|
|
12
19
|
const SCHEMA = obj({
|
|
13
20
|
catalogue: obj({
|
|
14
21
|
title: str,
|
|
@@ -26,6 +33,12 @@ const SCHEMA = obj({
|
|
|
26
33
|
host: obj({ overflowX: oneOf("auto", "hidden", "clip"), width: oneOf("fit", "full") }),
|
|
27
34
|
}),
|
|
28
35
|
rematch: obj({ seatNames: { kind: "strings", size: 2 } }),
|
|
36
|
+
tutorial: obj({
|
|
37
|
+
slug: { kind: "slug" },
|
|
38
|
+
config: { kind: "nonEmptyObject" },
|
|
39
|
+
players: { kind: "int", min: 1, max: exports.MAX_TUTORIAL_PLAYERS },
|
|
40
|
+
title: str,
|
|
41
|
+
}, ["slug", "config"]),
|
|
29
42
|
});
|
|
30
43
|
const POSTER_TOKEN = /^([a-z]+-(50|[1-9]00|950)|white|black)$/;
|
|
31
44
|
function validatePresentation(value) {
|
|
@@ -60,6 +73,18 @@ function validatePresentation(value) {
|
|
|
60
73
|
if (typeof v !== "string" || !POSTER_TOKEN.test(v))
|
|
61
74
|
problems.push(`${path} is not a palette token like "amber-700"`);
|
|
62
75
|
return;
|
|
76
|
+
case "slug":
|
|
77
|
+
if (typeof v !== "string" || !exports.TUTORIAL_SLUG_PATTERN.test(v)) {
|
|
78
|
+
problems.push(`${path} is not lowercase words joined by hyphens, like "spirit-island"`);
|
|
79
|
+
}
|
|
80
|
+
else if (exports.RESERVED_TUTORIAL_SLUGS.includes(v)) {
|
|
81
|
+
problems.push(`${path} "${v}" is reserved for one of the site's own pages`);
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
case "nonEmptyObject":
|
|
85
|
+
if (!isObject(v) || Object.keys(v).length === 0)
|
|
86
|
+
problems.push(`${path} is not an object with at least one field`);
|
|
87
|
+
return;
|
|
63
88
|
case "falseOr":
|
|
64
89
|
if (v === false)
|
|
65
90
|
return;
|
|
@@ -80,6 +105,10 @@ function validatePresentation(value) {
|
|
|
80
105
|
else if (child !== undefined)
|
|
81
106
|
visit(child, childRule, `${path}.${key}`);
|
|
82
107
|
}
|
|
108
|
+
for (const key of rule.required ?? []) {
|
|
109
|
+
if (v[key] === undefined)
|
|
110
|
+
problems.push(`${path}.${key} is required`);
|
|
111
|
+
}
|
|
83
112
|
return;
|
|
84
113
|
}
|
|
85
114
|
};
|