@webiny/api-aco-ddb 0.0.0-unstable.9f53ea597d
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/FolderLevelPermissionsStorageOperations.d.ts +18 -0
- package/FolderLevelPermissionsStorageOperations.js +182 -0
- package/FolderLevelPermissionsStorageOperations.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/index.d.ts +6 -0
- package/index.js +12 -0
- package/index.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
import type { AcoFolderLevelPermissionsStorageOperations, FolderLevelPermission, StorageOperationsBatchUpdateFlpParams, StorageOperationsCreateFlpParams, StorageOperationsDeleteFlpParams, StorageOperationsGetFlpParams, StorageOperationsListFlpsParams, StorageOperationsUpdateFlpParams } from "@webiny/api-aco/types.js";
|
|
3
|
+
export interface StorageOperationsConfig {
|
|
4
|
+
documentClient: DynamoDBDocument;
|
|
5
|
+
}
|
|
6
|
+
export declare class FolderLevelPermissionsStorageOperations implements AcoFolderLevelPermissionsStorageOperations {
|
|
7
|
+
private readonly entity;
|
|
8
|
+
private readonly table;
|
|
9
|
+
constructor({ documentClient }: StorageOperationsConfig);
|
|
10
|
+
list({ where: { tenant, type, path_startsWith, parentId } }: StorageOperationsListFlpsParams): Promise<FolderLevelPermission[]>;
|
|
11
|
+
get({ tenant, id }: StorageOperationsGetFlpParams): Promise<FolderLevelPermission | null>;
|
|
12
|
+
create({ data }: StorageOperationsCreateFlpParams): Promise<FolderLevelPermission>;
|
|
13
|
+
update({ data: inputData, original }: StorageOperationsUpdateFlpParams): Promise<FolderLevelPermission>;
|
|
14
|
+
delete({ flp }: StorageOperationsDeleteFlpParams): Promise<void>;
|
|
15
|
+
batchUpdate({ items }: StorageOperationsBatchUpdateFlpParams): Promise<FolderLevelPermission[]>;
|
|
16
|
+
private createKeys;
|
|
17
|
+
private createGsiKeys;
|
|
18
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { createStandardEntity, createTable } from "@webiny/db-dynamodb";
|
|
2
|
+
import { WebinyError } from "@webiny/error";
|
|
3
|
+
import { executeWithRetry } from "@webiny/utils";
|
|
4
|
+
class FolderLevelPermissionsStorageOperations {
|
|
5
|
+
constructor({ documentClient }){
|
|
6
|
+
this.table = createTable({
|
|
7
|
+
name: String(process.env.DB_TABLE),
|
|
8
|
+
documentClient
|
|
9
|
+
});
|
|
10
|
+
this.entity = createStandardEntity({
|
|
11
|
+
table: this.table.table,
|
|
12
|
+
name: "ACO.flp"
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async list({ where: { tenant, type, path_startsWith, parentId } }) {
|
|
16
|
+
try {
|
|
17
|
+
if (parentId) {
|
|
18
|
+
const entries = await this.entity.queryAll({
|
|
19
|
+
partitionKey: `T#${tenant}#FLP`,
|
|
20
|
+
options: {
|
|
21
|
+
index: "GSI2",
|
|
22
|
+
eq: parentId
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return entries.map((entry)=>entry.data);
|
|
26
|
+
}
|
|
27
|
+
if (path_startsWith) {
|
|
28
|
+
const entries = await this.entity.queryAll({
|
|
29
|
+
partitionKey: `T#${tenant}#AT#${type}#FLP`,
|
|
30
|
+
options: {
|
|
31
|
+
index: "GSI1",
|
|
32
|
+
beginsWith: path_startsWith
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return entries.map((entry)=>entry.data);
|
|
36
|
+
}
|
|
37
|
+
throw new WebinyError("Missing required parameters.", "LIST_FLP_MISSING_PARAMETERS", {
|
|
38
|
+
tenant,
|
|
39
|
+
type,
|
|
40
|
+
path_startsWith,
|
|
41
|
+
parentId
|
|
42
|
+
});
|
|
43
|
+
} catch (err) {
|
|
44
|
+
throw WebinyError.from(err, {
|
|
45
|
+
message: "Could not list folder level permissions.",
|
|
46
|
+
code: "LIST_FLP_ERROR"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async get({ tenant, id }) {
|
|
51
|
+
try {
|
|
52
|
+
const entry = await this.entity.get(this.createKeys({
|
|
53
|
+
tenant,
|
|
54
|
+
id
|
|
55
|
+
}));
|
|
56
|
+
if (!entry) return null;
|
|
57
|
+
return entry.data;
|
|
58
|
+
} catch (err) {
|
|
59
|
+
throw WebinyError.from(err, {
|
|
60
|
+
message: "Could not load folder level permission.",
|
|
61
|
+
code: "GET_FLP_ERROR",
|
|
62
|
+
data: {
|
|
63
|
+
tenant,
|
|
64
|
+
id
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async create({ data }) {
|
|
70
|
+
const keys = {
|
|
71
|
+
...this.createKeys(data),
|
|
72
|
+
...this.createGsiKeys(data)
|
|
73
|
+
};
|
|
74
|
+
try {
|
|
75
|
+
await this.entity.put({
|
|
76
|
+
...keys,
|
|
77
|
+
data
|
|
78
|
+
});
|
|
79
|
+
return data;
|
|
80
|
+
} catch (err) {
|
|
81
|
+
throw WebinyError.from(err, {
|
|
82
|
+
message: "Could not create folder level permission.",
|
|
83
|
+
code: "CREATE_FLP_ERROR",
|
|
84
|
+
data: {
|
|
85
|
+
keys,
|
|
86
|
+
data
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async update({ data: inputData, original }) {
|
|
92
|
+
try {
|
|
93
|
+
const data = {
|
|
94
|
+
...original,
|
|
95
|
+
...inputData
|
|
96
|
+
};
|
|
97
|
+
const keys = {
|
|
98
|
+
...this.createKeys(data),
|
|
99
|
+
...this.createGsiKeys(data)
|
|
100
|
+
};
|
|
101
|
+
await this.entity.put({
|
|
102
|
+
...keys,
|
|
103
|
+
data
|
|
104
|
+
});
|
|
105
|
+
return data;
|
|
106
|
+
} catch (err) {
|
|
107
|
+
throw WebinyError.from(err, {
|
|
108
|
+
message: "Could not update folder level permission.",
|
|
109
|
+
code: "UPDATE_FLP_ERROR",
|
|
110
|
+
data: {
|
|
111
|
+
inputData,
|
|
112
|
+
original
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async delete({ flp }) {
|
|
118
|
+
const keys = this.createKeys(flp);
|
|
119
|
+
try {
|
|
120
|
+
await this.entity.delete(keys);
|
|
121
|
+
} catch (err) {
|
|
122
|
+
throw WebinyError.from(err, {
|
|
123
|
+
message: "Could not delete folder level permission.",
|
|
124
|
+
code: "DELETE_FLP_ERROR",
|
|
125
|
+
data: {
|
|
126
|
+
keys,
|
|
127
|
+
flp
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async batchUpdate({ items }) {
|
|
133
|
+
try {
|
|
134
|
+
const batch = this.entity.createEntityWriter();
|
|
135
|
+
const updatedItems = [];
|
|
136
|
+
for (const { original, data: inputData } of items){
|
|
137
|
+
const data = {
|
|
138
|
+
...original,
|
|
139
|
+
...inputData
|
|
140
|
+
};
|
|
141
|
+
const keys = {
|
|
142
|
+
...this.createKeys(data),
|
|
143
|
+
...this.createGsiKeys(data)
|
|
144
|
+
};
|
|
145
|
+
batch.put({
|
|
146
|
+
...keys,
|
|
147
|
+
data
|
|
148
|
+
});
|
|
149
|
+
updatedItems.push(data);
|
|
150
|
+
}
|
|
151
|
+
await executeWithRetry(async ()=>await batch.execute());
|
|
152
|
+
return updatedItems;
|
|
153
|
+
} catch (err) {
|
|
154
|
+
throw WebinyError.from(err, {
|
|
155
|
+
message: "Could not batch update folder level permissions.",
|
|
156
|
+
code: "BATCH_UPDATE_FLP_ERROR",
|
|
157
|
+
data: {
|
|
158
|
+
items
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
createKeys({ id, tenant }) {
|
|
164
|
+
return {
|
|
165
|
+
PK: `T#${tenant}#FLP#${id}`,
|
|
166
|
+
SK: "A",
|
|
167
|
+
TYPE: "aco.flp"
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
createGsiKeys({ tenant, type, path, parentId }) {
|
|
171
|
+
return {
|
|
172
|
+
GSI1_PK: `T#${tenant}#AT#${type}#FLP`,
|
|
173
|
+
GSI1_SK: path,
|
|
174
|
+
GSI2_PK: `T#${tenant}#FLP`,
|
|
175
|
+
GSI2_SK: parentId,
|
|
176
|
+
GSI_TENANT: tenant
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
export { FolderLevelPermissionsStorageOperations };
|
|
181
|
+
|
|
182
|
+
//# sourceMappingURL=FolderLevelPermissionsStorageOperations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FolderLevelPermissionsStorageOperations.js","sources":["../src/FolderLevelPermissionsStorageOperations.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createStandardEntity, createTable } from \"@webiny/db-dynamodb\";\nimport { WebinyError } from \"@webiny/error\";\nimport type {\n AcoFolderLevelPermissionsStorageOperations,\n FolderLevelPermission,\n StorageOperationsBatchUpdateFlpParams,\n StorageOperationsCreateFlpParams,\n StorageOperationsDeleteFlpParams,\n StorageOperationsGetFlpParams,\n StorageOperationsListFlpsParams,\n StorageOperationsUpdateFlpParams\n} from \"@webiny/api-aco/types.js\";\nimport { executeWithRetry } from \"@webiny/utils\";\n\nexport interface StorageOperationsConfig {\n documentClient: DynamoDBDocument;\n}\n\ninterface CreateKeysParams {\n tenant: string;\n id: string;\n}\n\ninterface CreateGsiKeysParams {\n tenant: string;\n id: string;\n type: string;\n path: string;\n parentId: string;\n}\n\nexport class FolderLevelPermissionsStorageOperations implements AcoFolderLevelPermissionsStorageOperations {\n private readonly entity;\n private readonly table;\n\n constructor({ documentClient }: StorageOperationsConfig) {\n this.table = createTable({\n name: String(process.env.DB_TABLE),\n documentClient\n });\n\n this.entity = createStandardEntity<FolderLevelPermission>({\n table: this.table.table,\n name: \"ACO.flp\"\n });\n }\n\n public async list({\n where: { tenant, type, path_startsWith, parentId }\n }: StorageOperationsListFlpsParams): Promise<FolderLevelPermission[]> {\n try {\n if (parentId) {\n const entries = await this.entity.queryAll({\n partitionKey: `T#${tenant}#FLP`,\n options: {\n index: \"GSI2\",\n eq: parentId\n }\n });\n return entries.map(entry => entry.data);\n }\n\n if (path_startsWith) {\n const entries = await this.entity.queryAll({\n partitionKey: `T#${tenant}#AT#${type}#FLP`,\n options: {\n index: \"GSI1\",\n beginsWith: path_startsWith\n }\n });\n return entries.map(entry => entry.data);\n }\n\n throw new WebinyError(\"Missing required parameters.\", \"LIST_FLP_MISSING_PARAMETERS\", {\n tenant,\n type,\n path_startsWith,\n parentId\n });\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not list folder level permissions.\",\n code: \"LIST_FLP_ERROR\"\n });\n }\n }\n\n public async get({\n tenant,\n id\n }: StorageOperationsGetFlpParams): Promise<FolderLevelPermission | null> {\n try {\n const entry = await this.entity.get(this.createKeys({ tenant, id }));\n\n if (!entry) {\n return null;\n }\n\n return entry.data;\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not load folder level permission.\",\n code: \"GET_FLP_ERROR\",\n data: { tenant, id }\n });\n }\n }\n\n public async create({\n data\n }: StorageOperationsCreateFlpParams): Promise<FolderLevelPermission> {\n const keys = {\n ...this.createKeys(data),\n ...this.createGsiKeys(data)\n };\n\n try {\n await this.entity.put({\n ...keys,\n data\n });\n\n return data;\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not create folder level permission.\",\n code: \"CREATE_FLP_ERROR\",\n data: { keys, data }\n });\n }\n }\n\n public async update({\n data: inputData,\n original\n }: StorageOperationsUpdateFlpParams): Promise<FolderLevelPermission> {\n try {\n const data = {\n ...original,\n ...inputData\n };\n\n const keys = {\n ...this.createKeys(data),\n ...this.createGsiKeys(data)\n };\n\n await this.entity.put({\n ...keys,\n data\n });\n\n return data;\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not update folder level permission.\",\n code: \"UPDATE_FLP_ERROR\",\n data: { inputData, original }\n });\n }\n }\n\n public async delete({ flp }: StorageOperationsDeleteFlpParams): Promise<void> {\n const keys = this.createKeys(flp);\n\n try {\n await this.entity.delete(keys);\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not delete folder level permission.\",\n code: \"DELETE_FLP_ERROR\",\n data: {\n keys,\n flp\n }\n });\n }\n }\n\n public async batchUpdate({\n items\n }: StorageOperationsBatchUpdateFlpParams): Promise<FolderLevelPermission[]> {\n try {\n const batch = this.entity.createEntityWriter();\n\n const updatedItems: FolderLevelPermission[] = [];\n\n for (const { original, data: inputData } of items) {\n const data = {\n ...original,\n ...inputData\n };\n\n const keys = {\n ...this.createKeys(data),\n ...this.createGsiKeys(data)\n };\n\n batch.put({\n ...keys,\n data\n });\n\n updatedItems.push(data);\n }\n\n await executeWithRetry(async () => {\n return await batch.execute();\n });\n\n return updatedItems;\n } catch (err) {\n throw WebinyError.from(err, {\n message: \"Could not batch update folder level permissions.\",\n code: \"BATCH_UPDATE_FLP_ERROR\",\n data: { items }\n });\n }\n }\n\n private createKeys({ id, tenant }: CreateKeysParams) {\n return {\n PK: `T#${tenant}#FLP#${id}`,\n SK: `A`,\n TYPE: \"aco.flp\"\n };\n }\n\n private createGsiKeys({ tenant, type, path, parentId }: CreateGsiKeysParams) {\n return {\n GSI1_PK: `T#${tenant}#AT#${type}#FLP`,\n GSI1_SK: path,\n GSI2_PK: `T#${tenant}#FLP`,\n GSI2_SK: parentId,\n GSI_TENANT: tenant\n };\n }\n}\n"],"names":["FolderLevelPermissionsStorageOperations","documentClient","createTable","String","process","createStandardEntity","tenant","type","path_startsWith","parentId","entries","entry","WebinyError","err","id","data","keys","inputData","original","flp","items","batch","updatedItems","executeWithRetry","path"],"mappings":";;;AAgCO,MAAMA;IAIT,YAAY,EAAEC,cAAc,EAA2B,CAAE;QACr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 -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @webiny/api-aco-ddb
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
6
|
+
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
interface RegisterAcoDdbStorageOperationsParams {
|
|
3
|
+
documentClient: DynamoDBDocument;
|
|
4
|
+
}
|
|
5
|
+
export declare const registerAcoDdbStorageOperations: (params: RegisterAcoDdbStorageOperationsParams) => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>;
|
|
6
|
+
export {};
|
package/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
2
|
+
import { FolderLevelPermissionsStorageOperations } from "./FolderLevelPermissionsStorageOperations.js";
|
|
3
|
+
import { FlpStorageOperations } from "@webiny/api-aco/features/folder/shared/abstractions.js";
|
|
4
|
+
const registerAcoDdbStorageOperations = (params)=>createRegisterExtensionPlugin((context)=>{
|
|
5
|
+
const flpStorageOperations = new FolderLevelPermissionsStorageOperations({
|
|
6
|
+
documentClient: params.documentClient
|
|
7
|
+
});
|
|
8
|
+
context.container.registerInstance(FlpStorageOperations, flpStorageOperations);
|
|
9
|
+
});
|
|
10
|
+
export { registerAcoDdbStorageOperations };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { FolderLevelPermissionsStorageOperations } from \"./FolderLevelPermissionsStorageOperations.js\";\nimport { FlpStorageOperations } from \"@webiny/api-aco/features/folder/shared/abstractions.js\";\n\ninterface RegisterAcoDdbStorageOperationsParams {\n documentClient: DynamoDBDocument;\n}\n\nexport const registerAcoDdbStorageOperations = (params: RegisterAcoDdbStorageOperationsParams) => {\n return createRegisterExtensionPlugin(context => {\n const flpStorageOperations = new FolderLevelPermissionsStorageOperations({\n documentClient: params.documentClient\n });\n\n context.container.registerInstance(FlpStorageOperations, flpStorageOperations);\n });\n};\n"],"names":["registerAcoDdbStorageOperations","params","createRegisterExtensionPlugin","context","flpStorageOperations","FolderLevelPermissionsStorageOperations","FlpStorageOperations"],"mappings":";;;AASO,MAAMA,kCAAkC,CAACC,SACrCC,8BAA8BC,CAAAA;QACjC,MAAMC,uBAAuB,IAAIC,wCAAwC;YACrE,gBAAgBJ,OAAO,cAAc;QACzC;QAEAE,QAAQ,SAAS,CAAC,gBAAgB,CAACG,sBAAsBF;IAC7D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/api-aco-ddb",
|
|
3
|
+
"version": "0.0.0-unstable.9f53ea597d",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"@webiny/api-aco",
|
|
7
|
+
"storage-operations",
|
|
8
|
+
"dynamodb",
|
|
9
|
+
"ddb",
|
|
10
|
+
"sau:ddb"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
15
|
+
},
|
|
16
|
+
"description": "DynamoDB storage operations for @webiny/api-aco.",
|
|
17
|
+
"author": "Webiny Ltd.",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./index.js",
|
|
21
|
+
"./*": "./*"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@webiny/api-aco": "0.0.0-unstable.9f53ea597d",
|
|
25
|
+
"@webiny/aws-sdk": "0.0.0-unstable.9f53ea597d",
|
|
26
|
+
"@webiny/db-dynamodb": "0.0.0-unstable.9f53ea597d",
|
|
27
|
+
"@webiny/error": "0.0.0-unstable.9f53ea597d",
|
|
28
|
+
"@webiny/handler": "0.0.0-unstable.9f53ea597d",
|
|
29
|
+
"@webiny/utils": "0.0.0-unstable.9f53ea597d"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@webiny/build-tools": "0.0.0-unstable.9f53ea597d",
|
|
33
|
+
"@webiny/project-utils": "0.0.0-unstable.9f53ea597d",
|
|
34
|
+
"rimraf": "6.1.3",
|
|
35
|
+
"typescript": "7.0.2"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"webiny": {
|
|
41
|
+
"publishFrom": "dist"
|
|
42
|
+
}
|
|
43
|
+
}
|