@virjay/playscope-cocos 0.0.0-stage → 0.2.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +314 -2
  3. package/USAGE.md +372 -0
  4. package/VALIDATION.md +93 -0
  5. package/dist/adapters/levelplay/index.d.ts +15 -0
  6. package/dist/adapters/levelplay/index.js +14 -0
  7. package/dist/cocos/Storage.d.ts +16 -0
  8. package/dist/cocos/Storage.js +16 -0
  9. package/dist/cocos/XhrJsonTransport.d.ts +8 -0
  10. package/dist/cocos/XhrJsonTransport.js +65 -0
  11. package/dist/cocos/index.d.ts +48 -0
  12. package/dist/cocos/index.js +134 -0
  13. package/dist/core/ClientOwnership.d.ts +6 -0
  14. package/dist/core/ClientOwnership.js +39 -0
  15. package/dist/core/ClientScope.d.ts +5 -0
  16. package/dist/core/ClientScope.js +34 -0
  17. package/dist/core/ConfigurationSync.d.ts +18 -0
  18. package/dist/core/ConfigurationSync.js +66 -0
  19. package/dist/core/FactEncoding.d.ts +10 -0
  20. package/dist/core/FactEncoding.js +29 -0
  21. package/dist/core/HttpError.d.ts +10 -0
  22. package/dist/core/HttpError.js +17 -0
  23. package/dist/core/OutboxStore.d.ts +31 -0
  24. package/dist/core/OutboxStore.js +228 -0
  25. package/dist/core/PersistentState.d.ts +33 -0
  26. package/dist/core/PersistentState.js +92 -0
  27. package/dist/core/PlayScopeClient.d.ts +65 -0
  28. package/dist/core/PlayScopeClient.js +422 -0
  29. package/dist/core/QueueAdmission.d.ts +4 -0
  30. package/dist/core/QueueAdmission.js +29 -0
  31. package/dist/core/index.d.ts +7 -0
  32. package/dist/core/index.js +27 -0
  33. package/dist/core/revenue.d.ts +33 -0
  34. package/dist/core/revenue.js +23 -0
  35. package/dist/core/types.d.ts +155 -0
  36. package/dist/core/types.js +2 -0
  37. package/dist/core/uuid.d.ts +1 -0
  38. package/dist/core/uuid.js +9 -0
  39. package/dist/esm/adapters/levelplay/index.js +11 -0
  40. package/dist/esm/cocos/Storage.js +12 -0
  41. package/dist/esm/cocos/XhrJsonTransport.js +61 -0
  42. package/dist/esm/cocos/index.js +115 -0
  43. package/dist/esm/core/ClientOwnership.js +34 -0
  44. package/dist/esm/core/ClientScope.js +30 -0
  45. package/dist/esm/core/ConfigurationSync.js +62 -0
  46. package/dist/esm/core/FactEncoding.js +24 -0
  47. package/dist/esm/core/HttpError.js +12 -0
  48. package/dist/esm/core/OutboxStore.js +224 -0
  49. package/dist/esm/core/PersistentState.js +85 -0
  50. package/dist/esm/core/PlayScopeClient.js +415 -0
  51. package/dist/esm/core/QueueAdmission.js +25 -0
  52. package/dist/esm/core/index.js +7 -0
  53. package/dist/esm/core/revenue.js +20 -0
  54. package/dist/esm/core/types.js +1 -0
  55. package/dist/esm/core/uuid.js +6 -0
  56. package/dist/esm/package.json +1 -0
  57. package/dist/esm/protocols/game-v1/index.js +21 -0
  58. package/dist/protocols/game-v1/index.d.ts +8 -0
  59. package/dist/protocols/game-v1/index.js +25 -0
  60. package/doc/README.md +4 -0
  61. package/doc//344/275/277/347/224/250/346/214/207/345/215/227/README.md +585 -0
  62. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/adapters/levelplay/index.d.ts +15 -0
  63. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/cocos/Storage.d.ts +13 -0
  64. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/cocos/XhrJsonTransport.d.ts +8 -0
  65. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/cocos/index.d.ts +38 -0
  66. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/core/PlayScopeClient.d.ts +46 -0
  67. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/core/index.d.ts +3 -0
  68. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/core/revenue.d.ts +25 -0
  69. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/0.1.1-types/core/types.d.ts +81 -0
  70. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/exports.json +89 -0
  71. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231/public-api.d.ts +281 -0
  72. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257/client-context.schema.json +103 -0
  73. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257/game-ad-properties.json +765 -0
  74. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257/game-builtin-properties.json +479 -0
  75. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257/game-event.json +278 -0
  76. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257/product-events.json +2878 -0
  77. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257/standard-contract.json +183 -0
  78. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/234/215/345/212/241/347/253/257//344/272/247/345/223/201/344/272/213/344/273/266/347/264/242/345/274/225.md +87 -0
  79. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//345/217/202/350/200/203/350/265/204/346/226/231//346/235/245/346/272/220/344/270/216/347/211/210/346/234/254.json +35 -0
  80. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/CoreIntegration.ts +13 -0
  81. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/LevelPlayTelemetry.ts +119 -0
  82. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/PlayScopeExample.ts +46 -0
  83. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/QuestGarden.ts +129 -0
  84. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/README.md +23 -0
  85. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/project-fixture.json +188 -0
  86. package/doc//344/275/277/347/224/250/346/214/207/345/215/227//347/244/272/344/276/213/tsconfig.json +20 -0
  87. package/examples/cocos-minimal/PlayScopeExample.ts +27 -0
  88. package/examples/quest-garden/QuestGarden.ts +129 -0
  89. package/examples/quest-garden/README.md +180 -0
  90. package/examples/quest-garden/project-fixture.json +188 -0
  91. package/examples/quest-garden/tsconfig.json +12 -0
  92. package/package.json +73 -4
@@ -0,0 +1,188 @@
1
+ {
2
+ "project": {
3
+ "name": "Quest Garden source validation",
4
+ "profile": "game",
5
+ "gameSettings": {
6
+ "hasLevels": true,
7
+ "scoreOutcomes": [
8
+ "completed"
9
+ ]
10
+ },
11
+ "configSchema": {
12
+ "type": "object",
13
+ "properties": {
14
+ "schemaVersion": {
15
+ "const": 1
16
+ },
17
+ "revision": {
18
+ "type": "string",
19
+ "minLength": 1,
20
+ "maxLength": 256
21
+ },
22
+ "harvestTarget": {
23
+ "type": "integer",
24
+ "minimum": 1,
25
+ "maximum": 20
26
+ },
27
+ "season": {
28
+ "type": "string",
29
+ "minLength": 1,
30
+ "maxLength": 256
31
+ }
32
+ },
33
+ "required": [
34
+ "schemaVersion",
35
+ "revision",
36
+ "harvestTarget",
37
+ "season"
38
+ ],
39
+ "additionalProperties": false
40
+ }
41
+ },
42
+ "eventSchemas": [
43
+ {
44
+ "name": "quest_started",
45
+ "version": 1,
46
+ "countsAsActivity": true,
47
+ "propertiesSchema": {
48
+ "type": "object",
49
+ "properties": {
50
+ "quest_id": {
51
+ "type": "string",
52
+ "minLength": 1,
53
+ "maxLength": 256
54
+ },
55
+ "season": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "maxLength": 256
59
+ }
60
+ },
61
+ "required": [
62
+ "quest_id",
63
+ "season"
64
+ ],
65
+ "additionalProperties": false
66
+ }
67
+ },
68
+ {
69
+ "name": "quest_harvested",
70
+ "version": 1,
71
+ "countsAsActivity": true,
72
+ "propertiesSchema": {
73
+ "type": "object",
74
+ "properties": {
75
+ "quest_id": {
76
+ "type": "string",
77
+ "minLength": 1,
78
+ "maxLength": 256
79
+ },
80
+ "index": {
81
+ "type": "integer",
82
+ "minimum": 1,
83
+ "maximum": 20
84
+ }
85
+ },
86
+ "required": [
87
+ "quest_id",
88
+ "index"
89
+ ],
90
+ "additionalProperties": false
91
+ }
92
+ },
93
+ {
94
+ "name": "quest_completed",
95
+ "version": 1,
96
+ "countsAsActivity": true,
97
+ "propertiesSchema": {
98
+ "type": "object",
99
+ "properties": {
100
+ "quest_id": {
101
+ "type": "string",
102
+ "minLength": 1,
103
+ "maxLength": 256
104
+ },
105
+ "harvests": {
106
+ "type": "integer",
107
+ "minimum": 1,
108
+ "maximum": 20
109
+ }
110
+ },
111
+ "required": [
112
+ "quest_id",
113
+ "harvests"
114
+ ],
115
+ "additionalProperties": false
116
+ }
117
+ },
118
+ {
119
+ "name": "quest_ad_income",
120
+ "version": 1,
121
+ "countsAsActivity": false,
122
+ "propertiesSchema": {
123
+ "type": "object",
124
+ "properties": {
125
+ "placement": {
126
+ "type": "string",
127
+ "minLength": 1,
128
+ "maxLength": 256
129
+ },
130
+ "exposure_id": {
131
+ "type": "string",
132
+ "minLength": 1,
133
+ "maxLength": 256
134
+ },
135
+ "usd": {
136
+ "type": "number",
137
+ "minimum": 0
138
+ },
139
+ "provider": {
140
+ "type": "string",
141
+ "minLength": 1,
142
+ "maxLength": 256
143
+ },
144
+ "network": {
145
+ "type": "string",
146
+ "minLength": 1,
147
+ "maxLength": 256
148
+ },
149
+ "ad_unit": {
150
+ "type": "string",
151
+ "minLength": 1,
152
+ "maxLength": 256
153
+ },
154
+ "precision": {
155
+ "type": "string"
156
+ }
157
+ },
158
+ "required": [
159
+ "placement",
160
+ "exposure_id",
161
+ "usd",
162
+ "provider",
163
+ "network",
164
+ "ad_unit",
165
+ "precision"
166
+ ],
167
+ "additionalProperties": false
168
+ }
169
+ }
170
+ ],
171
+ "configuration": {
172
+ "config": {
173
+ "schemaVersion": 1,
174
+ "revision": "garden-remote-1",
175
+ "harvestTarget": 2,
176
+ "season": "summer"
177
+ }
178
+ },
179
+ "rollout": {
180
+ "variants": [
181
+ {
182
+ "id": "default",
183
+ "revision": "garden-remote-1",
184
+ "weight": 100
185
+ }
186
+ ]
187
+ }
188
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "noEmit": true,
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@virjay/playscope-cocos": ["../../cocos/index.ts"],
8
+ "@virjay/playscope-cocos/adapters/levelplay": ["../../adapters/levelplay/index.ts"]
9
+ }
10
+ },
11
+ "include": ["QuestGarden.ts"]
12
+ }
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@virjay/playscope-cocos",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "PlayScope API v1 durable telemetry for Cocos Creator",
5
+ "license": "UNLICENSED",
6
+ "main": "dist/cocos/index.js",
7
+ "module": "dist/esm/cocos/index.js",
8
+ "types": "dist/cocos/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/cocos/index.d.ts",
12
+ "import": "./dist/esm/cocos/index.js",
13
+ "require": "./dist/cocos/index.js",
14
+ "default": "./dist/cocos/index.js"
15
+ },
16
+ "./core": {
17
+ "types": "./dist/core/index.d.ts",
18
+ "import": "./dist/esm/core/index.js",
19
+ "require": "./dist/core/index.js",
20
+ "default": "./dist/core/index.js"
21
+ },
22
+ "./adapters/levelplay": {
23
+ "types": "./dist/adapters/levelplay/index.d.ts",
24
+ "import": "./dist/esm/adapters/levelplay/index.js",
25
+ "require": "./dist/adapters/levelplay/index.js",
26
+ "default": "./dist/adapters/levelplay/index.js"
27
+ },
28
+ "./protocols/game-v1": {
29
+ "types": "./dist/protocols/game-v1/index.d.ts",
30
+ "import": "./dist/esm/protocols/game-v1/index.js",
31
+ "require": "./dist/protocols/game-v1/index.js",
32
+ "default": "./dist/protocols/game-v1/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "USAGE.md",
39
+ "CHANGELOG.md",
40
+ "VALIDATION.md",
41
+ "examples",
42
+ "doc"
43
+ ],
44
+ "sideEffects": false,
45
+ "scripts": {
46
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig.json --module ES2020 --outDir dist/esm --declaration false && node tools/build-esm.mjs",
47
+ "check": "tsc -p tsconfig.json --noEmit",
48
+ "check:quest-example": "tsc -p examples/quest-garden/tsconfig.json",
49
+ "verify:quest-local": "node --require ./tools/register-typescript.cjs tools/verify-quest-local.cjs",
50
+ "test": "npm run build && node --test tests/*.test.cjs",
51
+ "test:source": "node --require ./tools/register-typescript.cjs --test tests/client.test.cjs tests/reliability.test.cjs tests/protocol.test.cjs tests/scheduling.test.cjs tests/outbox.test.cjs tests/scope.test.cjs tests/xhr.test.cjs tests/source/quest-game.test.cjs tests/source/source-loader.test.cjs",
52
+ "prepack": "npm run check && npm test"
53
+ },
54
+ "devDependencies": {
55
+ "typescript": "5.9.3"
56
+ },
57
+ "typesVersions": {
58
+ "*": {
59
+ "core": [
60
+ "dist/core/index.d.ts"
61
+ ],
62
+ "adapters/levelplay": [
63
+ "dist/adapters/levelplay/index.d.ts"
64
+ ],
65
+ "protocols/game-v1": [
66
+ "dist/protocols/game-v1/index.d.ts"
67
+ ]
68
+ }
69
+ },
70
+ "publishConfig": {
71
+ "registry": "https://registry.npmjs.org/",
72
+ "access": "public",
73
+ "tag": "latest"
74
+ }
75
+ }