Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appwrite-utils

Package Overview
Dependencies
Maintainers
0
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appwrite-utils - npm Package Compare versions

Comparing version 0.3.9 to 0.3.91

2

dist/index.d.ts

@@ -20,3 +20,3 @@ export { areCollectionNamesSame } from "./functions/collections.js";

export { indexSchema, type Index, indexesSchema, type Indexes, } from "./schemas/index.js";
export { type Permission, permissionSchema, type Permissions, permissionsSchema, } from "./schemas/permissions.js";
export { type Permission, permissionSchema, type Permissions, permissionsSchema, PermissionToAppwritePermission, } from "./schemas/permissions.js";
export { type IdMapping, idMappingSchema, type IdMappings, idMappingsSchema, } from "./schemas/idMapping.js";

@@ -23,0 +23,0 @@ export { type AttributeMapping, AttributeMappingSchema, type AttributeMappings, AttributeMappingsSchema, } from "./schemas/attributeMappings.js";

@@ -19,3 +19,3 @@ export { areCollectionNamesSame } from "./functions/collections.js";

export { indexSchema, indexesSchema, } from "./schemas/index.js";
export { permissionSchema, permissionsSchema, } from "./schemas/permissions.js";
export { permissionSchema, permissionsSchema, PermissionToAppwritePermission, } from "./schemas/permissions.js";
export { idMappingSchema, idMappingsSchema, } from "./schemas/idMapping.js";

@@ -22,0 +22,0 @@ export { AttributeMappingSchema, AttributeMappingsSchema, } from "./schemas/attributeMappings.js";

@@ -30,1 +30,2 @@ import { z } from "zod";

export type Permissions = z.infer<typeof permissionsSchema>;
export declare const PermissionToAppwritePermission: (permissions: Permissions) => string[];

@@ -0,1 +1,2 @@

import { Permission as AppwritePermission } from "appwrite";
import { z } from "zod";

@@ -20,1 +21,25 @@ export const permissionSchema = z

export const permissionsSchema = z.array(permissionSchema).optional();
export const PermissionToAppwritePermission = (permissions) => {
return permissions?.map(p => {
if (typeof p === 'string') {
return p;
}
else {
switch (p.permission) {
case "read":
return AppwritePermission.read(p.target);
case "create":
return AppwritePermission.create(p.target);
case "update":
return AppwritePermission.update(p.target);
case "delete":
return AppwritePermission.delete(p.target);
case "write":
return AppwritePermission.write(p.target);
default:
console.log(`Unknown permission: ${p.permission}`);
return '';
}
}
}).filter(p => p !== '') || [];
};
{
"name": "appwrite-utils",
"module": "dist/index.js",
"version": "0.3.9",
"version": "0.3.91",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "types": "dist/index.d.ts",

@@ -75,2 +75,3 @@ # appwrite-utils

- 0.3.91: Updated permissions to include `parsePermissions` which maps my permissions (`target`, `permission` to the Appwrite strings) -- also added `PermissionToAppwritePermission` which converts one of mine (target, permission) to Appwrite
- 0.3.9: Refactored the cli tool to allow for more specificity and configuration

@@ -77,0 +78,0 @@ - 0.3.8: Upgraded some parts of the package, AppwriteConfig typing updated to include buckets, made cli tool interactive

@@ -83,2 +83,3 @@ import { z } from "zod";

permissionsSchema,
PermissionToAppwritePermission,
} from "./schemas/permissions.js";

@@ -85,0 +86,0 @@ export {

@@ -0,1 +1,2 @@

import { Permission as AppwritePermission } from "appwrite";
import { z } from "zod";

@@ -27,1 +28,25 @@

export type Permissions = z.infer<typeof permissionsSchema>;
export const PermissionToAppwritePermission = (permissions: Permissions): string[] => {
return permissions?.map(p => {
if (typeof p === 'string') {
return p;
} else {
switch (p.permission) {
case "read":
return AppwritePermission.read(p.target);
case "create":
return AppwritePermission.create(p.target);
case "update":
return AppwritePermission.update(p.target);
case "delete":
return AppwritePermission.delete(p.target);
case "write":
return AppwritePermission.write(p.target);
default:
console.log(`Unknown permission: ${p.permission}`);
return '';
}
}
}).filter(p => p !== '') || [];
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc