diff --git a/packages/daemon/migrations/1686178611_collections_snapshot.js b/packages/daemon/migrations/1686178611_collections_snapshot.js index 468773b3..03f9b84d 100644 --- a/packages/daemon/migrations/1686178611_collections_snapshot.js +++ b/packages/daemon/migrations/1686178611_collections_snapshot.js @@ -1,492 +1,496 @@ -migrate((db) => { - const snapshot = [ - { - "id": "etae8tuiaxl6xfv", - "created": "2022-10-20 08:51:44.195Z", - "updated": "2023-06-07 22:41:11.725Z", - "name": "instances", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "qdtuuld1", - "name": "subdomain", - "type": "text", - "required": true, - "unique": true, - "options": { - "min": null, - "max": 50, - "pattern": "^[a-z][\\-a-z]+$" - } +migrate( + (db) => { + const snapshot = [ + { + id: 'etae8tuiaxl6xfv', + created: '2022-10-20 08:51:44.195Z', + updated: '2023-06-07 22:41:11.725Z', + name: 'instances', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'qdtuuld1', + name: 'subdomain', + type: 'text', + required: true, + unique: true, + options: { + min: null, + max: 50, + pattern: '^[a-z][\\-a-z]+$', + }, + }, + { + system: false, + id: 'rbj14krn', + name: 'uid', + type: 'relation', + required: true, + unique: false, + options: { + collectionId: 'systemprofiles0', + cascadeDelete: false, + minSelect: null, + maxSelect: 1, + displayFields: null, + }, + }, + { + system: false, + id: 'c2y74d7h', + name: 'status', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'yxby5r6b', + name: 'platform', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: '4ydffkv3', + name: 'version', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: '1arlklqq', + name: 'secondsThisMonth', + type: 'number', + required: false, + unique: false, + options: { + min: null, + max: null, + }, + }, + { + system: false, + id: '66vjgzcg', + name: 'isBackupAllowed', + type: 'bool', + required: false, + unique: false, + options: {}, + }, + { + system: false, + id: 'qew2o2d6', + name: 'currentWorkerBundleId', + type: 'text', + required: false, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: '3yu1db4p', + name: 'secrets', + type: 'json', + required: false, + unique: false, + options: {}, + }, + ], + indexes: [ + 'CREATE UNIQUE INDEX "idx_unique_qdtuuld1" on "instances" ("subdomain")', + ], + listRule: 'uid=@request.auth.id', + viewRule: 'uid = @request.auth.id', + createRule: null, + updateRule: null, + deleteRule: null, + options: {}, + }, + { + id: 'systemprofiles0', + created: '2022-10-31 21:31:52.175Z', + updated: '2023-06-07 22:41:11.723Z', + name: 'users', + type: 'auth', + system: false, + schema: [ + { + system: false, + id: 'pbfieldname', + name: 'name', + type: 'text', + required: false, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'pbfieldavatar', + name: 'avatar', + type: 'file', + required: false, + unique: false, + options: { + maxSelect: 1, + maxSize: 5242880, + mimeTypes: [ + 'image/jpg', + 'image/jpeg', + 'image/png', + 'image/svg+xml', + 'image/gif', + ], + thumbs: null, + protected: false, + }, + }, + ], + indexes: [], + listRule: 'id = @request.auth.id', + viewRule: 'id = @request.auth.id', + createRule: '', + updateRule: 'id = @request.auth.id', + deleteRule: null, + options: { + allowEmailAuth: true, + allowOAuth2Auth: true, + allowUsernameAuth: false, + exceptEmailDomains: null, + manageRule: null, + minPasswordLength: 8, + onlyEmailDomains: null, + requireEmail: true, }, - { - "system": false, - "id": "rbj14krn", - "name": "uid", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "systemprofiles0", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "c2y74d7h", - "name": "status", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "yxby5r6b", - "name": "platform", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "4ydffkv3", - "name": "version", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "1arlklqq", - "name": "secondsThisMonth", - "type": "number", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null - } - }, - { - "system": false, - "id": "66vjgzcg", - "name": "isBackupAllowed", - "type": "bool", - "required": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "qew2o2d6", - "name": "currentWorkerBundleId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "3yu1db4p", - "name": "secrets", - "type": "json", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [ - "CREATE UNIQUE INDEX \"idx_unique_qdtuuld1\" on \"instances\" (\"subdomain\")" - ], - "listRule": "uid=@request.auth.id", - "viewRule": "uid = @request.auth.id", - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "systemprofiles0", - "created": "2022-10-31 21:31:52.175Z", - "updated": "2023-06-07 22:41:11.723Z", - "name": "users", - "type": "auth", - "system": false, - "schema": [ - { - "system": false, - "id": "pbfieldname", - "name": "name", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "pbfieldavatar", - "name": "avatar", - "type": "file", - "required": false, - "unique": false, - "options": { - "maxSelect": 1, - "maxSize": 5242880, - "mimeTypes": [ - "image/jpg", - "image/jpeg", - "image/png", - "image/svg+xml", - "image/gif" - ], - "thumbs": null, - "protected": false - } - } - ], - "indexes": [], - "listRule": "id = @request.auth.id", - "viewRule": "id = @request.auth.id", - "createRule": "", - "updateRule": "id = @request.auth.id", - "deleteRule": null, - "options": { - "allowEmailAuth": true, - "allowOAuth2Auth": true, - "allowUsernameAuth": false, - "exceptEmailDomains": null, - "manageRule": null, - "minPasswordLength": 8, - "onlyEmailDomains": null, - "requireEmail": true - } - }, - { - "id": "aiw8te7y7atklwn", - "created": "2022-11-04 13:54:23.745Z", - "updated": "2023-06-07 22:41:11.723Z", - "name": "invocations", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "st9ydrbo", - "name": "instanceId", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "etae8tuiaxl6xfv", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "av4mpuyh", - "name": "startedAt", - "type": "date", - "required": true, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "fnwatixg", - "name": "endedAt", - "type": "date", - "required": false, - "unique": false, - "options": { - "min": "", - "max": "" - } - }, - { - "system": false, - "id": "awjozhbn", - "name": "pid", - "type": "number", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null - } - }, - { - "system": false, - "id": "vdkfqege", - "name": "totalSeconds", - "type": "number", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "v7s41iokt1vizxd", - "created": "2022-11-06 17:23:25.947Z", - "updated": "2023-06-07 22:41:11.723Z", - "name": "rpc", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "yv38czcf", - "name": "userId", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "systemprofiles0", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "tgvaxwfv", - "name": "payload", - "type": "json", - "required": true, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "zede8pci", - "name": "status", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "nd7cwqmn", - "name": "result", - "type": "json", - "required": false, - "unique": false, - "options": {} - }, - { - "system": false, - "id": "2hlrcx5j", - "name": "cmd", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [], - "listRule": "userId = @request.auth.id", - "viewRule": "userId = @request.auth.id", - "createRule": "userId = @request.auth.id && status='' && result='' && cmd ?= @collection.rpc_cmds.name", - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "72clb6v41bzsay9", - "created": "2022-11-09 15:23:20.313Z", - "updated": "2023-06-07 22:41:11.723Z", - "name": "backups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "someqtjw", - "name": "message", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "jk4zwiaj", - "name": "instanceId", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "etae8tuiaxl6xfv", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "wsy3l5gm", - "name": "status", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gmkrc5d9", - "name": "bytes", - "type": "number", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null - } - }, - { - "system": false, - "id": "4lmammjz", - "name": "platform", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "fheqxmbj", - "name": "version", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "cinbmdwe", - "name": "progress", - "type": "json", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": "@request.auth.id = instanceId.uid", - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }, - { - "id": "enp8mrv5ewtrltj", - "created": "2023-01-06 10:21:51.659Z", - "updated": "2023-06-07 22:41:11.725Z", - "name": "rpc_cmds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "jbostfhp", - "name": "name", - "type": "text", - "required": true, - "unique": true, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX \"idx_unique_jbostfhp\" on \"rpc_cmds\" (\"name\")" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - } - ]; + }, + { + id: 'aiw8te7y7atklwn', + created: '2022-11-04 13:54:23.745Z', + updated: '2023-06-07 22:41:11.723Z', + name: 'invocations', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'st9ydrbo', + name: 'instanceId', + type: 'relation', + required: true, + unique: false, + options: { + collectionId: 'etae8tuiaxl6xfv', + cascadeDelete: false, + minSelect: null, + maxSelect: 1, + displayFields: null, + }, + }, + { + system: false, + id: 'av4mpuyh', + name: 'startedAt', + type: 'date', + required: true, + unique: false, + options: { + min: '', + max: '', + }, + }, + { + system: false, + id: 'fnwatixg', + name: 'endedAt', + type: 'date', + required: false, + unique: false, + options: { + min: '', + max: '', + }, + }, + { + system: false, + id: 'awjozhbn', + name: 'pid', + type: 'number', + required: false, + unique: false, + options: { + min: null, + max: null, + }, + }, + { + system: false, + id: 'vdkfqege', + name: 'totalSeconds', + type: 'number', + required: false, + unique: false, + options: { + min: null, + max: null, + }, + }, + ], + indexes: [], + listRule: null, + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + options: {}, + }, + { + id: 'v7s41iokt1vizxd', + created: '2022-11-06 17:23:25.947Z', + updated: '2023-06-07 22:41:11.723Z', + name: 'rpc', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'yv38czcf', + name: 'userId', + type: 'relation', + required: true, + unique: false, + options: { + collectionId: 'systemprofiles0', + cascadeDelete: false, + minSelect: null, + maxSelect: 1, + displayFields: null, + }, + }, + { + system: false, + id: 'tgvaxwfv', + name: 'payload', + type: 'json', + required: true, + unique: false, + options: {}, + }, + { + system: false, + id: 'zede8pci', + name: 'status', + type: 'text', + required: false, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'nd7cwqmn', + name: 'result', + type: 'json', + required: false, + unique: false, + options: {}, + }, + { + system: false, + id: '2hlrcx5j', + name: 'cmd', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + ], + indexes: [], + listRule: 'userId = @request.auth.id', + viewRule: 'userId = @request.auth.id', + createRule: + "userId = @request.auth.id && status='' && result='' && cmd ?= @collection.rpc_cmds.name", + updateRule: null, + deleteRule: null, + options: {}, + }, + { + id: '72clb6v41bzsay9', + created: '2022-11-09 15:23:20.313Z', + updated: '2023-06-07 22:41:11.723Z', + name: 'backups', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'someqtjw', + name: 'message', + type: 'text', + required: false, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'jk4zwiaj', + name: 'instanceId', + type: 'relation', + required: true, + unique: false, + options: { + collectionId: 'etae8tuiaxl6xfv', + cascadeDelete: false, + minSelect: null, + maxSelect: 1, + displayFields: null, + }, + }, + { + system: false, + id: 'wsy3l5gm', + name: 'status', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'gmkrc5d9', + name: 'bytes', + type: 'number', + required: false, + unique: false, + options: { + min: null, + max: null, + }, + }, + { + system: false, + id: '4lmammjz', + name: 'platform', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'fheqxmbj', + name: 'version', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'cinbmdwe', + name: 'progress', + type: 'json', + required: false, + unique: false, + options: {}, + }, + ], + indexes: [], + listRule: '@request.auth.id = instanceId.uid', + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + options: {}, + }, + { + id: 'enp8mrv5ewtrltj', + created: '2023-01-06 10:21:51.659Z', + updated: '2023-06-07 22:41:11.725Z', + name: 'rpc_cmds', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'jbostfhp', + name: 'name', + type: 'text', + required: true, + unique: true, + options: { + min: null, + max: null, + pattern: '', + }, + }, + ], + indexes: [ + 'CREATE UNIQUE INDEX "idx_unique_jbostfhp" on "rpc_cmds" ("name")', + ], + listRule: null, + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + options: {}, + }, + ] - const collections = snapshot.map((item) => new Collection(item)); + const collections = snapshot.map((item) => new Collection(item)) - return Dao(db).importCollections(collections, true, null); -}, (db) => { - return null; -}) + return Dao(db).importCollections(collections, true, null) + }, + (db) => { + return null + }, +) diff --git a/packages/daemon/migrations/1686388017_updated_instances.js b/packages/daemon/migrations/1686388017_updated_instances.js index b619be0d..cf4205b6 100644 --- a/packages/daemon/migrations/1686388017_updated_instances.js +++ b/packages/daemon/migrations/1686388017_updated_instances.js @@ -1,67 +1,76 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - collection.indexes = [ - "CREATE UNIQUE INDEX `idx_unique_qdtuuld1` ON `instances` (`subdomain`)" - ] + collection.indexes = [ + 'CREATE UNIQUE INDEX `idx_unique_qdtuuld1` ON `instances` (`subdomain`)', + ] - // remove - collection.schema.removeField("yxby5r6b") + // remove + collection.schema.removeField('yxby5r6b') - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "qdtuuld1", - "name": "subdomain", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": 50, - "pattern": "^[a-z][\\-a-z]+$" - } - })) + // update + collection.schema.addField( + new SchemaField({ + system: false, + id: 'qdtuuld1', + name: 'subdomain', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: 50, + pattern: '^[a-z][\\-a-z]+$', + }, + }), + ) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - collection.indexes = [ - "CREATE UNIQUE INDEX \"idx_unique_qdtuuld1\" on \"instances\" (\"subdomain\")" - ] + collection.indexes = [ + 'CREATE UNIQUE INDEX "idx_unique_qdtuuld1" on "instances" ("subdomain")', + ] - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "yxby5r6b", - "name": "platform", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'yxby5r6b', + name: 'platform', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }), + ) - // update - collection.schema.addField(new SchemaField({ - "system": false, - "id": "qdtuuld1", - "name": "subdomain", - "type": "text", - "required": true, - "unique": true, - "options": { - "min": null, - "max": 50, - "pattern": "^[a-z][\\-a-z]+$" - } - })) + // update + collection.schema.addField( + new SchemaField({ + system: false, + id: 'qdtuuld1', + name: 'subdomain', + type: 'text', + required: true, + unique: true, + options: { + min: null, + max: 50, + pattern: '^[a-z][\\-a-z]+$', + }, + }), + ) - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686388321_updated_backups.js b/packages/daemon/migrations/1686388321_updated_backups.js index 0e4699db..b6b5567b 100644 --- a/packages/daemon/migrations/1686388321_updated_backups.js +++ b/packages/daemon/migrations/1686388321_updated_backups.js @@ -1,29 +1,34 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("72clb6v41bzsay9") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('72clb6v41bzsay9') - // remove - collection.schema.removeField("4lmammjz") + // remove + collection.schema.removeField('4lmammjz') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("72clb6v41bzsay9") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('72clb6v41bzsay9') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4lmammjz", - "name": "platform", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4lmammjz', + name: 'platform', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }), + ) - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686841115_deleted_rpc_cmds.js b/packages/daemon/migrations/1686841115_deleted_rpc_cmds.js index 76f88f8d..791a49c6 100644 --- a/packages/daemon/migrations/1686841115_deleted_rpc_cmds.js +++ b/packages/daemon/migrations/1686841115_deleted_rpc_cmds.js @@ -1,41 +1,44 @@ -migrate((db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("enp8mrv5ewtrltj"); +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('enp8mrv5ewtrltj') - return dao.deleteCollection(collection); -}, (db) => { - const collection = new Collection({ - "id": "enp8mrv5ewtrltj", - "created": "2023-01-06 10:21:51.659Z", - "updated": "2023-06-07 22:41:11.725Z", - "name": "rpc_cmds", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "jbostfhp", - "name": "name", - "type": "text", - "required": true, - "unique": true, - "options": { - "min": null, - "max": null, - "pattern": "" - } - } - ], - "indexes": [ - "CREATE UNIQUE INDEX \"idx_unique_jbostfhp\" on \"rpc_cmds\" (\"name\")" - ], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); + return dao.deleteCollection(collection) + }, + (db) => { + const collection = new Collection({ + id: 'enp8mrv5ewtrltj', + created: '2023-01-06 10:21:51.659Z', + updated: '2023-06-07 22:41:11.725Z', + name: 'rpc_cmds', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'jbostfhp', + name: 'name', + type: 'text', + required: true, + unique: true, + options: { + min: null, + max: null, + pattern: '', + }, + }, + ], + indexes: [ + 'CREATE UNIQUE INDEX "idx_unique_jbostfhp" on "rpc_cmds" ("name")', + ], + listRule: null, + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + options: {}, + }) - return Dao(db).saveCollection(collection); -}) + return Dao(db).saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686841133_updated_rpc.js b/packages/daemon/migrations/1686841133_updated_rpc.js index 78372065..c309c758 100644 --- a/packages/daemon/migrations/1686841133_updated_rpc.js +++ b/packages/daemon/migrations/1686841133_updated_rpc.js @@ -1,15 +1,19 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v7s41iokt1vizxd") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('v7s41iokt1vizxd') - collection.createRule = "userId = @request.auth.id && status='' && result=''" + collection.createRule = + "userId = @request.auth.id && status='' && result=''" - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("v7s41iokt1vizxd") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('v7s41iokt1vizxd') - collection.createRule = null + collection.createRule = null - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686842870_deleted_backups.js b/packages/daemon/migrations/1686842870_deleted_backups.js index 74e2dc6d..77cc5031 100644 --- a/packages/daemon/migrations/1686842870_deleted_backups.js +++ b/packages/daemon/migrations/1686842870_deleted_backups.js @@ -1,101 +1,104 @@ -migrate((db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("72clb6v41bzsay9"); +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('72clb6v41bzsay9') - return dao.deleteCollection(collection); -}, (db) => { - const collection = new Collection({ - "id": "72clb6v41bzsay9", - "created": "2022-11-09 15:23:20.313Z", - "updated": "2023-06-10 09:12:01.004Z", - "name": "backups", - "type": "base", - "system": false, - "schema": [ - { - "system": false, - "id": "someqtjw", - "name": "message", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "jk4zwiaj", - "name": "instanceId", - "type": "relation", - "required": true, - "unique": false, - "options": { - "collectionId": "etae8tuiaxl6xfv", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - }, - { - "system": false, - "id": "wsy3l5gm", - "name": "status", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "gmkrc5d9", - "name": "bytes", - "type": "number", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null - } - }, - { - "system": false, - "id": "fheqxmbj", - "name": "version", - "type": "text", - "required": true, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - }, - { - "system": false, - "id": "cinbmdwe", - "name": "progress", - "type": "json", - "required": false, - "unique": false, - "options": {} - } - ], - "indexes": [], - "listRule": "@request.auth.id = instanceId.uid", - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": {} - }); + return dao.deleteCollection(collection) + }, + (db) => { + const collection = new Collection({ + id: '72clb6v41bzsay9', + created: '2022-11-09 15:23:20.313Z', + updated: '2023-06-10 09:12:01.004Z', + name: 'backups', + type: 'base', + system: false, + schema: [ + { + system: false, + id: 'someqtjw', + name: 'message', + type: 'text', + required: false, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'jk4zwiaj', + name: 'instanceId', + type: 'relation', + required: true, + unique: false, + options: { + collectionId: 'etae8tuiaxl6xfv', + cascadeDelete: false, + minSelect: null, + maxSelect: 1, + displayFields: null, + }, + }, + { + system: false, + id: 'wsy3l5gm', + name: 'status', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'gmkrc5d9', + name: 'bytes', + type: 'number', + required: false, + unique: false, + options: { + min: null, + max: null, + }, + }, + { + system: false, + id: 'fheqxmbj', + name: 'version', + type: 'text', + required: true, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }, + { + system: false, + id: 'cinbmdwe', + name: 'progress', + type: 'json', + required: false, + unique: false, + options: {}, + }, + ], + indexes: [], + listRule: '@request.auth.id = instanceId.uid', + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + options: {}, + }) - return Dao(db).saveCollection(collection); -}) + return Dao(db).saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686842890_updated_instances.js b/packages/daemon/migrations/1686842890_updated_instances.js index 976e1f18..187d068a 100644 --- a/packages/daemon/migrations/1686842890_updated_instances.js +++ b/packages/daemon/migrations/1686842890_updated_instances.js @@ -1,25 +1,30 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "mexrkb5z", - "name": "maintenance", - "type": "bool", - "required": false, - "unique": false, - "options": {} - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'mexrkb5z', + name: 'maintenance', + type: 'bool', + required: false, + unique: false, + options: {}, + }), + ) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - // remove - collection.schema.removeField("mexrkb5z") + // remove + collection.schema.removeField('mexrkb5z') - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686844479_updated_instances.js b/packages/daemon/migrations/1686844479_updated_instances.js index 85ca2daf..d88ef0ce 100644 --- a/packages/daemon/migrations/1686844479_updated_instances.js +++ b/packages/daemon/migrations/1686844479_updated_instances.js @@ -1,25 +1,30 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - // remove - collection.schema.removeField("66vjgzcg") + // remove + collection.schema.removeField('66vjgzcg') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "66vjgzcg", - "name": "isBackupAllowed", - "type": "bool", - "required": false, - "unique": false, - "options": {} - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '66vjgzcg', + name: 'isBackupAllowed', + type: 'bool', + required: false, + unique: false, + options: {}, + }), + ) - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1686844500_updated_instances.js b/packages/daemon/migrations/1686844500_updated_instances.js index 2017e86b..fd5eddb3 100644 --- a/packages/daemon/migrations/1686844500_updated_instances.js +++ b/packages/daemon/migrations/1686844500_updated_instances.js @@ -1,29 +1,34 @@ -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - // remove - collection.schema.removeField("qew2o2d6") + // remove + collection.schema.removeField('qew2o2d6') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("etae8tuiaxl6xfv") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('etae8tuiaxl6xfv') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "qew2o2d6", - "name": "currentWorkerBundleId", - "type": "text", - "required": false, - "unique": false, - "options": { - "min": null, - "max": null, - "pattern": "" - } - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'qew2o2d6', + name: 'currentWorkerBundleId', + type: 'text', + required: false, + unique: false, + options: { + min: null, + max: null, + pattern: '', + }, + }), + ) - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1687194382_created_stats_view.js b/packages/daemon/migrations/1687194382_created_stats_view.js index 8212f64b..36f82f4a 100644 --- a/packages/daemon/migrations/1687194382_created_stats_view.js +++ b/packages/daemon/migrations/1687194382_created_stats_view.js @@ -170,5 +170,5 @@ migrate( const collection = dao.findCollectionByNameOrId('se6fljwhhc03k4q') return dao.deleteCollection(collection) - } + }, ) diff --git a/packages/daemon/migrations/1687196200_updated_invocations.js b/packages/daemon/migrations/1687196200_updated_invocations.js index 427899a0..b22630c6 100644 --- a/packages/daemon/migrations/1687196200_updated_invocations.js +++ b/packages/daemon/migrations/1687196200_updated_invocations.js @@ -22,5 +22,5 @@ migrate( collection.indexes = [] return dao.saveCollection(collection) - } + }, ) diff --git a/packages/daemon/migrations/1687196739_updated_instances.js b/packages/daemon/migrations/1687196739_updated_instances.js index 8ce8a120..31ab3905 100644 --- a/packages/daemon/migrations/1687196739_updated_instances.js +++ b/packages/daemon/migrations/1687196739_updated_instances.js @@ -17,5 +17,5 @@ migrate( collection.indexes = [] return dao.saveCollection(collection) - } + }, ) diff --git a/packages/daemon/migrations/1694786202_created_potentialPaidUsersView.js b/packages/daemon/migrations/1694786202_created_potentialPaidUsersView.js index ffd43256..9fda1b77 100644 --- a/packages/daemon/migrations/1694786202_created_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1694786202_created_potentialPaidUsersView.js @@ -1,42 +1,46 @@ /// -migrate((db) => { - const collection = new Collection({ - "id": "y7qb3zm8vslkfxj", - "created": "2023-09-15 13:56:42.907Z", - "updated": "2023-09-15 13:56:42.907Z", - "name": "potentialPaidUsersView", - "type": "view", - "system": false, - "schema": [ - { - "system": false, - "id": "2gw1y72t", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null - } - } - ], - "indexes": [], - "listRule": null, - "viewRule": null, - "createRule": null, - "updateRule": null, - "deleteRule": null, - "options": { - "query": "select id,email from users where id in (select uid from instances where secondsThisMonth>6000)" - } - }); +migrate( + (db) => { + const collection = new Collection({ + id: 'y7qb3zm8vslkfxj', + created: '2023-09-15 13:56:42.907Z', + updated: '2023-09-15 13:56:42.907Z', + name: 'potentialPaidUsersView', + type: 'view', + system: false, + schema: [ + { + system: false, + id: '2gw1y72t', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }, + ], + indexes: [], + listRule: null, + viewRule: null, + createRule: null, + updateRule: null, + deleteRule: null, + options: { + query: + 'select id,email from users where id in (select uid from instances where secondsThisMonth>6000)', + }, + }) - return Dao(db).saveCollection(collection); -}, (db) => { - const dao = new Dao(db); - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj"); + return Dao(db).saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - return dao.deleteCollection(collection); -}) + return dao.deleteCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1694789066_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694789066_updated_potentialPaidUsersView.js index bcfd18f8..e480388f 100644 --- a/packages/daemon/migrations/1694789066_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1694789066_updated_potentialPaidUsersView.js @@ -1,56 +1,65 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "select id,email from users where id in (select uid from instances where secondsThisMonth<=6000)" - } - - // remove - collection.schema.removeField("2gw1y72t") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "mu8wxouc", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'select id,email from users where id in (select uid from instances where secondsThisMonth<=6000)', } - })) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // remove + collection.schema.removeField('2gw1y72t') - collection.options = { - "query": "select id,email from users where id in (select uid from instances where secondsThisMonth>6000)" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'mu8wxouc', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "2gw1y72t", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'select id,email from users where id in (select uid from instances where secondsThisMonth>6000)', } - })) - // remove - collection.schema.removeField("mu8wxouc") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '2gw1y72t', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - return dao.saveCollection(collection) -}) + // remove + collection.schema.removeField('mu8wxouc') + + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js index e175758d..5bac918a 100644 --- a/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1694959699_updated_potentialPaidUsersView.js @@ -1,56 +1,65 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "select id,email from users where id in (select uid from instances where secondsThisMonth>6000)" - } - - // remove - collection.schema.removeField("mu8wxouc") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4dwqriso", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'select id,email from users where id in (select uid from instances where secondsThisMonth>6000)', } - })) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // remove + collection.schema.removeField('mu8wxouc') - collection.options = { - "query": "select id,email from users where id in (select uid from instances where secondsThisMonth<=6000)" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4dwqriso', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "mu8wxouc", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'select id,email from users where id in (select uid from instances where secondsThisMonth<=6000)', } - })) - // remove - collection.schema.removeField("4dwqriso") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'mu8wxouc', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - return dao.saveCollection(collection) -}) + // remove + collection.schema.removeField('4dwqriso') + + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js index 732f9fb5..4b8463a4 100644 --- a/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1694959794_updated_potentialPaidUsersView.js @@ -1,71 +1,82 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth>6000" - } - - // remove - collection.schema.removeField("4dwqriso") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "jeo2co2y", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth>6000', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "pcl2olai", - "name": "secondsThisMonth", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) + // remove + collection.schema.removeField('4dwqriso') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'jeo2co2y', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - collection.options = { - "query": "select id,email from users where id in (select uid from instances where secondsThisMonth>6000)" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'pcl2olai', + name: 'secondsThisMonth', + type: 'json', + required: false, + presentable: false, + unique: false, + options: {}, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4dwqriso", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'select id,email from users where id in (select uid from instances where secondsThisMonth>6000)', } - })) - // remove - collection.schema.removeField("jeo2co2y") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4dwqriso', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // remove - collection.schema.removeField("pcl2olai") + // remove + collection.schema.removeField('jeo2co2y') - return dao.saveCollection(collection) -}) + // remove + collection.schema.removeField('pcl2olai') + + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js index 1ef65c35..a10b831b 100644 --- a/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1694959837_updated_potentialPaidUsersView.js @@ -1,86 +1,99 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>500" - } - - // remove - collection.schema.removeField("jeo2co2y") - - // remove - collection.schema.removeField("pcl2olai") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4nas99bt", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>500', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "pmfykpks", - "name": "secondsThisMonth", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) + // remove + collection.schema.removeField('jeo2co2y') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // remove + collection.schema.removeField('pcl2olai') - collection.options = { - "query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth>6000" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4nas99bt', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "jeo2co2y", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'pmfykpks', + name: 'secondsThisMonth', + type: 'json', + required: false, + presentable: false, + unique: false, + options: {}, + }), + ) + + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth>6000', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "pcl2olai", - "name": "secondsThisMonth", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'jeo2co2y', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // remove - collection.schema.removeField("4nas99bt") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'pcl2olai', + name: 'secondsThisMonth', + type: 'json', + required: false, + presentable: false, + unique: false, + options: {}, + }), + ) - // remove - collection.schema.removeField("pmfykpks") + // remove + collection.schema.removeField('4nas99bt') - return dao.saveCollection(collection) -}) + // remove + collection.schema.removeField('pmfykpks') + + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js index ec5a1e78..a1db1d15 100644 --- a/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1694959887_updated_potentialPaidUsersView.js @@ -1,86 +1,99 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>200" - } - - // remove - collection.schema.removeField("4nas99bt") - - // remove - collection.schema.removeField("pmfykpks") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "c0fjqkvh", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>200', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "nrzmfvrb", - "name": "secondsThisMonth", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) + // remove + collection.schema.removeField('4nas99bt') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // remove + collection.schema.removeField('pmfykpks') - collection.options = { - "query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>500" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'c0fjqkvh', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4nas99bt", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'nrzmfvrb', + name: 'secondsThisMonth', + type: 'json', + required: false, + presentable: false, + unique: false, + options: {}, + }), + ) + + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>500', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "pmfykpks", - "name": "secondsThisMonth", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4nas99bt', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - // remove - collection.schema.removeField("c0fjqkvh") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'pmfykpks', + name: 'secondsThisMonth', + type: 'json', + required: false, + presentable: false, + unique: false, + options: {}, + }), + ) - // remove - collection.schema.removeField("nrzmfvrb") + // remove + collection.schema.removeField('c0fjqkvh') - return dao.saveCollection(collection) -}) + // remove + collection.schema.removeField('nrzmfvrb') + + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695129360_updated_invocations.js b/packages/daemon/migrations/1695129360_updated_invocations.js index 085e58b0..8071cbbb 100644 --- a/packages/daemon/migrations/1695129360_updated_invocations.js +++ b/packages/daemon/migrations/1695129360_updated_invocations.js @@ -1,54 +1,59 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aiw8te7y7atklwn") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('aiw8te7y7atklwn') - collection.indexes = [ - "CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)", - "CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)", - "CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)", - "CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)", - "CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)", - "CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)", - "CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)', + 'CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)', + 'CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)', + 'CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)', + 'CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)', + 'CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)', + 'CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)', + ] - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "kmyokg1d", - "name": "uid", - "type": "relation", - "required": false, - "presentable": false, - "unique": false, - "options": { - "collectionId": "systemprofiles0", - "cascadeDelete": false, - "minSelect": null, - "maxSelect": 1, - "displayFields": null - } - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'kmyokg1d', + name: 'uid', + type: 'relation', + required: false, + presentable: false, + unique: false, + options: { + collectionId: 'systemprofiles0', + cascadeDelete: false, + minSelect: null, + maxSelect: 1, + displayFields: null, + }, + }), + ) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aiw8te7y7atklwn") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('aiw8te7y7atklwn') - collection.indexes = [ - "CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)", - "CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)", - "CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)", - "CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)", - "CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)", - "CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)', + 'CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)', + 'CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)', + 'CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)', + 'CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)', + 'CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)', + ] - // remove - collection.schema.removeField("kmyokg1d") + // remove + collection.schema.removeField('kmyokg1d') - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695130842_updated_invocations.js b/packages/daemon/migrations/1695130842_updated_invocations.js index abd5c4dc..6fe579d1 100644 --- a/packages/daemon/migrations/1695130842_updated_invocations.js +++ b/packages/daemon/migrations/1695130842_updated_invocations.js @@ -1,36 +1,39 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aiw8te7y7atklwn") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('aiw8te7y7atklwn') - collection.indexes = [ - "CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)", - "CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)", - "CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)", - "CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)", - "CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)", - "CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)", - "CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)", - "CREATE INDEX `idx_gh6iEUG` ON `invocations` (\n `instanceId`,\n `startedAt`\n)", - "CREATE INDEX `idx_CUsNbfu` ON `invocations` (\n `uid`,\n `startedAt`\n)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)', + 'CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)', + 'CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)', + 'CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)', + 'CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)', + 'CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)', + 'CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)', + 'CREATE INDEX `idx_gh6iEUG` ON `invocations` (\n `instanceId`,\n `startedAt`\n)', + 'CREATE INDEX `idx_CUsNbfu` ON `invocations` (\n `uid`,\n `startedAt`\n)', + ] - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aiw8te7y7atklwn") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('aiw8te7y7atklwn') - collection.indexes = [ - "CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)", - "CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)", - "CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)", - "CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)", - "CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)", - "CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)", - "CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)', + 'CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)', + 'CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)', + 'CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)', + 'CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)', + 'CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)', + 'CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)', + ] - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695250305_updated_users.js b/packages/daemon/migrations/1695250305_updated_users.js index 2093c763..f36f4f5d 100644 --- a/packages/daemon/migrations/1695250305_updated_users.js +++ b/packages/daemon/migrations/1695250305_updated_users.js @@ -1,31 +1,36 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("systemprofiles0") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('systemprofiles0') - // remove - collection.schema.removeField("rgwv4xhk") + // remove + collection.schema.removeField('rgwv4xhk') - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("systemprofiles0") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('systemprofiles0') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "rgwv4xhk", - "name": "totalSecondsThisMonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false - } - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'rgwv4xhk', + name: 'totalSecondsThisMonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js index 1b6ff74a..ada5e6ea 100644 --- a/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1695250333_updated_potentialPaidUsersView.js @@ -1,90 +1,103 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "SELECT u.id,\n email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND secondsthismonth/60>200" - } - - // remove - collection.schema.removeField("c0fjqkvh") - - // remove - collection.schema.removeField("nrzmfvrb") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "9xsegduz", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'SELECT u.id,\n email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND secondsthismonth/60>200', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4dmlmvan", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false + // remove + collection.schema.removeField('c0fjqkvh') + + // remove + collection.schema.removeField('nrzmfvrb') + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '9xsegduz', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4dmlmvan', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) + + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>200', } - })) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'c0fjqkvh', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - collection.options = { - "query": "select u.id,email,secondsThisMonth from users u join instances i where u.id=i.uid and secondsThisMonth/60>200" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'nrzmfvrb', + name: 'secondsThisMonth', + type: 'json', + required: false, + presentable: false, + unique: false, + options: {}, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "c0fjqkvh", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null - } - })) + // remove + collection.schema.removeField('9xsegduz') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "nrzmfvrb", - "name": "secondsThisMonth", - "type": "json", - "required": false, - "presentable": false, - "unique": false, - "options": {} - })) + // remove + collection.schema.removeField('4dmlmvan') - // remove - collection.schema.removeField("9xsegduz") - - // remove - collection.schema.removeField("4dmlmvan") - - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js index ce8c170d..f46f5383 100644 --- a/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1695250379_updated_potentialPaidUsersView.js @@ -1,94 +1,107 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "SELECT u.id,\n u.email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND i.secondsthismonth/60>200" - } - - // remove - collection.schema.removeField("9xsegduz") - - // remove - collection.schema.removeField("4dmlmvan") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "omarcdxd", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'SELECT u.id,\n u.email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND i.secondsthismonth/60>200', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "c2czszfp", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false + // remove + collection.schema.removeField('9xsegduz') + + // remove + collection.schema.removeField('4dmlmvan') + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'omarcdxd', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'c2czszfp', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) + + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'SELECT u.id,\n email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND secondsthismonth/60>200', } - })) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '9xsegduz', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - collection.options = { - "query": "SELECT u.id,\n email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND secondsthismonth/60>200" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: '4dmlmvan', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "9xsegduz", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null - } - })) + // remove + collection.schema.removeField('omarcdxd') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "4dmlmvan", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false - } - })) + // remove + collection.schema.removeField('c2czszfp') - // remove - collection.schema.removeField("omarcdxd") - - // remove - collection.schema.removeField("c2czszfp") - - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695250393_updated_users.js b/packages/daemon/migrations/1695250393_updated_users.js index 13000544..335befa7 100644 --- a/packages/daemon/migrations/1695250393_updated_users.js +++ b/packages/daemon/migrations/1695250393_updated_users.js @@ -1,37 +1,42 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("systemprofiles0") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('systemprofiles0') - collection.indexes = [ - "CREATE INDEX `idx_q4Kji47` ON `users` (`secondsThisMonth`)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_q4Kji47` ON `users` (`secondsThisMonth`)', + ] - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "qz4cjamg", - "name": "secondsThisMonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false - } - })) + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'qz4cjamg', + name: 'secondsThisMonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("systemprofiles0") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('systemprofiles0') - collection.indexes = [] + collection.indexes = [] - // remove - collection.schema.removeField("qz4cjamg") + // remove + collection.schema.removeField('qz4cjamg') - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js index 22756be8..70d1b13e 100644 --- a/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1695250535_updated_potentialPaidUsersView.js @@ -1,94 +1,107 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.secondsthismonth/60>200" - } - - // remove - collection.schema.removeField("omarcdxd") - - // remove - collection.schema.removeField("c2czszfp") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ld24cbna", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.secondsthismonth/60>200', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "g3qvj4tl", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false + // remove + collection.schema.removeField('omarcdxd') + + // remove + collection.schema.removeField('c2czszfp') + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'ld24cbna', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'g3qvj4tl', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) + + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'SELECT u.id,\n u.email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND i.secondsthismonth/60>200', } - })) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'omarcdxd', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - collection.options = { - "query": "SELECT u.id,\n u.email,\n i.secondsthismonth\nFROM users u\nJOIN instances i\nwhere u.id=i.uid\nAND i.secondsthismonth/60>200" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'c2czszfp', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "omarcdxd", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null - } - })) + // remove + collection.schema.removeField('ld24cbna') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "c2czszfp", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false - } - })) + // remove + collection.schema.removeField('g3qvj4tl') - // remove - collection.schema.removeField("ld24cbna") - - // remove - collection.schema.removeField("g3qvj4tl") - - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695252431_updated_invocations.js b/packages/daemon/migrations/1695252431_updated_invocations.js index 472e6f62..e33b4cc5 100644 --- a/packages/daemon/migrations/1695252431_updated_invocations.js +++ b/packages/daemon/migrations/1695252431_updated_invocations.js @@ -1,42 +1,45 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aiw8te7y7atklwn") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('aiw8te7y7atklwn') - collection.indexes = [ - "CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)", - "CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)", - "CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)", - "CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)", - "CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)", - "CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)", - "CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)", - "CREATE INDEX `idx_gh6iEUG` ON `invocations` (\n `instanceId`,\n `startedAt`\n)", - "CREATE INDEX `idx_CUsNbfu` ON `invocations` (\n `uid`,\n `startedAt`\n)", - "CREATE INDEX `idx_O3bEfl0` ON `invocations` (`updated`)", - "CREATE INDEX `idx_qOyDhVG` ON `invocations` (`created`)", - "CREATE INDEX `idx_UM6cwSA` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_nMr318s` ON `invocations` (`totalSeconds`)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)', + 'CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)', + 'CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)', + 'CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)', + 'CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)', + 'CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)', + 'CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)', + 'CREATE INDEX `idx_gh6iEUG` ON `invocations` (\n `instanceId`,\n `startedAt`\n)', + 'CREATE INDEX `idx_CUsNbfu` ON `invocations` (\n `uid`,\n `startedAt`\n)', + 'CREATE INDEX `idx_O3bEfl0` ON `invocations` (`updated`)', + 'CREATE INDEX `idx_qOyDhVG` ON `invocations` (`created`)', + 'CREATE INDEX `idx_UM6cwSA` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_nMr318s` ON `invocations` (`totalSeconds`)', + ] - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("aiw8te7y7atklwn") + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('aiw8te7y7atklwn') - collection.indexes = [ - "CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)", - "CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)", - "CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)", - "CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)", - "CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)", - "CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)", - "CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)", - "CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)", - "CREATE INDEX `idx_gh6iEUG` ON `invocations` (\n `instanceId`,\n `startedAt`\n)", - "CREATE INDEX `idx_CUsNbfu` ON `invocations` (\n `uid`,\n `startedAt`\n)" - ] + collection.indexes = [ + 'CREATE INDEX `idx_CTV52b6` ON `invocations` (`created`)', + 'CREATE INDEX `idx_6rNZeTK` ON `invocations` (`instanceId`)', + 'CREATE INDEX `idx_LTmqfbC` ON `invocations` (`totalSeconds`)', + 'CREATE INDEX `idx_7YR9a3g` ON `invocations` (\n `instanceId`,\n `created`\n)', + 'CREATE INDEX `idx_ntC1d1L` ON `invocations` (\n `totalSeconds`,\n `created`\n)', + 'CREATE INDEX `idx_vViR75E` ON `invocations` (\n `created`,\n `totalSeconds`\n)', + 'CREATE INDEX `idx_q9LanEj` ON `invocations` (\n `created`,\n `instanceId`\n)', + 'CREATE INDEX `idx_ueUQe1N` ON `invocations` (`uid`)', + 'CREATE INDEX `idx_gh6iEUG` ON `invocations` (\n `instanceId`,\n `startedAt`\n)', + 'CREATE INDEX `idx_CUsNbfu` ON `invocations` (\n `uid`,\n `startedAt`\n)', + ] - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/migrations/1695796793_updated_potentialPaidUsersView.js b/packages/daemon/migrations/1695796793_updated_potentialPaidUsersView.js index 5a241298..841d3077 100644 --- a/packages/daemon/migrations/1695796793_updated_potentialPaidUsersView.js +++ b/packages/daemon/migrations/1695796793_updated_potentialPaidUsersView.js @@ -1,94 +1,107 @@ /// -migrate((db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") +migrate( + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') - collection.options = { - "query": "SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.verified=1 and u.secondsthismonth/60>200" - } - - // remove - collection.schema.removeField("ld24cbna") - - // remove - collection.schema.removeField("g3qvj4tl") - - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "mkmeisox", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null + collection.options = { + query: + 'SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.verified=1 and u.secondsthismonth/60>200', } - })) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "wqw6fejd", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false + // remove + collection.schema.removeField('ld24cbna') + + // remove + collection.schema.removeField('g3qvj4tl') + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'mkmeisox', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) + + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'wqw6fejd', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) + + return dao.saveCollection(collection) + }, + (db) => { + const dao = new Dao(db) + const collection = dao.findCollectionByNameOrId('y7qb3zm8vslkfxj') + + collection.options = { + query: + 'SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.secondsthismonth/60>200', } - })) - return dao.saveCollection(collection) -}, (db) => { - const dao = new Dao(db) - const collection = dao.findCollectionByNameOrId("y7qb3zm8vslkfxj") + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'ld24cbna', + name: 'email', + type: 'email', + required: false, + presentable: false, + unique: false, + options: { + exceptDomains: null, + onlyDomains: null, + }, + }), + ) - collection.options = { - "query": "SELECT u.id,\n u.email,\n u.secondsthismonth\nFROM users u\nWHERE u.secondsthismonth/60>200" - } + // add + collection.schema.addField( + new SchemaField({ + system: false, + id: 'g3qvj4tl', + name: 'secondsthismonth', + type: 'number', + required: false, + presentable: false, + unique: false, + options: { + min: null, + max: null, + noDecimal: false, + }, + }), + ) - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "ld24cbna", - "name": "email", - "type": "email", - "required": false, - "presentable": false, - "unique": false, - "options": { - "exceptDomains": null, - "onlyDomains": null - } - })) + // remove + collection.schema.removeField('mkmeisox') - // add - collection.schema.addField(new SchemaField({ - "system": false, - "id": "g3qvj4tl", - "name": "secondsthismonth", - "type": "number", - "required": false, - "presentable": false, - "unique": false, - "options": { - "min": null, - "max": null, - "noDecimal": false - } - })) + // remove + collection.schema.removeField('wqw6fejd') - // remove - collection.schema.removeField("mkmeisox") - - // remove - collection.schema.removeField("wqw6fejd") - - return dao.saveCollection(collection) -}) + return dao.saveCollection(collection) + }, +) diff --git a/packages/daemon/pb_hooks/lib.js b/packages/daemon/pb_hooks/lib.js index 13f2a596..adc6e63c 100644 --- a/packages/daemon/pb_hooks/lib.js +++ b/packages/daemon/pb_hooks/lib.js @@ -1,174 +1,195 @@ -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = function(target, all) { - for(var name in all)__defProp(target, name, { - get: all[name], - enumerable: true - }); -}; -var __copyProps = function(to, from, except, desc) { - if (from && typeof from === "object" || typeof from === "function") { - var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined; - try { - var _loop = function() { - var key = _step.value; - if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { - get: function() { - return from[key]; - }, - enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable - }); - }; - for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop(); - } catch (err) { - _didIteratorError = true; - _iteratorError = err; - } finally{ - try { - if (!_iteratorNormalCompletion && _iterator.return != null) { - _iterator.return(); - } - } finally{ - if (_didIteratorError) { - throw _iteratorError; - } - } +'use strict' +var __defProp = Object.defineProperty +var __getOwnPropDesc = Object.getOwnPropertyDescriptor +var __getOwnPropNames = Object.getOwnPropertyNames +var __hasOwnProp = Object.prototype.hasOwnProperty +var __export = function (target, all) { + for (var name in all) + __defProp(target, name, { + get: all[name], + enumerable: true, + }) +} +var __copyProps = function (to, from, except, desc) { + if ((from && typeof from === 'object') || typeof from === 'function') { + var _iteratorNormalCompletion = true, + _didIteratorError = false, + _iteratorError = undefined + try { + var _loop = function () { + var key = _step.value + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { + get: function () { + return from[key] + }, + enumerable: + !(desc = __getOwnPropDesc(from, key)) || desc.enumerable, + }) + } + for ( + var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; + !(_iteratorNormalCompletion = (_step = _iterator.next()).done); + _iteratorNormalCompletion = true + ) + _loop() + } catch (err) { + _didIteratorError = true + _iteratorError = err + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return != null) { + _iterator.return() } + } finally { + if (_didIteratorError) { + throw _iteratorError + } + } } - return to; -}; -var __toCommonJS = function(mod) { - return __copyProps(__defProp({}, "__esModule", { - value: true - }), mod); -}; + } + return to +} +var __toCommonJS = function (mod) { + return __copyProps( + __defProp({}, '__esModule', { + value: true, + }), + mod, + ) +} // src/hooks/src/lib.ts -var lib_exports = {}; +var lib_exports = {} __export(lib_exports, { - _getRecord: function() { - return _getRecord; - }, - _unsafe_assert: function() { - return assert; - }, - endOfMonth: function() { - return endOfMonth; - }, - forEach: function() { - return forEach; - }, - getInstance: function() { - return getInstance; - }, - getUser: function() { - return getUser; - }, - newModel: function() { - return newModel; - }, - queryOne: function() { - return queryOne; - }, - startOfMonth: function() { - return startOfMonth; - }, - updateInstance: function() { - return updateInstance; - }, - updateUser: function() { - return updateUser; - } -}); -module.exports = __toCommonJS(lib_exports); + _getRecord: function () { + return _getRecord + }, + _unsafe_assert: function () { + return assert + }, + endOfMonth: function () { + return endOfMonth + }, + forEach: function () { + return forEach + }, + getInstance: function () { + return getInstance + }, + getUser: function () { + return getUser + }, + newModel: function () { + return newModel + }, + queryOne: function () { + return queryOne + }, + startOfMonth: function () { + return startOfMonth + }, + updateInstance: function () { + return updateInstance + }, + updateUser: function () { + return updateUser + }, +}) +module.exports = __toCommonJS(lib_exports) // src/util/assert.ts function assert(v, msg) { - if (!v) { - throw new Error(msg || "Assertion failure"); - } + if (!v) { + throw new Error(msg || 'Assertion failure') + } } // ../../node_modules/@s-libs/micro-dash/fesm2015/micro-dash.mjs function forEach(collection, iteratee) { - if (Array.isArray(collection)) { - forEachOfArray(collection, iteratee); - } else { - forOwnOfNonArray(collection, iteratee); - } - return collection; + if (Array.isArray(collection)) { + forEachOfArray(collection, iteratee) + } else { + forOwnOfNonArray(collection, iteratee) + } + return collection } function forEachOfArray(array, iteratee) { - for(var i = 0, len = array.length; i < len; ++i){ - if (iteratee(array[i], i) === false) { - break; - } + for (var i = 0, len = array.length; i < len; ++i) { + if (iteratee(array[i], i) === false) { + break } + } } function keysOfNonArray(object) { - return object ? Object.getOwnPropertyNames(object) : []; + return object ? Object.getOwnPropertyNames(object) : [] } function forOwnOfNonArray(object, iteratee) { - forEachOfArray(keysOfNonArray(object), function(key) { - return iteratee(object[key], key); - }); - return object; + forEachOfArray(keysOfNonArray(object), function (key) { + return iteratee(object[key], key) + }) + return object } // src/hooks/src/lib.ts -var newModel = function(schema) { - return new DynamicModel(schema); -}; +var newModel = function (schema) { + return new DynamicModel(schema) +} function endOfMonth(now) { - return new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString(); + return new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString() } function startOfMonth(now) { - return new Date(now.getFullYear(), now.getMonth(), 1).toISOString(); + return new Date(now.getFullYear(), now.getMonth(), 1).toISOString() +} +var dao = function () { + var _dao = $app.dao() + assert(_dao) + return _dao +} +var queryOne = function (sql, bindings, defaultResult) { + var _dao_db_newQuery_bind, _dao_db_newQuery + var result = newModel(defaultResult) + ;(_dao_db_newQuery = dao().db().newQuery(sql)) === null || + _dao_db_newQuery === void 0 + ? void 0 + : (_dao_db_newQuery_bind = _dao_db_newQuery.bind(bindings)) === null || + _dao_db_newQuery_bind === void 0 + ? void 0 + : _dao_db_newQuery_bind.one(result) + return result +} +var _getRecord = function (name, id) { + var record = dao().findRecordById(name, id) + return record +} +var getInstance = function (instanceId) { + return _getRecord('instances', instanceId) +} +var getUser = function (userId) { + return _getRecord('users', userId) } -var dao = function() { - var _dao = $app.dao(); - assert(_dao); - return _dao; -}; -var queryOne = function(sql, bindings, defaultResult) { - var _dao_db_newQuery_bind, _dao_db_newQuery; - var result = newModel(defaultResult); - (_dao_db_newQuery = dao().db().newQuery(sql)) === null || _dao_db_newQuery === void 0 ? void 0 : (_dao_db_newQuery_bind = _dao_db_newQuery.bind(bindings)) === null || _dao_db_newQuery_bind === void 0 ? void 0 : _dao_db_newQuery_bind.one(result); - return result; -}; -var _getRecord = function(name, id) { - var record = dao().findRecordById(name, id); - return record; -}; -var getInstance = function(instanceId) { - return _getRecord("instances", instanceId); -}; -var getUser = function(userId) { - return _getRecord("users", userId); -}; function _updateRecord(record, fields) { - forEach(fields, function(v, k) { - record.set(k, v); - }); - dao().saveRecord(record); + forEach(fields, function (v, k) { + record.set(k, v) + }) + dao().saveRecord(record) } function _getRecordByIdOrRecord(recordOrInstanceId, name) { - var record = function() { - if (typeof recordOrInstanceId === "string") return _getRecord(name, recordOrInstanceId); - return recordOrInstanceId; - }(); - assert(record); - return record; + var record = (function () { + if (typeof recordOrInstanceId === 'string') + return _getRecord(name, recordOrInstanceId) + return recordOrInstanceId + })() + assert(record) + return record } function updateInstance(recordOrInstanceId, fields) { - var record = _getRecordByIdOrRecord(recordOrInstanceId, "instances"); - _updateRecord(record, fields); + var record = _getRecordByIdOrRecord(recordOrInstanceId, 'instances') + _updateRecord(record, fields) } function updateUser(recordOrUserId, fields) { - var record = _getRecordByIdOrRecord(recordOrUserId, "users"); - _updateRecord(record, fields); + var record = _getRecordByIdOrRecord(recordOrUserId, 'users') + _updateRecord(record, fields) } // Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { +0 && + (module.exports = { _getRecord: _getRecord, _unsafe_assert: _unsafe_assert, endOfMonth: endOfMonth, @@ -179,5 +200,5 @@ function updateUser(recordOrUserId, fields) { queryOne: queryOne, startOfMonth: startOfMonth, updateInstance: updateInstance, - updateUser: updateUser -}); + updateUser: updateUser, + }) diff --git a/packages/daemon/pb_hooks/update-usage.pb.js b/packages/daemon/pb_hooks/update-usage.pb.js index f8dd03ab..3b36de97 100644 --- a/packages/daemon/pb_hooks/update-usage.pb.js +++ b/packages/daemon/pb_hooks/update-usage.pb.js @@ -1,45 +1,60 @@ -"use strict"; +'use strict' // src/hooks/src/update-usage.pb.ts -console.log("update-usage"); -onRecordAfterUpdateRequest(function(e) { - var _require = require("".concat(__hooks, "/lib.js")), _unsafe_assert = _require._unsafe_assert, startOfMonth = _require.startOfMonth, endOfMonth = _require.endOfMonth, queryOne = _require.queryOne, updateInstance = _require.updateInstance, getInstance = _require.getInstance, updateUser = _require.updateUser; - var assert = _unsafe_assert; - var record = e.record; - assert(record, "Expected record here"); - var instanceId = record.getString("instanceId"); - var instance = getInstance(instanceId); - assert(instance); - var uid = instance.getString("uid"); - assert(uid); - var now = /* @__PURE__ */ new Date(); - var startIso = startOfMonth(now); - var endIso = endOfMonth(now); - { - var result = queryOne("SELECT cast(sum(totalSeconds) as int) as t FROM invocations WHERE instanceId={:instanceId} and startedAt>={:startIso} and startedAt<={:endIso}", { - instanceId: instanceId, - startIso: startIso, - endIso: endIso - }, { - t: 0 - }); - var secondsThisMonth = result.t; - console.log("Instance seconds, ".concat(secondsThisMonth)); - updateInstance(instance, { - secondsThisMonth: secondsThisMonth - }); - } - { - var result1 = queryOne("SELECT cast(sum(totalSeconds) as int) as t FROM invocations WHERE uid={:uid} and startedAt>={:startIso} and startedAt<={:endIso}", { - uid: uid, - startIso: startIso, - endIso: endIso - }, { - t: 0 - }); - var secondsThisMonth1 = result1.t; - console.log("User seconds, ".concat(secondsThisMonth1)); - updateUser(uid, { - secondsThisMonth: secondsThisMonth1 - }); - } -}, "invocations"); +console.log('update-usage') +onRecordAfterUpdateRequest(function (e) { + var _require = require(''.concat(__hooks, '/lib.js')), + _unsafe_assert = _require._unsafe_assert, + startOfMonth = _require.startOfMonth, + endOfMonth = _require.endOfMonth, + queryOne = _require.queryOne, + updateInstance = _require.updateInstance, + getInstance = _require.getInstance, + updateUser = _require.updateUser + var assert = _unsafe_assert + var record = e.record + assert(record, 'Expected record here') + var instanceId = record.getString('instanceId') + var instance = getInstance(instanceId) + assert(instance) + var uid = instance.getString('uid') + assert(uid) + var now = /* @__PURE__ */ new Date() + var startIso = startOfMonth(now) + var endIso = endOfMonth(now) + { + var result = queryOne( + 'SELECT cast(sum(totalSeconds) as int) as t FROM invocations WHERE instanceId={:instanceId} and startedAt>={:startIso} and startedAt<={:endIso}', + { + instanceId: instanceId, + startIso: startIso, + endIso: endIso, + }, + { + t: 0, + }, + ) + var secondsThisMonth = result.t + console.log('Instance seconds, '.concat(secondsThisMonth)) + updateInstance(instance, { + secondsThisMonth: secondsThisMonth, + }) + } + { + var result1 = queryOne( + 'SELECT cast(sum(totalSeconds) as int) as t FROM invocations WHERE uid={:uid} and startedAt>={:startIso} and startedAt<={:endIso}', + { + uid: uid, + startIso: startIso, + endIso: endIso, + }, + { + t: 0, + }, + ) + var secondsThisMonth1 = result1.t + console.log('User seconds, '.concat(secondsThisMonth1)) + updateUser(uid, { + secondsThisMonth: secondsThisMonth1, + }) + } +}, 'invocations') diff --git a/packages/dashboard/src/components/AlertBar.svelte b/packages/dashboard/src/components/AlertBar.svelte index 39bd32e8..30d37995 100644 --- a/packages/dashboard/src/components/AlertBar.svelte +++ b/packages/dashboard/src/components/AlertBar.svelte @@ -7,7 +7,10 @@ export let alertType: AlertTypes = AlertTypes.Warning - {:else} {#if title}
{title}
{/if} - {#if subtitle}
{subtitle}
{/if} + {#if subtitle}
+ {subtitle} +
{/if} {/if} diff --git a/packages/dashboard/src/components/FrequentlyAskedQuestions.svelte b/packages/dashboard/src/components/FrequentlyAskedQuestions.svelte index f910b091..b26057b0 100644 --- a/packages/dashboard/src/components/FrequentlyAskedQuestions.svelte +++ b/packages/dashboard/src/components/FrequentlyAskedQuestions.svelte @@ -13,7 +13,10 @@ } // Array of Questions, if the boolean is set to false, the answer is displayed - const questions: Question[] = faq.outline.map((q: rawQ) => ({ ...q, collapsed: true })) + const questions: Question[] = faq.outline.map((q: rawQ) => ({ + ...q, + collapsed: true, + }))
diff --git a/packages/dashboard/src/components/InitializeTooltips.svelte b/packages/dashboard/src/components/InitializeTooltips.svelte index b7575079..13a9ff29 100644 --- a/packages/dashboard/src/components/InitializeTooltips.svelte +++ b/packages/dashboard/src/components/InitializeTooltips.svelte @@ -6,9 +6,11 @@ // https://getbootstrap.com/docs/5.2/components/tooltips/#enable-tooltips afterNavigate(() => { if (browser) { - const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]') + const tooltipTriggerList = document.querySelectorAll( + '[data-bs-toggle="tooltip"]', + ) const tooltipList = [...tooltipTriggerList].map( - (tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl) + (tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl), ) } }) diff --git a/packages/dashboard/src/components/InstanceGeneratorWidget.svelte b/packages/dashboard/src/components/InstanceGeneratorWidget.svelte index c29e6d38..ea18dd0c 100644 --- a/packages/dashboard/src/components/InstanceGeneratorWidget.svelte +++ b/packages/dashboard/src/components/InstanceGeneratorWidget.svelte @@ -13,13 +13,14 @@ let formError: string = '' let isFormButtonDisabled: boolean = true - $: isFormButtonDisabled = email.length === 0 || password.length === 0 || instanceName.length === 0 + $: isFormButtonDisabled = + email.length === 0 || password.length === 0 || instanceName.length === 0 let isProcessing: boolean = false // Fun quotes when waiting for the instance to load. This could take up to 10 seconds let processingQuotesArray = [ - 'Did you know it takes fourteen sentient robots to create each instance on PocketHost?' + 'Did you know it takes fourteen sentient robots to create each instance on PocketHost?', ] let processingQuote = getRandomElementFromArray(processingQuotesArray) @@ -34,9 +35,14 @@ isFormButtonDisabled = true isProcessing = true - await handleInstanceGeneratorWidget(email, password, instanceName, (error) => { - formError = error - }) + await handleInstanceGeneratorWidget( + email, + password, + instanceName, + (error) => { + formError = error + }, + ) isFormButtonDisabled = false @@ -116,7 +122,11 @@
-
diff --git a/packages/dashboard/src/components/Navbar.svelte b/packages/dashboard/src/components/Navbar.svelte index 00fbcb63..8ee7e2ea 100644 --- a/packages/dashboard/src/components/Navbar.svelte +++ b/packages/dashboard/src/components/Navbar.svelte @@ -10,7 +10,11 @@