playcademy 0.14.1 → 0.14.2-alpha.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.
Files changed (2) hide show
  1. package/dist/index.js +83 -78
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6687,6 +6687,36 @@ async function deployGameBackend(client, slug, config, projectPath, previousCust
6687
6687
  return null;
6688
6688
  }
6689
6689
  }
6690
+ async function deployBackendIfNeeded(game, context2) {
6691
+ const {
6692
+ client,
6693
+ config,
6694
+ projectPath,
6695
+ previousCustomRoutesHash,
6696
+ previousIntegrationKeys,
6697
+ deployBackend,
6698
+ fullConfig,
6699
+ forceBackend,
6700
+ debug
6701
+ } = context2;
6702
+ if (!deployBackend) {
6703
+ return null;
6704
+ }
6705
+ const backendDeployment = await deployGameBackend(
6706
+ client,
6707
+ game.slug,
6708
+ config,
6709
+ projectPath,
6710
+ previousCustomRoutesHash,
6711
+ fullConfig,
6712
+ forceBackend,
6713
+ previousIntegrationKeys,
6714
+ context2.deployedGameInfo?.schemaSnapshot,
6715
+ debug,
6716
+ context2.deployedGameInfo?.deployedSecrets
6717
+ );
6718
+ return backendDeployment;
6719
+ }
6690
6720
 
6691
6721
  // src/lib/deploy/config.ts
6692
6722
  init_file_loader();
@@ -7866,6 +7896,59 @@ async function removeDeployedGame(projectPath) {
7866
7896
  delete store[projectPath];
7867
7897
  await saveGameStore(store);
7868
7898
  }
7899
+ async function saveDeploymentState(game, backendDeployment, context2) {
7900
+ const { projectPath, buildHash, buildSize, config, fullConfig } = context2;
7901
+ if (config.gameType === "external") {
7902
+ await saveDeployedGame(projectPath, {
7903
+ gameId: game.id,
7904
+ lastDeployedAt: (/* @__PURE__ */ new Date()).toISOString()
7905
+ });
7906
+ return;
7907
+ }
7908
+ const deploymentState = {
7909
+ gameId: game.id,
7910
+ lastDeployedAt: (/* @__PURE__ */ new Date()).toISOString(),
7911
+ buildPath: config.buildPath,
7912
+ buildHash,
7913
+ buildSize
7914
+ };
7915
+ if (backendDeployment) {
7916
+ deploymentState.integrationKeys = backendDeployment.integrationKeys;
7917
+ if (backendDeployment.integrationsHash) {
7918
+ deploymentState.integrationsHash = backendDeployment.integrationsHash;
7919
+ }
7920
+ } else if (fullConfig?.integrations) {
7921
+ deploymentState.integrationKeys = getIntegrationKeys(fullConfig.integrations);
7922
+ const hash = hashContent(fullConfig.integrations);
7923
+ if (hash) deploymentState.integrationsHash = hash;
7924
+ } else {
7925
+ deploymentState.integrationKeys = [];
7926
+ }
7927
+ if (backendDeployment) {
7928
+ deploymentState.customRoutesHash = backendDeployment.customRoutesHash ?? void 0;
7929
+ deploymentState.customRoutesSize = backendDeployment.customRoutesSize ?? void 0;
7930
+ deploymentState.backendSize = backendDeployment.backendSize;
7931
+ deploymentState.backendDeployedAt = backendDeployment.deployedAt;
7932
+ if (backendDeployment.schemaSnapshot !== void 0) {
7933
+ deploymentState.schemaSnapshot = backendDeployment.schemaSnapshot;
7934
+ }
7935
+ if (backendDeployment.deployedSecrets !== void 0) {
7936
+ deploymentState.deployedSecrets = backendDeployment.deployedSecrets;
7937
+ }
7938
+ } else if (context2.deployedGameInfo) {
7939
+ deploymentState.customRoutesHash = context2.deployedGameInfo.customRoutesHash;
7940
+ deploymentState.customRoutesSize = context2.deployedGameInfo.customRoutesSize;
7941
+ deploymentState.backendSize = context2.deployedGameInfo.backendSize;
7942
+ deploymentState.backendDeployedAt = context2.deployedGameInfo.backendDeployedAt;
7943
+ if (context2.deployedGameInfo.schemaSnapshot !== void 0) {
7944
+ deploymentState.schemaSnapshot = context2.deployedGameInfo.schemaSnapshot;
7945
+ }
7946
+ if (context2.deployedGameInfo.deployedSecrets !== void 0) {
7947
+ deploymentState.deployedSecrets = context2.deployedGameInfo.deployedSecrets;
7948
+ }
7949
+ }
7950
+ await saveDeployedGame(projectPath, deploymentState);
7951
+ }
7869
7952
 
7870
7953
  // src/lib/deploy/preparation.ts
7871
7954
  async function prepareDeploymentContext(options) {
@@ -8261,84 +8344,6 @@ async function handleIntegrationConfigChanges(game, context2) {
8261
8344
  }
8262
8345
  }
8263
8346
  }
8264
- async function deployBackendIfNeeded(game, context2) {
8265
- const {
8266
- client,
8267
- config,
8268
- projectPath,
8269
- previousCustomRoutesHash,
8270
- previousIntegrationKeys,
8271
- deployBackend,
8272
- fullConfig,
8273
- forceBackend,
8274
- debug
8275
- } = context2;
8276
- if (!deployBackend) {
8277
- return null;
8278
- }
8279
- const backendDeployment = await deployGameBackend(
8280
- client,
8281
- game.slug,
8282
- config,
8283
- projectPath,
8284
- previousCustomRoutesHash,
8285
- fullConfig,
8286
- forceBackend,
8287
- previousIntegrationKeys,
8288
- context2.deployedGameInfo?.schemaSnapshot,
8289
- debug,
8290
- context2.deployedGameInfo?.deployedSecrets
8291
- );
8292
- return backendDeployment;
8293
- }
8294
- async function saveDeploymentState(game, backendDeployment, context2) {
8295
- const { projectPath, buildHash, buildSize, config, fullConfig } = context2;
8296
- if (config.gameType === "external") {
8297
- await saveDeployedGame(projectPath, {
8298
- gameId: game.id,
8299
- lastDeployedAt: (/* @__PURE__ */ new Date()).toISOString()
8300
- });
8301
- } else {
8302
- let integrationKeys;
8303
- let integrationsHash;
8304
- if (backendDeployment) {
8305
- integrationKeys = backendDeployment.integrationKeys;
8306
- integrationsHash = backendDeployment.integrationsHash ?? void 0;
8307
- } else if (fullConfig?.integrations) {
8308
- integrationKeys = getIntegrationKeys(fullConfig.integrations);
8309
- integrationsHash = hashContent(fullConfig.integrations);
8310
- } else {
8311
- integrationKeys = [];
8312
- integrationsHash = void 0;
8313
- }
8314
- await saveDeployedGame(projectPath, {
8315
- gameId: game.id,
8316
- lastDeployedAt: (/* @__PURE__ */ new Date()).toISOString(),
8317
- buildPath: config.buildPath,
8318
- buildHash,
8319
- buildSize,
8320
- ...backendDeployment && {
8321
- customRoutesHash: backendDeployment.customRoutesHash ?? void 0,
8322
- customRoutesSize: backendDeployment.customRoutesSize ?? void 0,
8323
- backendSize: backendDeployment.backendSize,
8324
- backendDeployedAt: backendDeployment.deployedAt,
8325
- schemaSnapshot: backendDeployment.schemaSnapshot,
8326
- deployedSecrets: backendDeployment.deployedSecrets
8327
- },
8328
- ...!backendDeployment && context2.deployedGameInfo && {
8329
- customRoutesHash: context2.deployedGameInfo.customRoutesHash,
8330
- customRoutesSize: context2.deployedGameInfo.customRoutesSize,
8331
- backendSize: context2.deployedGameInfo.backendSize,
8332
- backendDeployedAt: context2.deployedGameInfo.backendDeployedAt,
8333
- schemaSnapshot: context2.deployedGameInfo.schemaSnapshot,
8334
- deployedSecrets: context2.deployedGameInfo.deployedSecrets
8335
- },
8336
- integrationKeys,
8337
- // Always save (even if empty array)
8338
- ...integrationsHash && { integrationsHash }
8339
- });
8340
- }
8341
- }
8342
8347
 
8343
8348
  // src/lib/dev/backend.ts
8344
8349
  init_constants2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.14.1",
3
+ "version": "0.14.2-alpha.2",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "main": "./dist/index.js",