@appsemble/cli 0.20.45 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +145 -3
- package/commands/app/create.d.ts +2 -2
- package/commands/app/update.d.ts +2 -2
- package/commands/organization/create.d.ts +1 -1
- package/commands/organization/update.d.ts +1 -1
- package/commands/serve.d.ts +15 -0
- package/commands/serve.js +265 -0
- package/index.js +2 -0
- package/lib/app.d.ts +4 -4
- package/lib/app.js +14 -5
- package/lib/block.d.ts +2 -2
- package/lib/block.js +17 -3
- package/lib/block.test.js +6 -4
- package/lib/coercers.d.ts +2 -2
- package/lib/createServers.d.ts +19 -0
- package/lib/createServers.js +57 -0
- package/lib/getBlockConfigFromTypeScript.js +1 -0
- package/lib/getBlockConfigFromTypeScript.test.js +2 -2
- package/lib/organization.d.ts +1 -1
- package/package.json +23 -6
- package/server/controllers/action.d.ts +6 -0
- package/server/controllers/action.js +8 -0
- package/server/controllers/appMembers.d.ts +2 -0
- package/server/controllers/appMembers.js +4 -0
- package/server/controllers/appMessages.d.ts +2 -0
- package/server/controllers/appMessages.js +4 -0
- package/server/controllers/assets.d.ts +4 -0
- package/server/controllers/assets.js +6 -0
- package/server/controllers/index.d.ts +7 -0
- package/server/controllers/index.js +8 -0
- package/server/controllers/oauth2Provider.d.ts +2 -0
- package/server/controllers/oauth2Provider.js +4 -0
- package/server/controllers/resources.d.ts +7 -0
- package/server/controllers/resources.js +9 -0
- package/server/controllers/teams.d.ts +2 -0
- package/server/controllers/teams.js +4 -0
- package/server/db/index.d.ts +2 -0
- package/server/db/index.js +10 -0
- package/server/db/methods.d.ts +11 -0
- package/server/db/methods.js +232 -0
- package/server/db/methods.test.js +365 -0
- package/server/models/Resource.d.ts +14 -0
- package/server/models/Resource.js +23 -0
- package/server/models/Theme.d.ts +17 -0
- package/server/models/Theme.js +11 -0
- package/server/options/applyAppServiceSecrets.d.ts +3 -0
- package/server/options/applyAppServiceSecrets.js +2 -0
- package/server/options/checkRole.d.ts +1 -0
- package/server/options/checkRole.js +2 -0
- package/server/options/checkRole.test.d.ts +1 -0
- package/server/options/checkRole.test.js +12 -0
- package/server/options/createAppAsset.d.ts +2 -0
- package/server/options/createAppAsset.js +15 -0
- package/server/options/createAppResourcesWithAssets.d.ts +3 -0
- package/server/options/createAppResourcesWithAssets.js +18 -0
- package/server/options/createSettings.d.ts +2 -0
- package/server/options/createSettings.js +15 -0
- package/server/options/createTheme.d.ts +2 -0
- package/server/options/createTheme.js +5 -0
- package/server/options/deleteAppAsset.d.ts +2 -0
- package/server/options/deleteAppAsset.js +15 -0
- package/server/options/deleteAppResource.d.ts +2 -0
- package/server/options/deleteAppResource.js +5 -0
- package/server/options/email.d.ts +1 -0
- package/server/options/email.js +2 -0
- package/server/options/getApp.d.ts +3 -0
- package/server/options/getApp.js +5 -0
- package/server/options/getAppAssets.d.ts +2 -0
- package/server/options/getAppAssets.js +12 -0
- package/server/options/getAppBlockStyles.d.ts +2 -0
- package/server/options/getAppBlockStyles.js +26 -0
- package/server/options/getAppDetails.d.ts +2 -0
- package/server/options/getAppDetails.js +8 -0
- package/server/options/getAppIcon.d.ts +3 -0
- package/server/options/getAppIcon.js +6 -0
- package/server/options/getAppMembers.d.ts +3 -0
- package/server/options/getAppMembers.js +4 -0
- package/server/options/getAppMessages.d.ts +3 -0
- package/server/options/getAppMessages.js +4 -0
- package/server/options/getAppResource.d.ts +3 -0
- package/server/options/getAppResource.js +5 -0
- package/server/options/getAppResources.d.ts +3 -0
- package/server/options/getAppResources.js +5 -0
- package/server/options/getAppScreenshots.d.ts +2 -0
- package/server/options/getAppScreenshots.js +20 -0
- package/server/options/getAppStyles.d.ts +2 -0
- package/server/options/getAppStyles.js +7 -0
- package/server/options/getAppTeams.d.ts +2 -0
- package/server/options/getAppTeams.js +4 -0
- package/server/options/getAppUrl.d.ts +2 -0
- package/server/options/getAppUrl.js +5 -0
- package/server/options/getAppUserInfo.d.ts +3 -0
- package/server/options/getAppUserInfo.js +4 -0
- package/server/options/getBlockAsset.d.ts +2 -0
- package/server/options/getBlockAsset.js +28 -0
- package/server/options/getBlockAssetsPaths.d.ts +2 -0
- package/server/options/getBlockAssetsPaths.js +8 -0
- package/server/options/getBlockMessages.d.ts +2 -0
- package/server/options/getBlockMessages.js +4 -0
- package/server/options/getCsp.d.ts +2 -0
- package/server/options/getCsp.js +13 -0
- package/server/options/getDbUpdated.d.ts +1 -0
- package/server/options/getDbUpdated.js +2 -0
- package/server/options/getHost.d.ts +2 -0
- package/server/options/getHost.js +5 -0
- package/server/options/getTheme.d.ts +2 -0
- package/server/options/getTheme.js +8 -0
- package/server/options/index.d.ts +35 -0
- package/server/options/index.js +36 -0
- package/server/options/options.d.ts +2 -0
- package/server/options/options.js +39 -0
- package/server/options/parseQuery.d.ts +2 -0
- package/server/options/parseQuery.js +82 -0
- package/server/options/parseQuery.test.d.ts +1 -0
- package/server/options/parseQuery.test.js +43 -0
- package/server/options/reloadUser.d.ts +1 -0
- package/server/options/reloadUser.js +2 -0
- package/server/options/sendNotifications.d.ts +1 -0
- package/server/options/sendNotifications.js +2 -0
- package/server/options/updateAppResource.d.ts +3 -0
- package/server/options/updateAppResource.js +5 -0
- package/server/options/verifyResourceActionPermission.d.ts +1 -0
- package/server/options/verifyResourceActionPermission.js +2 -0
- package/server/routes/appRouter/index.d.ts +2 -0
- package/server/routes/appRouter/index.js +4 -0
- package/vitest.config.d.ts +2 -0
- package/vitest.setup.d.ts +1 -0
- package/{jest.setup.js → vitest.setup.js} +1 -1
- /package/{jest.setup.d.ts → server/db/methods.test.d.ts} +0 -0
package/lib/block.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createReadStream, existsSync } from 'node:fs';
|
|
2
2
|
import { mkdir, readdir, readFile, rm } from 'node:fs/promises';
|
|
3
|
-
import { basename, join, relative, resolve as resolvePath } from 'node:path';
|
|
3
|
+
import { basename, extname, join, relative, resolve as resolvePath } from 'node:path';
|
|
4
4
|
import { inspect } from 'node:util';
|
|
5
5
|
import { AppsembleError, getWorkspaces, logger, opendirSafe, readData, writeData, } from '@appsemble/node-utils';
|
|
6
6
|
import { compareStrings } from '@appsemble/utils';
|
|
@@ -102,6 +102,7 @@ export async function makePayload(config) {
|
|
|
102
102
|
const { dir, output } = config;
|
|
103
103
|
const distPath = resolvePath(dir, output);
|
|
104
104
|
const form = new FormData();
|
|
105
|
+
const gatheredData = {};
|
|
105
106
|
const { description, layout, longDescription, name, version, visibility } = config;
|
|
106
107
|
const { actions, events, messages, parameters } = getBlockConfigFromTypeScript(config);
|
|
107
108
|
const files = await readdir(dir);
|
|
@@ -117,20 +118,30 @@ export async function makePayload(config) {
|
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
120
|
append('actions', actions);
|
|
121
|
+
gatheredData.actions = actions;
|
|
120
122
|
append('description', description);
|
|
123
|
+
gatheredData.description = description;
|
|
121
124
|
append('longDescription', longDescription);
|
|
125
|
+
gatheredData.longDescription = longDescription;
|
|
122
126
|
append('events', events);
|
|
127
|
+
gatheredData.events = events;
|
|
123
128
|
append('layout', layout);
|
|
129
|
+
gatheredData.layout = layout;
|
|
124
130
|
if (visibility) {
|
|
125
131
|
append('visibility', visibility);
|
|
132
|
+
gatheredData.visibility = visibility;
|
|
126
133
|
}
|
|
127
134
|
append('name', name);
|
|
135
|
+
gatheredData.name = name;
|
|
128
136
|
append('parameters', parameters);
|
|
137
|
+
gatheredData.parameters = parameters;
|
|
129
138
|
append('version', version);
|
|
139
|
+
gatheredData.version = version;
|
|
130
140
|
if (icon) {
|
|
131
141
|
const iconPath = join(dir, icon);
|
|
132
142
|
logger.info(`Using icon: ${iconPath}`);
|
|
133
143
|
form.append('icon', createReadStream(iconPath));
|
|
144
|
+
gatheredData.iconUrl = basename(iconPath, extname(iconPath));
|
|
134
145
|
}
|
|
135
146
|
if (messages) {
|
|
136
147
|
if (!files.includes('i18n')) {
|
|
@@ -160,6 +171,7 @@ export async function makePayload(config) {
|
|
|
160
171
|
messagesResult[language] = m;
|
|
161
172
|
}
|
|
162
173
|
form.append('messages', JSON.stringify(messagesResult));
|
|
174
|
+
gatheredData.messages = messagesResult;
|
|
163
175
|
}
|
|
164
176
|
if (files.includes('examples')) {
|
|
165
177
|
await opendirSafe(join(dir, 'examples'), async (file, stat) => {
|
|
@@ -168,6 +180,7 @@ export async function makePayload(config) {
|
|
|
168
180
|
}
|
|
169
181
|
logger.info(`Adding example file ${file}`);
|
|
170
182
|
form.append('examples', await readFile(file, 'utf8'));
|
|
183
|
+
gatheredData.examples = [...(gatheredData.examples || []), basename(file, extname(file))];
|
|
171
184
|
}, { allowMissing: true });
|
|
172
185
|
}
|
|
173
186
|
await opendirSafe(distPath, (fullpath, stat) => {
|
|
@@ -180,8 +193,9 @@ export async function makePayload(config) {
|
|
|
180
193
|
form.append('files', createReadStream(fullpath), {
|
|
181
194
|
filename: encodeURIComponent(relativePath),
|
|
182
195
|
});
|
|
196
|
+
gatheredData.files = [...(gatheredData.files || []), relativePath];
|
|
183
197
|
}, { recursive: true });
|
|
184
|
-
return form;
|
|
198
|
+
return [form, gatheredData];
|
|
185
199
|
}
|
|
186
200
|
/**
|
|
187
201
|
* Publish a new block version.
|
|
@@ -191,7 +205,7 @@ export async function makePayload(config) {
|
|
|
191
205
|
*/
|
|
192
206
|
export async function publishBlock(config, ignoreConflict) {
|
|
193
207
|
logger.info(`Publishing ${config.name}@${config.version}…`);
|
|
194
|
-
const form = await makePayload(config);
|
|
208
|
+
const [form] = await makePayload(config);
|
|
195
209
|
try {
|
|
196
210
|
await axios.post('/api/blocks', form);
|
|
197
211
|
logger.info(`Successfully published ${config.name}@${config.version} 🎉`);
|
package/lib/block.test.js
CHANGED
|
@@ -13,9 +13,10 @@ describe('makePayload', () => {
|
|
|
13
13
|
actions: { onClick: {} },
|
|
14
14
|
events: { listen: { test: {} } },
|
|
15
15
|
});
|
|
16
|
-
const
|
|
16
|
+
const [formData] = payload;
|
|
17
|
+
const boundary = formData.getBoundary();
|
|
17
18
|
const buffer = await new Promise((resolve) => {
|
|
18
|
-
|
|
19
|
+
formData.pipe(concat(resolve));
|
|
19
20
|
});
|
|
20
21
|
expect(String(buffer)).toBe(`--${boundary}\r
|
|
21
22
|
Content-Disposition: form-data; name="actions"\r
|
|
@@ -57,9 +58,10 @@ export const string = 'no-icon';
|
|
|
57
58
|
actions: {},
|
|
58
59
|
events: {},
|
|
59
60
|
});
|
|
60
|
-
const
|
|
61
|
+
const [formData] = payload;
|
|
62
|
+
const boundary = formData.getBoundary();
|
|
61
63
|
const buffer = await new Promise((resolve) => {
|
|
62
|
-
|
|
64
|
+
formData.pipe(concat(resolve));
|
|
63
65
|
});
|
|
64
66
|
expect(String(buffer)).toBe(`--${boundary}\r
|
|
65
67
|
Content-Disposition: form-data; name="actions"\r
|
package/lib/coercers.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Koa from 'koa';
|
|
2
|
+
import { type Configuration } from 'webpack';
|
|
3
|
+
interface CreateServerOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Server arguments
|
|
6
|
+
*/
|
|
7
|
+
argv: Record<string, any>;
|
|
8
|
+
/**
|
|
9
|
+
* Additional context to append to the server.
|
|
10
|
+
*/
|
|
11
|
+
context?: Record<string, any>;
|
|
12
|
+
/**
|
|
13
|
+
* Webpack configurations to serve using Webpack dev server middleware.
|
|
14
|
+
*/
|
|
15
|
+
webpackConfigs?: Configuration[];
|
|
16
|
+
}
|
|
17
|
+
export declare function createStaticServer({ argv, context, webpackConfigs, }: CreateServerOptions): Promise<Koa>;
|
|
18
|
+
export declare function createApiServer({ argv, context }: CreateServerOptions): Koa;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { bodyParser, boomMiddleware, conditional, frontend, loggerMiddleware, parameters, serializer, } from '@appsemble/node-utils';
|
|
2
|
+
import { api } from '@appsemble/utils';
|
|
3
|
+
import { notFound } from '@hapi/boom';
|
|
4
|
+
import cors from '@koa/cors';
|
|
5
|
+
import Koa from 'koa';
|
|
6
|
+
import compose from 'koa-compose';
|
|
7
|
+
import compress from 'koa-compress';
|
|
8
|
+
import range from 'koa-range';
|
|
9
|
+
import { koas } from 'koas-core';
|
|
10
|
+
import { operations } from 'koas-operations';
|
|
11
|
+
import { statusCode } from 'koas-status-code';
|
|
12
|
+
import pkg from '../package.json' assert { type: 'json' };
|
|
13
|
+
import * as controllers from '../server/controllers/index.js';
|
|
14
|
+
import { appRouter } from '../server/routes/appRouter/index.js';
|
|
15
|
+
export async function createStaticServer({ argv, context, webpackConfigs, }) {
|
|
16
|
+
const app = new Koa();
|
|
17
|
+
app.use(loggerMiddleware());
|
|
18
|
+
app.use(boomMiddleware());
|
|
19
|
+
app.use(range);
|
|
20
|
+
Object.assign(app.context, context);
|
|
21
|
+
if (process.env.NODE_ENV === 'production') {
|
|
22
|
+
app.use(compress());
|
|
23
|
+
}
|
|
24
|
+
if (!['test', 'production'].includes(process.env.NODE_ENV)) {
|
|
25
|
+
app.use(await frontend(webpackConfigs, argv));
|
|
26
|
+
}
|
|
27
|
+
app.use(appRouter);
|
|
28
|
+
return app;
|
|
29
|
+
}
|
|
30
|
+
export function createApiServer({ argv, context }) {
|
|
31
|
+
const app = new Koa();
|
|
32
|
+
app.use(loggerMiddleware());
|
|
33
|
+
app.use(boomMiddleware());
|
|
34
|
+
app.use(range);
|
|
35
|
+
Object.assign(app.context, context);
|
|
36
|
+
if (process.env.NODE_ENV === 'production') {
|
|
37
|
+
app.use(compress());
|
|
38
|
+
}
|
|
39
|
+
app.use(compose([
|
|
40
|
+
conditional((ctx) => ctx.path.startsWith('/api') || ctx.path === '/oauth2/token', cors()),
|
|
41
|
+
koas(api(pkg.version, argv), [
|
|
42
|
+
parameters(),
|
|
43
|
+
bodyParser(),
|
|
44
|
+
serializer(),
|
|
45
|
+
statusCode(),
|
|
46
|
+
operations({ controllers, throwOnNotImplemented: false }),
|
|
47
|
+
]),
|
|
48
|
+
({ path }, next) => {
|
|
49
|
+
if (path.startsWith('/api/')) {
|
|
50
|
+
throw notFound('URL not found');
|
|
51
|
+
}
|
|
52
|
+
return next();
|
|
53
|
+
},
|
|
54
|
+
]));
|
|
55
|
+
return app;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=createServers.js.map
|
|
@@ -49,6 +49,7 @@ function processInterface(iface, checker, convert) {
|
|
|
49
49
|
const comments = (_a = commentRanges === null || commentRanges === void 0 ? void 0 : commentRanges.map((r) => source.slice(r.pos, r.end))) !== null && _a !== void 0 ? _a : [];
|
|
50
50
|
const [block] = parse(comments[0]);
|
|
51
51
|
const processedDescription = block.source
|
|
52
|
+
// @ts-expect-error https://github.com/syavorsky/comment-parser/pull/163
|
|
52
53
|
.map((src) => src.tokens.description)
|
|
53
54
|
.join('\n')
|
|
54
55
|
.replace(/^\s+|\s+$/g, '');
|
|
@@ -5,7 +5,7 @@ import { AppsembleError, resolveFixture } from '@appsemble/node-utils';
|
|
|
5
5
|
import { ts } from 'ts-json-schema-generator';
|
|
6
6
|
import { getBlockConfigFromTypeScript } from './getBlockConfigFromTypeScript.js';
|
|
7
7
|
beforeEach(() => {
|
|
8
|
-
|
|
8
|
+
vi.spyOn(process, 'cwd').mockReturnValue(resolveFixture('.'));
|
|
9
9
|
});
|
|
10
10
|
describe('getBlockConfigFromTypeScript', () => {
|
|
11
11
|
it('should extract configuration from a TypeScript project', () => {
|
|
@@ -50,7 +50,7 @@ describe('getBlockConfigFromTypeScript', () => {
|
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
it('should not use TypeScript if all metadata is present in the original config', () => {
|
|
53
|
-
|
|
53
|
+
vi.spyOn(ts, 'createProgram');
|
|
54
54
|
const input = {
|
|
55
55
|
actions: {},
|
|
56
56
|
events: { emit: { foo: {} }, listen: { bar: {} } },
|
package/lib/organization.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "The CLI for developing with Appsemble apps and blocks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -31,22 +31,37 @@
|
|
|
31
31
|
],
|
|
32
32
|
"scripts": {
|
|
33
33
|
"prepack": "tsc --noEmit false",
|
|
34
|
-
"test": "
|
|
34
|
+
"test": "vitest"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@appsemble/node-utils": "0.
|
|
38
|
-
"@appsemble/types": "0.
|
|
39
|
-
"@appsemble/utils": "0.
|
|
37
|
+
"@appsemble/node-utils": "0.21.0",
|
|
38
|
+
"@appsemble/types": "0.21.0",
|
|
39
|
+
"@appsemble/utils": "0.21.0",
|
|
40
40
|
"@fortawesome/fontawesome-common-types": "^6.0.0",
|
|
41
|
+
"@hapi/boom": "^10.0.0",
|
|
42
|
+
"@koa/cors": "^4.0.0",
|
|
43
|
+
"@odata/parser": "^0.2.0",
|
|
41
44
|
"axios": "^1.0.0",
|
|
42
45
|
"chalk": "^4.0.0",
|
|
43
46
|
"comment-parser": "^1.0.0",
|
|
44
47
|
"cosmiconfig": "^7.0.0",
|
|
48
|
+
"csvtojson": "^2.0.0",
|
|
45
49
|
"fast-glob": "^3.0.0",
|
|
46
50
|
"form-data": "^4.0.0",
|
|
51
|
+
"global-cache-dir": "^5.0.0",
|
|
47
52
|
"inquirer": "^9.0.0",
|
|
48
53
|
"jsonschema": "^1.0.0",
|
|
49
54
|
"koa": "^2.0.0",
|
|
55
|
+
"koa-compose": "^4.0.0",
|
|
56
|
+
"koa-compress": "^5.0.0",
|
|
57
|
+
"koa-range": "^0.3.0",
|
|
58
|
+
"koas-core": "^0.7.0",
|
|
59
|
+
"koas-operations": "^0.7.0",
|
|
60
|
+
"koas-status-code": "^0.7.0",
|
|
61
|
+
"language-tags": "^1.0.0",
|
|
62
|
+
"lodash-es": "^4.0.0",
|
|
63
|
+
"mime-types": "^2.0.0",
|
|
64
|
+
"node-json-db": "^2.0.0",
|
|
50
65
|
"normalize-path": "^3.0.0",
|
|
51
66
|
"open": "^9.0.0",
|
|
52
67
|
"postcss": "^8.0.0",
|
|
@@ -55,6 +70,7 @@
|
|
|
55
70
|
"postcss-url": "^10.0.0",
|
|
56
71
|
"raw-body": "^2.0.0",
|
|
57
72
|
"read-pkg-up": "^9.0.0",
|
|
73
|
+
"sharp": "^0.32.0",
|
|
58
74
|
"ts-json-schema-generator": "^1.0.0",
|
|
59
75
|
"type-fest": "^3.0.0",
|
|
60
76
|
"webpack": "^5.0.0",
|
|
@@ -62,7 +78,7 @@
|
|
|
62
78
|
"yargs": "^17.0.0"
|
|
63
79
|
},
|
|
64
80
|
"devDependencies": {
|
|
65
|
-
"@appsemble/types": "0.
|
|
81
|
+
"@appsemble/types": "0.21.0",
|
|
66
82
|
"@types/concat-stream": "^2.0.0",
|
|
67
83
|
"@types/inquirer": "^9.0.0",
|
|
68
84
|
"@types/normalize-path": "^3.0.0",
|
|
@@ -70,6 +86,7 @@
|
|
|
70
86
|
"@types/postcss-url": "^10.0.0",
|
|
71
87
|
"concat-stream": "^2.0.0"
|
|
72
88
|
},
|
|
89
|
+
"peerDependencies": {},
|
|
73
90
|
"optionalDependencies": {
|
|
74
91
|
"keytar": "^7.0.0"
|
|
75
92
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createProxyDelete, createProxyGet, createProxyPatch, createProxyPost, createProxyPut, } from '@appsemble/node-utils';
|
|
2
|
+
import { options } from '../options/options.js';
|
|
3
|
+
export const proxyDelete = createProxyDelete(options);
|
|
4
|
+
export const proxyGet = createProxyGet(options);
|
|
5
|
+
export const proxyPatch = createProxyPatch(options);
|
|
6
|
+
export const proxyPost = createProxyPost(options);
|
|
7
|
+
export const proxyPut = createProxyPut(options);
|
|
8
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createCreateAsset, createGetAssetById, createGetAssets } from '@appsemble/node-utils';
|
|
2
|
+
import { options } from '../options/options.js';
|
|
3
|
+
export const getAssets = createGetAssets(options);
|
|
4
|
+
export const getAssetById = createGetAssetById(options);
|
|
5
|
+
export const createAsset = createCreateAsset(options);
|
|
6
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './action.js';
|
|
2
|
+
export * from './appMessages.js';
|
|
3
|
+
export * from './resources.js';
|
|
4
|
+
export * from './assets.js';
|
|
5
|
+
export * from './appMembers.js';
|
|
6
|
+
export * from './teams.js';
|
|
7
|
+
export * from './oauth2Provider.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Middleware } from 'koa';
|
|
2
|
+
export declare const createResource: Middleware;
|
|
3
|
+
export declare const countResources: Middleware;
|
|
4
|
+
export declare const getResourceById: Middleware;
|
|
5
|
+
export declare const queryResources: Middleware;
|
|
6
|
+
export declare const updateResource: Middleware;
|
|
7
|
+
export declare const deleteResource: Middleware;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createCountResources, createCreateResource, createDeleteResource, createGetResourceById, createQueryResources, createUpdateResource, } from '@appsemble/node-utils';
|
|
2
|
+
import { options } from '../options/options.js';
|
|
3
|
+
export const createResource = createCreateResource(options);
|
|
4
|
+
export const countResources = createCountResources(options);
|
|
5
|
+
export const getResourceById = createGetResourceById(options);
|
|
6
|
+
export const queryResources = createQueryResources(options);
|
|
7
|
+
export const updateResource = createUpdateResource(options);
|
|
8
|
+
export const deleteResource = createDeleteResource(options);
|
|
9
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import globalCacheDir from 'global-cache-dir';
|
|
3
|
+
import { Config, JsonDB } from 'node-json-db';
|
|
4
|
+
export async function getDb(appName) {
|
|
5
|
+
const cacheDir = await globalCacheDir('appsemble');
|
|
6
|
+
const dir = join(cacheDir, appName, 'db.json');
|
|
7
|
+
const config = new Config(dir, true, true, '/');
|
|
8
|
+
return new JsonDB(config);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FindOptions } from '@appsemble/node-utils';
|
|
2
|
+
export declare function setAppName(name: string): void;
|
|
3
|
+
export declare const Methods: {
|
|
4
|
+
create<M>(values: Record<string, unknown>, modelDir?: string): Promise<M>;
|
|
5
|
+
bulkCreate<M_1>(values: Record<string, unknown>[], modelDir?: string, override?: boolean): Promise<[] | M_1[]>;
|
|
6
|
+
findById<M_2>(id: number | string, modelDir?: string): Promise<M_2>;
|
|
7
|
+
findOne<M_3>(query: FindOptions, modelDir?: string): Promise<M_3>;
|
|
8
|
+
findAll<M_4>(query?: FindOptions, modelDir?: string): Promise<[] | M_4[]>;
|
|
9
|
+
updateOne<M_5>(id: number | string, values: Record<string, unknown>, modelDir?: string): Promise<M_5>;
|
|
10
|
+
deleteOne(id: number | string, modelDir?: string): Promise<void>;
|
|
11
|
+
};
|