@jay-framework/wix-deploy 0.21.0 → 0.22.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/index.js CHANGED
@@ -18,7 +18,7 @@ import path from "node:path";
18
18
  import crypto from "node:crypto";
19
19
  import yaml from "js-yaml";
20
20
  import { getService } from "@jay-framework/stack-server-runtime";
21
- import { items } from "@wix/data";
21
+ import { collections, items } from "@wix/data";
22
22
  const DEFAULT_COLLECTION_ID = "jay-backend-files";
23
23
  const DEFAULT_CACHE_DIR = "/tmp/jay-backend";
24
24
  function getDeployVersion(metadata) {
@@ -7376,19 +7376,42 @@ async function setupWixDeploy(ctx) {
7376
7376
  }
7377
7377
  }
7378
7378
  let collectionOk = false;
7379
- try {
7380
- const wixClient = getService(WIX_CLIENT_SERVICE);
7381
- if (wixClient) {
7382
- const dataClient = wixClient.use({ items });
7379
+ const wixClient = getService(WIX_CLIENT_SERVICE);
7380
+ if (wixClient) {
7381
+ const dataClient = wixClient.use({ items, collections });
7382
+ try {
7383
7383
  await dataClient.items.query(DEFAULT_COLLECTION_ID).limit(1).find();
7384
7384
  collectionOk = true;
7385
+ } catch {
7386
+ try {
7387
+ await dataClient.collections.createDataCollection({
7388
+ _id: DEFAULT_COLLECTION_ID,
7389
+ displayName: "Jay Backend Files",
7390
+ fields: [
7391
+ { key: "path", type: "TEXT" },
7392
+ { key: "content", type: "TEXT" },
7393
+ { key: "fileType", type: "TEXT" },
7394
+ { key: "sizeBytes", type: "NUMBER" },
7395
+ { key: "category", type: "TEXT" },
7396
+ { key: "version", type: "TEXT" }
7397
+ ],
7398
+ permissions: {
7399
+ insert: "ADMIN",
7400
+ update: "ADMIN",
7401
+ remove: "ADMIN",
7402
+ read: "ADMIN"
7403
+ }
7404
+ });
7405
+ collectionOk = true;
7406
+ configCreated.push("collection");
7407
+ } catch (createErr) {
7408
+ return {
7409
+ status: "error",
7410
+ configCreated,
7411
+ message: `Failed to create data collection "${DEFAULT_COLLECTION_ID}": ${createErr instanceof Error ? createErr.message : createErr}`
7412
+ };
7413
+ }
7385
7414
  }
7386
- } catch {
7387
- return {
7388
- status: "needs-config",
7389
- configCreated,
7390
- message: `Data collection "${DEFAULT_COLLECTION_ID}" not found. Create it in the Wix dashboard with fields: path (text), content (text), fileType (text), sizeBytes (number), category (text), version (text)`
7391
- };
7392
7415
  }
7393
7416
  return {
7394
7417
  status: "configured",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/wix-deploy",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "type": "module",
5
5
  "description": "Wix BaaS deployment adapter for Jay Framework — WixDataArtifactStore and entry builder",
6
6
  "license": "Apache-2.0",
@@ -26,10 +26,10 @@
26
26
  "test": ":"
27
27
  },
28
28
  "dependencies": {
29
- "@jay-framework/fullstack-component": "^0.21.0",
30
- "@jay-framework/production-server": "^0.21.0",
31
- "@jay-framework/stack-server-runtime": "^0.21.0",
32
- "@jay-framework/wix-server-client": "^0.21.0",
29
+ "@jay-framework/fullstack-component": "^0.22.0",
30
+ "@jay-framework/production-server": "^0.22.0",
31
+ "@jay-framework/stack-server-runtime": "^0.22.0",
32
+ "@jay-framework/wix-server-client": "^0.22.0",
33
33
  "@wix/data": "^1.0.433",
34
34
  "@wix/sdk": "^1.21.5",
35
35
  "esbuild": "^0.21.0",
package/plugin.yaml CHANGED
@@ -1,7 +1,6 @@
1
1
  name: wix-deploy
2
2
 
3
- setup:
4
- handler: setupWixDeploy
3
+ setup: setupWixDeploy
5
4
 
6
5
  commands:
7
6
  - name: deploy