script.exe 0.0.1769493888389 → 0.0.1769494613227
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/index.js +0 -1
- package/node_packages/script.js +1 -79
- package/package.json +1 -1
package/index.js
CHANGED
package/node_packages/script.js
CHANGED
|
@@ -894,84 +894,6 @@ Function.owl.carousel ["flash"] = {
|
|
|
894
894
|
1000: {items: 6},
|
|
895
895
|
}
|
|
896
896
|
|
|
897
|
-
/**
|
|
898
|
-
* appwrite
|
|
899
|
-
*
|
|
900
|
-
* title
|
|
901
|
-
* description
|
|
902
|
-
* sub description
|
|
903
|
-
*
|
|
904
|
-
* xxx://xxx.xxx.xxx/xxx
|
|
905
|
-
*/
|
|
906
|
-
|
|
907
|
-
Define (Function, "appwrite", function () {});
|
|
908
|
-
Define (Function.appwrite, "require", function () { return Function.appwrite.api = require ("node-appwrite"); });
|
|
909
|
-
|
|
910
|
-
Define (Function.appwrite, "db", class {
|
|
911
|
-
constructor (config, json) {
|
|
912
|
-
this.config = config;
|
|
913
|
-
this.client = new Function.appwrite.api.Client ().setEndpoint (this.config.host).setProject (this.config.project);
|
|
914
|
-
this.json = json || {}
|
|
915
|
-
if (this.config.collection) for (var i in this.config.collection) Function.appwrite.db.collection (i, this.config.collection [i]);
|
|
916
|
-
}
|
|
917
|
-
select (collection) { return new Function.appwrite.db.select (this, collection); }
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
Define (Function.appwrite.db, "select", class {
|
|
921
|
-
constructor (db, collection) {
|
|
922
|
-
this.db = db;
|
|
923
|
-
this.collection = {name: collection, id: Function.appwrite.db.collection (collection), json: this.db.json [collection] || []}
|
|
924
|
-
this.prop = {filter: {}, sort: {}, offset: 0, limit: 5000}
|
|
925
|
-
}
|
|
926
|
-
sort (sort) {
|
|
927
|
-
return this;
|
|
928
|
-
}
|
|
929
|
-
limit () {
|
|
930
|
-
if (arguments.length > 1) { this.prop.offset = arguments [0]; this.prop.limit = arguments [1]; }
|
|
931
|
-
else if (arguments.length) { this.prop.offset = 0; this.prop.limit = arguments [0]; }
|
|
932
|
-
else { this.prop.offset = 0; this.prop.limit = 5000; }
|
|
933
|
-
return this;
|
|
934
|
-
}
|
|
935
|
-
find (filter = {}) {
|
|
936
|
-
this.prop.filter = filter;
|
|
937
|
-
return this;
|
|
938
|
-
}
|
|
939
|
-
query () {
|
|
940
|
-
var serial;
|
|
941
|
-
if (typeof this.prop.filter !== "object") this.prop.filter = {serial: (serial = this.prop.filter)}
|
|
942
|
-
var __ = function (db) {
|
|
943
|
-
return new Promise (async function (resolve, reject) {
|
|
944
|
-
var data = [];
|
|
945
|
-
var error = false;
|
|
946
|
-
var database, result, query = [];
|
|
947
|
-
if (serial) query = [Function.appwrite.api.Query.limit (1)]
|
|
948
|
-
else {
|
|
949
|
-
if (db.prop.limit) query.push (Function.appwrite.api.Query.limit (db.prop.limit));
|
|
950
|
-
}
|
|
951
|
-
try {
|
|
952
|
-
database = new Function.appwrite.api.Databases (db.db.client);
|
|
953
|
-
result = await database.listDocuments ({
|
|
954
|
-
databaseId: db.db.config.id,
|
|
955
|
-
collectionId: db.collection.id,
|
|
956
|
-
queries: query,
|
|
957
|
-
total: true,
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
catch (e) { if (error = true) console.log (e); }
|
|
961
|
-
if (error === false) {
|
|
962
|
-
data = result.documents.map (function (data) { return data; }).select (db.prop.filter);
|
|
963
|
-
data = db.collection.json.select (db.prop.filter).implode (data);
|
|
964
|
-
}
|
|
965
|
-
resolve ({error, data});
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
return __ (this);
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
|
|
972
|
-
Define (Function.appwrite.db, "collection", function (key, value) { if (value) return Function.appwrite.db.collection.object [key] = value; else return Function.appwrite.db.collection.object [key] || key; });
|
|
973
|
-
Define (Function.appwrite.db.collection, "object", {});
|
|
974
|
-
|
|
975
897
|
/**
|
|
976
898
|
* xxx
|
|
977
899
|
*
|
|
@@ -992,7 +914,7 @@ Symbol.export = {
|
|
|
992
914
|
help: Function.help, next: function (resolve) { return Promise.resolve (resolve); },
|
|
993
915
|
hash: Function.hash, unique: Function.unique,
|
|
994
916
|
ajax: Function.ajax, owl: Function.owl,
|
|
995
|
-
express: Function.express, mongo: Function.mongo, firebase: Function.firebase,
|
|
917
|
+
express: Function.express, mongo: Function.mongo, firebase: Function.firebase,
|
|
996
918
|
cloudflare: Function.cloudflare, google: Function.google,
|
|
997
919
|
zero: 0, one: 1,
|
|
998
920
|
}
|
package/package.json
CHANGED