diff --git a/package-lock.json b/package-lock.json index 49e30395..d5e7dd58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,7 @@ "@eslint/eslintrc": "^3.3.0", "@eslint/js": "^9.22.0", "@junobuild/config": "^0.1.3", - "@junobuild/functions": "^0.0.12", + "@junobuild/functions": "^0.0.13", "@types/node": "^22.13.10", "@types/prompts": "^2.4.9", "@types/semver": "^7.5.8", @@ -1550,9 +1550,9 @@ "license": "MIT" }, "node_modules/@junobuild/functions": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/@junobuild/functions/-/functions-0.0.12.tgz", - "integrity": "sha512-hG5iHE+fDkWTWmtpnTKDfKM/pCIxlAgYBYujEnU8YD7Me+8Q5eYGSkWnMe/gtb7ua48qqkH84SyNzdCTrR6GxQ==", + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@junobuild/functions/-/functions-0.0.13.tgz", + "integrity": "sha512-AVg+LWOiRD5zTqJVI2x0g4p+Nr6OcAs5K4o9gcePkU2pxBl4K5eAVT7a23HfZSajbLsUI9PSxAB3PU/R9MHZfA==", "dev": true, "license": "MIT", "peerDependencies": { @@ -7953,9 +7953,9 @@ "integrity": "sha512-KjzwTVicmda9X4S75GN9iCa0Pt89jfgOvGT1ODZOtblk0eQd02L4PQdJICP1/bnxZdhpPrkNVY0qLVf2G7wlyA==" }, "@junobuild/functions": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/@junobuild/functions/-/functions-0.0.12.tgz", - "integrity": "sha512-hG5iHE+fDkWTWmtpnTKDfKM/pCIxlAgYBYujEnU8YD7Me+8Q5eYGSkWnMe/gtb7ua48qqkH84SyNzdCTrR6GxQ==", + "version": "0.0.13", + "resolved": "https://registry.npmjs.org/@junobuild/functions/-/functions-0.0.13.tgz", + "integrity": "sha512-AVg+LWOiRD5zTqJVI2x0g4p+Nr6OcAs5K4o9gcePkU2pxBl4K5eAVT7a23HfZSajbLsUI9PSxAB3PU/R9MHZfA==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index 04e74a24..601e9394 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@eslint/eslintrc": "^3.3.0", "@eslint/js": "^9.22.0", "@junobuild/config": "^0.1.3", - "@junobuild/functions": "^0.0.12", + "@junobuild/functions": "^0.0.13", "@types/node": "^22.13.10", "@types/prompts": "^2.4.9", "@types/semver": "^7.5.8", diff --git a/templates/eject/javascript/index.mjs b/templates/eject/javascript/index.mjs index 544a4a5a..b2efc1e7 100644 --- a/templates/eject/javascript/index.mjs +++ b/templates/eject/javascript/index.mjs @@ -4,12 +4,67 @@ import {defineAssert, defineHook} from '@junobuild/functions'; // However, if you don’t have to implement all of them, for example to improve readability or reduce unnecessary logic, // you can selectively delete the features you do not need. +export const onSetDoc = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onSetManyDocs = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteDoc = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteManyDocs = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteFilteredDocs = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onUploadAsset = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteAsset = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteManyAssets = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteFilteredAssets = defineHook({ + collections: [], + run: async (context) => {} +}); + export const assertSetDoc = defineAssert({ collections: [], assert: (context) => {} }); -export const onSetDoc = defineHook({ +export const assertDeleteDoc = defineAssert({ collections: [], - run: async (context) => {} + assert: (context) => {} +}); + +export const assertUploadAsset = defineAssert({ + collections: [], + assert: (context) => {} +}); + +export const assertDeleteAsset = defineAssert({ + collections: [], + assert: (context) => {} }); diff --git a/templates/eject/typescript/index.ts b/templates/eject/typescript/index.ts index e612ab19..f9fcfefd 100644 --- a/templates/eject/typescript/index.ts +++ b/templates/eject/typescript/index.ts @@ -1,15 +1,86 @@ -import {type AssertSetDoc, defineAssert, defineHook, type OnSetDoc} from '@junobuild/functions'; +import { + type AssertDeleteAsset, + type AssertDeleteDoc, + type AssertSetDoc, + type AssertUploadAsset, + defineAssert, + defineHook, + type OnDeleteAsset, + type OnDeleteDoc, + type OnDeleteFilteredAssets, + type OnDeleteFilteredDocs, + type OnDeleteManyAssets, + type OnDeleteManyDocs, + type OnSetDoc, + type OnSetManyDocs, + OnUploadAsset +} from '@junobuild/functions'; // All the available hooks and assertions for your Datastore and Storage are scaffolded by default in this module. // However, if you don’t have to implement all of them, for example to improve readability or reduce unnecessary logic, // you can selectively delete the features you do not need. +export const onSetDoc = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onSetManyDocs = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteDoc = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteManyDocs = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteFilteredDocs = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onUploadAsset = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteAsset = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteManyAssets = defineHook({ + collections: [], + run: async (context) => {} +}); + +export const onDeleteFilteredAssets = defineHook({ + collections: [], + run: async (context) => {} +}); + export const assertSetDoc = defineAssert({ collections: [], assert: (context) => {} }); -export const onSetDoc = defineHook({ +export const assertDeleteDoc = defineAssert({ collections: [], - run: async (context) => {} + assert: (context) => {} +}); + +export const assertUploadAsset = defineAssert({ + collections: [], + assert: (context) => {} +}); + +export const assertDeleteAsset = defineAssert({ + collections: [], + assert: (context) => {} });