@webiny/api-record-locking 6.5.0-beta.3 → 6.5.0-beta.5

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.
@@ -5,7 +5,8 @@ class RecordLockingPrivateModelImpl {
5
5
  return [
6
6
  builder.private({
7
7
  modelId: RECORD_LOCKING_MODEL_ID,
8
- name: "Record Lock Tracking"
8
+ name: "Record Lock Tracking",
9
+ lifecycleEvents: false
9
10
  }).fields((fields)=>({
10
11
  targetId: fields.text().label("Target ID").required("Target ID is required."),
11
12
  type: fields.text().label("Record Type").required("Record type is required."),
@@ -1 +1 @@
1
- {"version":3,"file":"domain/RecordLockingModel.js","sources":["../../src/domain/RecordLockingModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\n\nexport const RECORD_LOCKING_MODEL_ID = \"wbyRecordLock\";\n\nclass RecordLockingPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: RECORD_LOCKING_MODEL_ID,\n name: \"Record Lock Tracking\"\n })\n .fields(fields => ({\n targetId: fields.text().label(\"Target ID\").required(\"Target ID is required.\"),\n type: fields.text().label(\"Record Type\").required(\"Record type is required.\"),\n actions: fields\n .object()\n .label(\"Actions\")\n .list()\n .fields(fields => ({\n type: fields\n .text()\n .label(\"Action Type\")\n .required(\"Action type is required.\"),\n message: fields.text().label(\"Message\"),\n createdBy: fields\n .object()\n .label(\"Created By\")\n .required(\"Created by is required.\")\n .fields(fields => ({\n id: fields.text().label(\"ID\").required(\"ID is required.\"),\n displayName: fields\n .text()\n .label(\"Display Name\")\n .required(\"Display name is required.\"),\n type: fields.text().label(\"Type\").required(\"Type is required.\")\n })),\n createdOn: fields\n .datetime()\n .label(\"Created On\")\n .required(\"Created on is required.\")\n .withoutTimezone()\n }))\n }))\n ];\n }\n}\n\nexport const RecordLockingModel = ModelFactory.createImplementation({\n implementation: RecordLockingPrivateModelImpl,\n dependencies: []\n});\n"],"names":["RECORD_LOCKING_MODEL_ID","RecordLockingPrivateModelImpl","builder","fields","RecordLockingModel","ModelFactory"],"mappings":";AAEO,MAAMA,0BAA0B;AAEvC,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASF;gBACT,MAAM;YACV,GACC,MAAM,CAACG,CAAAA,SAAW;oBACf,UAAUA,OAAO,IAAI,GAAG,KAAK,CAAC,aAAa,QAAQ,CAAC;oBACpD,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,eAAe,QAAQ,CAAC;oBAClD,SAASA,OACJ,MAAM,GACN,KAAK,CAAC,WACN,IAAI,GACJ,MAAM,CAACA,CAAAA,SAAW;4BACf,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,eACN,QAAQ,CAAC;4BACd,SAASA,OAAO,IAAI,GAAG,KAAK,CAAC;4BAC7B,WAAWA,OACN,MAAM,GACN,KAAK,CAAC,cACN,QAAQ,CAAC,2BACT,MAAM,CAACA,CAAAA,SAAW;oCACf,IAAIA,OAAO,IAAI,GAAG,KAAK,CAAC,MAAM,QAAQ,CAAC;oCACvC,aAAaA,OACR,IAAI,GACJ,KAAK,CAAC,gBACN,QAAQ,CAAC;oCACd,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;gCAC/C;4BACJ,WAAWA,OACN,QAAQ,GACR,KAAK,CAAC,cACN,QAAQ,CAAC,2BACT,eAAe;wBACxB;gBACR;SACP;IACL;AACJ;AAEO,MAAMC,qBAAqBC,aAAa,oBAAoB,CAAC;IAChE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"domain/RecordLockingModel.js","sources":["../../src/domain/RecordLockingModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\n\nexport const RECORD_LOCKING_MODEL_ID = \"wbyRecordLock\";\n\nclass RecordLockingPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: RECORD_LOCKING_MODEL_ID,\n name: \"Record Lock Tracking\",\n lifecycleEvents: false\n })\n .fields(fields => ({\n targetId: fields.text().label(\"Target ID\").required(\"Target ID is required.\"),\n type: fields.text().label(\"Record Type\").required(\"Record type is required.\"),\n actions: fields\n .object()\n .label(\"Actions\")\n .list()\n .fields(fields => ({\n type: fields\n .text()\n .label(\"Action Type\")\n .required(\"Action type is required.\"),\n message: fields.text().label(\"Message\"),\n createdBy: fields\n .object()\n .label(\"Created By\")\n .required(\"Created by is required.\")\n .fields(fields => ({\n id: fields.text().label(\"ID\").required(\"ID is required.\"),\n displayName: fields\n .text()\n .label(\"Display Name\")\n .required(\"Display name is required.\"),\n type: fields.text().label(\"Type\").required(\"Type is required.\")\n })),\n createdOn: fields\n .datetime()\n .label(\"Created On\")\n .required(\"Created on is required.\")\n .withoutTimezone()\n }))\n }))\n ];\n }\n}\n\nexport const RecordLockingModel = ModelFactory.createImplementation({\n implementation: RecordLockingPrivateModelImpl,\n dependencies: []\n});\n"],"names":["RECORD_LOCKING_MODEL_ID","RecordLockingPrivateModelImpl","builder","fields","RecordLockingModel","ModelFactory"],"mappings":";AAEO,MAAMA,0BAA0B;AAEvC,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASF;gBACT,MAAM;gBACN,iBAAiB;YACrB,GACC,MAAM,CAACG,CAAAA,SAAW;oBACf,UAAUA,OAAO,IAAI,GAAG,KAAK,CAAC,aAAa,QAAQ,CAAC;oBACpD,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,eAAe,QAAQ,CAAC;oBAClD,SAASA,OACJ,MAAM,GACN,KAAK,CAAC,WACN,IAAI,GACJ,MAAM,CAACA,CAAAA,SAAW;4BACf,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,eACN,QAAQ,CAAC;4BACd,SAASA,OAAO,IAAI,GAAG,KAAK,CAAC;4BAC7B,WAAWA,OACN,MAAM,GACN,KAAK,CAAC,cACN,QAAQ,CAAC,2BACT,MAAM,CAACA,CAAAA,SAAW;oCACf,IAAIA,OAAO,IAAI,GAAG,KAAK,CAAC,MAAM,QAAQ,CAAC;oCACvC,aAAaA,OACR,IAAI,GACJ,KAAK,CAAC,gBACN,QAAQ,CAAC;oCACd,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;gCAC/C;4BACJ,WAAWA,OACN,QAAQ,GACR,KAAK,CAAC,cACN,QAAQ,CAAC,2BACT,eAAe;wBACxB;gBACR;SACP;IACL;AACJ;AAEO,MAAMC,qBAAqBC,aAAa,oBAAoB,CAAC;IAChE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-record-locking",
3
- "version": "6.5.0-beta.3",
3
+ "version": "6.5.0-beta.5",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -16,26 +16,26 @@
16
16
  ],
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "@webiny/api": "6.5.0-beta.3",
20
- "@webiny/api-headless-cms": "6.5.0-beta.3",
21
- "@webiny/api-websockets": "6.5.0-beta.3",
22
- "@webiny/feature": "6.5.0-beta.3",
23
- "@webiny/handler": "6.5.0-beta.3",
24
- "@webiny/handler-aws": "6.5.0-beta.3",
25
- "@webiny/handler-graphql": "6.5.0-beta.3",
26
- "@webiny/plugins": "6.5.0-beta.3",
27
- "@webiny/utils": "6.5.0-beta.3"
19
+ "@webiny/api": "6.5.0-beta.5",
20
+ "@webiny/api-headless-cms": "6.5.0-beta.5",
21
+ "@webiny/api-websockets": "6.5.0-beta.5",
22
+ "@webiny/feature": "6.5.0-beta.5",
23
+ "@webiny/handler": "6.5.0-beta.5",
24
+ "@webiny/handler-aws": "6.5.0-beta.5",
25
+ "@webiny/handler-graphql": "6.5.0-beta.5",
26
+ "@webiny/plugins": "6.5.0-beta.5",
27
+ "@webiny/utils": "6.5.0-beta.5"
28
28
  },
29
29
  "devDependencies": {
30
- "@webiny/api-core": "6.5.0-beta.3",
31
- "@webiny/build-tools": "6.5.0-beta.3",
32
- "@webiny/project-utils": "6.5.0-beta.3",
33
- "@webiny/wcp": "6.5.0-beta.3",
30
+ "@webiny/api-core": "6.5.0-beta.5",
31
+ "@webiny/build-tools": "6.5.0-beta.5",
32
+ "@webiny/project-utils": "6.5.0-beta.5",
33
+ "@webiny/wcp": "6.5.0-beta.5",
34
34
  "graphql": "16.14.2",
35
35
  "rimraf": "6.1.3",
36
- "type-fest": "5.8.0",
36
+ "type-fest": "5.10.0",
37
37
  "typescript": "7.0.2",
38
- "vitest": "4.1.10"
38
+ "vitest": "5.0.2"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"
@@ -11,8 +11,7 @@ const convertWhereCondition = (where)=>{
11
11
  if (!value) continue;
12
12
  for(const subKey in value)value[subKey] = convertWhereCondition(value[subKey]);
13
13
  continue;
14
- }
15
- if (false === key.startsWith("id")) continue;
14
+ } else if (false === key.startsWith("id")) continue;
16
15
  const value = where[key];
17
16
  if (!value) continue;
18
17
  const newKey = key.replace("id", "entryId");
@@ -1 +1 @@
1
- {"version":3,"file":"utils/convertWhereCondition.js","sources":["../../src/utils/convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[]) => {\n if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key as keyof typeof where] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const value = where[key as keyof typeof where];\n if (!value) {\n continue;\n }\n\n const newKey = key.replace(\"id\", \"entryId\") as keyof typeof where;\n // @ts-expect-error\n where[newKey] = attachPrefix(where[key]);\n // @ts-expect-error\n delete where[key];\n }\n return where;\n};\n"],"names":["attachPrefix","value","Array","createLockRecordDatabaseId","convertWhereCondition","where","key","subKey","newKey"],"mappings":";AAKA,MAAMA,eAAe,CAACC;IAClB,IAAIC,MAAM,OAAO,CAACD,QACd,OAAOA,MAAM,GAAG,CAACE;IAErB,OAAOA,2BAA2BF;AACtC;AAEO,MAAMG,wBAAwB,CAACC;IAClC,IAAI,CAACA,OACD,OAAOA;IAEX,IAAK,MAAMC,OAAOD,MAAO;QACrB,IAAIC,IAAI,UAAU,CAAC,UAAUA,IAAI,UAAU,CAAC,OAAO;YAC/C,MAAML,QAAQI,KAAK,CAACC,IAA0B;YAC9C,IAAI,CAACL,OACD;YAEJ,IAAK,MAAMM,UAAUN,MACjBA,KAAK,CAACM,OAAO,GAAGH,sBAAsBH,KAAK,CAACM,OAAO;YAEvD;QACJ;QAAO,IAAID,AAAyB,UAAzBA,IAAI,UAAU,CAAC,OACtB;QAEJ,MAAML,QAAQI,KAAK,CAACC,IAA0B;QAC9C,IAAI,CAACL,OACD;QAGJ,MAAMO,SAASF,IAAI,OAAO,CAAC,MAAM;QAEjCD,KAAK,CAACG,OAAO,GAAGR,aAAaK,KAAK,CAACC,IAAI;QAEvC,OAAOD,KAAK,CAACC,IAAI;IACrB;IACA,OAAOD;AACX"}
1
+ {"version":3,"file":"utils/convertWhereCondition.js","sources":["../../src/utils/convertWhereCondition.ts"],"sourcesContent":["import type { IRecordLockingListLockRecordsParams } from \"~/types.js\";\nimport { createLockRecordDatabaseId } from \"~/utils/lockRecordDatabaseId.js\";\n\ntype IWhere = IRecordLockingListLockRecordsParams[\"where\"] | undefined;\n\nconst attachPrefix = (value: string | string[]) => {\n if (Array.isArray(value)) {\n return value.map(createLockRecordDatabaseId);\n }\n return createLockRecordDatabaseId(value);\n};\n\nexport const convertWhereCondition = (where: IWhere): IWhere => {\n if (!where) {\n return where;\n }\n for (const key in where) {\n if (key.startsWith(\"AND\") || key.startsWith(\"OR\")) {\n const value = where[key as keyof typeof where] as IWhere[] | undefined;\n if (!value) {\n continue;\n }\n for (const subKey in value) {\n value[subKey] = convertWhereCondition(value[subKey]);\n }\n continue;\n } else if (key.startsWith(\"id\") === false) {\n continue;\n }\n const value = where[key as keyof typeof where];\n if (!value) {\n continue;\n }\n\n const newKey = key.replace(\"id\", \"entryId\") as keyof typeof where;\n // @ts-expect-error\n where[newKey] = attachPrefix(where[key]);\n // @ts-expect-error\n delete where[key];\n }\n return where;\n};\n"],"names":["attachPrefix","value","Array","createLockRecordDatabaseId","convertWhereCondition","where","key","subKey","newKey"],"mappings":";AAKA,MAAMA,eAAe,CAACC;IAClB,IAAIC,MAAM,OAAO,CAACD,QACd,OAAOA,MAAM,GAAG,CAACE;IAErB,OAAOA,2BAA2BF;AACtC;AAEO,MAAMG,wBAAwB,CAACC;IAClC,IAAI,CAACA,OACD,OAAOA;IAEX,IAAK,MAAMC,OAAOD,MAAO;QACrB,IAAIC,IAAI,UAAU,CAAC,UAAUA,IAAI,UAAU,CAAC,OAAO;YAC/C,MAAML,QAAQI,KAAK,CAACC,IAA0B;YAC9C,IAAI,CAACL,OACD;YAEJ,IAAK,MAAMM,UAAUN,MACjBA,KAAK,CAACM,OAAO,GAAGH,sBAAsBH,KAAK,CAACM,OAAO;YAEvD;QACJ,OAAO,IAAID,AAAyB,UAAzBA,IAAI,UAAU,CAAC,OACtB;QAEJ,MAAML,QAAQI,KAAK,CAACC,IAA0B;QAC9C,IAAI,CAACL,OACD;QAGJ,MAAMO,SAASF,IAAI,OAAO,CAAC,MAAM;QAEjCD,KAAK,CAACG,OAAO,GAAGR,aAAaK,KAAK,CAACC,IAAI;QAEvC,OAAOD,KAAK,CAACC,IAAI;IACrB;IACA,OAAOD;AACX"}