@servable/tools 2.0.1 → 2.1.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/global.d.ts +13 -0
- package/package.json +17 -15
- package/src/domain/protocolInstance/factory/index.js +8 -4
- package/src/domain/protocolInstance/index.js +15 -2
- package/src/domain/protocolLoader/base.js +19 -0
- package/src/domain/protocolLoader/v1.0.0.js +6 -3
- package/src/domain/protocolLoader/v1.1.0.js +7 -4
- package/src/domain/servable/parse/utils/index.js +21 -6
- package/src/index.js +8 -0
- package/src/lib/defineConfig.js +94 -0
- package/src/lib/directoryFilesRecursive.js +9 -1
- package/src/lib/directoryGlob.js +15 -1
- package/src/lib/ensureDirectoryExists.js +18 -5
- package/src/lib/getModuleDir.js +8 -3
- package/src/manifest/access/index.js +21 -0
- package/src/manifest/extract/extractItem.js +1 -1
- package/src/manifest/extract/route/extractFiles.js +8 -4
- package/src/manifest/extract/route/imageToBase64.js +12 -0
- package/src/schema/build/buildProtocol/classStruct/preserveMostRestricted.js +16 -2
- package/src/schema/build/index.js +4 -1
- package/src/schema/protocolResources/generateTypes.js +106 -0
- package/src/schema/protocolResources/index.js +103 -0
- package/src/schema/types/index.js +97 -0
- package/src/schema/validate/index.js +0 -1
- package/types/config/candidates/index.d.ts +2 -0
- package/types/config/candidates/protocolCandidates/index.d.ts +9 -0
- package/types/config/index.d.ts +2 -0
- package/types/config/validate/index.d.ts +4 -0
- package/types/config/validate/protocol/index.d.ts +5 -0
- package/types/document/gateway/all/index.d.ts +2 -0
- package/types/document/gateway/generateGithubReadme/index.d.ts +2 -0
- package/types/domain/lib/checkFileExists.d.ts +2 -0
- package/types/domain/protocol/factory/absoluteModuleSrcPath.d.ts +2 -0
- package/types/domain/protocol/factory/index.d.ts +7 -0
- package/types/domain/protocol/factory/protocolPath.d.ts +2 -0
- package/types/domain/protocol/index.d.ts +34 -0
- package/types/domain/protocol/lib/instancesPathIdUniqueId.d.ts +5 -0
- package/types/domain/protocolInstance/factory/getLoaderWithPayload.d.ts +4 -0
- package/types/domain/protocolInstance/factory/index.d.ts +6 -0
- package/types/domain/protocolInstance/factory/instancesWithPath.d.ts +6 -0
- package/types/domain/protocolInstance/index.d.ts +71 -0
- package/types/domain/protocolLoader/base.d.ts +52 -0
- package/types/domain/protocolLoader/factory/getModule.d.ts +6 -0
- package/types/domain/protocolLoader/factory/index.d.ts +4 -0
- package/types/domain/protocolLoader/lib/importJSDefault.d.ts +6 -0
- package/types/domain/protocolLoader/lib/importJSONDefault.d.ts +6 -0
- package/types/domain/protocolLoader/lib/mergeClassProtocols.d.ts +6 -0
- package/types/domain/protocolLoader/lib/triggerItems.d.ts +2 -0
- package/types/domain/protocolLoader/v1.0.0.d.ts +68 -0
- package/types/domain/protocolLoader/v1.1.0.d.ts +70 -0
- package/types/domain/servable/index.d.ts +8 -0
- package/types/domain/servable/parse/index.d.ts +5 -0
- package/types/domain/servable/parse/utils/index.d.ts +41 -0
- package/types/index.d.ts +22 -0
- package/types/lib/adaptConfig/basic.d.ts +4 -0
- package/types/lib/adaptProtocolPayload.d.ts +2 -0
- package/types/lib/checkFileExists.d.ts +2 -0
- package/types/lib/cleanProtocols.d.ts +2 -0
- package/types/lib/defineConfig.d.ts +175 -0
- package/types/lib/directories.d.ts +9 -0
- package/types/lib/directoryFilesRecursive.d.ts +7 -0
- package/types/lib/directoryGlob.d.ts +5 -0
- package/types/lib/ensureDirectoryExists.d.ts +15 -0
- package/types/lib/foldersInFolder.d.ts +9 -0
- package/types/lib/getModuleDir.d.ts +2 -0
- package/types/lib/importFileAsText.d.ts +2 -0
- package/types/lib/importJSONAsync.d.ts +2 -0
- package/types/lib/protocolApiVersion.d.ts +4 -0
- package/types/lib/sanitize.d.ts +2 -0
- package/types/lib/stableStringify.d.ts +2 -0
- package/types/manifest/access/accessChildInTreeWithRoute.d.ts +5 -0
- package/types/manifest/access/index.d.ts +10 -0
- package/types/manifest/data/1.0.0/enums.d.ts +382 -0
- package/types/manifest/data/1.1.0/enums.d.ts +401 -0
- package/types/manifest/extract/extractAst.d.ts +2 -0
- package/types/manifest/extract/extractItem.d.ts +2 -0
- package/types/manifest/extract/formatFile.d.ts +4 -0
- package/types/manifest/extract/index.d.ts +8 -0
- package/types/manifest/extract/route/extractFileWithVariants.d.ts +2 -0
- package/types/manifest/extract/route/extractFiles.d.ts +2 -0
- package/types/manifest/extract/route/imageToBase64.d.ts +13 -0
- package/types/manifest/extract/route/index.d.ts +2 -0
- package/types/manifest/extract/templateDataForId.d.ts +5 -0
- package/types/schema/artifact/index.d.ts +21 -0
- package/types/schema/build/buildProtocol/classStruct/extractProtocolsProtocols.d.ts +6 -0
- package/types/schema/build/buildProtocol/classStruct/index.d.ts +15 -0
- package/types/schema/build/buildProtocol/classStruct/preserveMostRestricted.d.ts +4 -0
- package/types/schema/build/buildProtocol/classStruct/protocolInClassClassSchema.d.ts +2 -0
- package/types/schema/build/buildProtocol/extractClassesProtocol.d.ts +8 -0
- package/types/schema/build/buildProtocol/index.d.ts +7 -0
- package/types/schema/build/buildProtocol/index.for.d.ts +7 -0
- package/types/schema/build/buildProtocol/index.promiseall.d.ts +7 -0
- package/types/schema/build/index.d.ts +9 -0
- package/types/schema/build/lib/getProtocolsLiveClasses.d.ts +4 -0
- package/types/schema/build/lib/updateProtocolsExcerpt.d.ts +5 -0
- package/types/schema/plan/classifyField.d.ts +23 -0
- package/types/schema/plan/index.d.ts +11 -0
- package/types/schema/protocolResources/generateTypes.d.ts +11 -0
- package/types/schema/protocolResources/index.d.ts +42 -0
- package/types/schema/types/index.d.ts +18 -0
- package/types/schema/validate/handleProtocol/computeVersions.d.ts +16 -0
- package/types/schema/validate/handleProtocol/index.d.ts +18 -0
- package/types/schema/validate/index.d.ts +26 -0
- package/src/schema/index.js +0 -56
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export default class ProtocolLoaderV1_0_0 extends BaseClass {
|
|
2
|
+
getClass({ className }: {
|
|
3
|
+
className: any;
|
|
4
|
+
}): Promise<any>;
|
|
5
|
+
classFunctions({ className }: {
|
|
6
|
+
className: any;
|
|
7
|
+
}): Promise<any>;
|
|
8
|
+
classTriggers({ className }: {
|
|
9
|
+
className: any;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
classTriggersMerged({ className }: {
|
|
12
|
+
className: any;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
classJobs({ className }: {
|
|
15
|
+
className: any;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
classSeedFolder({ className }: {
|
|
18
|
+
className: any;
|
|
19
|
+
}): string;
|
|
20
|
+
classSeedMode(props: any): Promise<any>;
|
|
21
|
+
classSeedManual(props: any): Promise<any>;
|
|
22
|
+
classSeedMetadata(props: any): Promise<any>;
|
|
23
|
+
classSeedAutoFiles(props: any): Promise<any>;
|
|
24
|
+
classConfigFolder({ className }: {
|
|
25
|
+
className: any;
|
|
26
|
+
}): string;
|
|
27
|
+
classConfigDataFiles({ className }: {
|
|
28
|
+
className: any;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
classProtocols({ className, withProtocolsProtocols }: {
|
|
31
|
+
className: any;
|
|
32
|
+
withProtocolsProtocols?: boolean;
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
afterInit(): Promise<any>;
|
|
35
|
+
beforeInit(): Promise<any>;
|
|
36
|
+
beforeEnd(): Promise<any>;
|
|
37
|
+
configFolder(): string;
|
|
38
|
+
configDataFiles(): Promise<any>;
|
|
39
|
+
seedFolder(): string;
|
|
40
|
+
seedMode(): Promise<any>;
|
|
41
|
+
seedManual(): Promise<any>;
|
|
42
|
+
seedMetadata(): Promise<any>;
|
|
43
|
+
triggers(): Promise<any>;
|
|
44
|
+
triggersMerged(): Promise<any>;
|
|
45
|
+
triggersMetadata(): Promise<any>;
|
|
46
|
+
classesSchemas(props: any): Promise<any>;
|
|
47
|
+
schemaFields(props: any): Promise<any>;
|
|
48
|
+
schemaIndexes(props: any): Promise<any>;
|
|
49
|
+
schemaRaw(props?: {}): Promise<any>;
|
|
50
|
+
schemaClassLevelPermissions(props: any): Promise<any>;
|
|
51
|
+
ownProtocols(): Promise<any>;
|
|
52
|
+
ownProtocolsClass(): Promise<any>;
|
|
53
|
+
liveClasses(): Promise<any>;
|
|
54
|
+
systemDockerCompose(): Promise<any>;
|
|
55
|
+
systemDockerComposeExists(): Promise<boolean>;
|
|
56
|
+
systemDockerComposePath(): string;
|
|
57
|
+
systemDockerDataPath(): string;
|
|
58
|
+
systemDockerComposeDirPath(): string;
|
|
59
|
+
configDirPath_obs(): string;
|
|
60
|
+
configData_obs(): Promise<any>;
|
|
61
|
+
systemDockerPayloadAdapter(): Promise<any>;
|
|
62
|
+
functions(): Promise<any>;
|
|
63
|
+
services(): Promise<any>;
|
|
64
|
+
routes(): Promise<{}>;
|
|
65
|
+
liveQueries(): Promise<any[]>;
|
|
66
|
+
jobFiles(): Promise<any>;
|
|
67
|
+
}
|
|
68
|
+
import BaseClass from './base.js';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export default class ProtocolLoaderV1_1_0 extends BaseClass {
|
|
2
|
+
getClass({ className }: {
|
|
3
|
+
className: any;
|
|
4
|
+
}): Promise<any>;
|
|
5
|
+
classFunctions({ className }: {
|
|
6
|
+
className: any;
|
|
7
|
+
}): Promise<any>;
|
|
8
|
+
classTriggers({ className }: {
|
|
9
|
+
className: any;
|
|
10
|
+
}): Promise<any>;
|
|
11
|
+
classTriggersMerged({ className }: {
|
|
12
|
+
className: any;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
classJobs({ className }: {
|
|
15
|
+
className: any;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
classSeedFolder({ className }: {
|
|
18
|
+
className: any;
|
|
19
|
+
}): string;
|
|
20
|
+
classSeedMode(props: any): Promise<any>;
|
|
21
|
+
classSeedManual(props: any): Promise<any>;
|
|
22
|
+
classSeedMetadata(props: any): Promise<any>;
|
|
23
|
+
classSeedAutoFiles(props: any): Promise<any>;
|
|
24
|
+
classConfigFolder({ className }: {
|
|
25
|
+
className: any;
|
|
26
|
+
}): string;
|
|
27
|
+
classConfigDataFiles({ className }: {
|
|
28
|
+
className: any;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
classProtocols({ className, withProtocolsProtocols }: {
|
|
31
|
+
className: any;
|
|
32
|
+
withProtocolsProtocols?: boolean;
|
|
33
|
+
}): Promise<any>;
|
|
34
|
+
afterInit(): Promise<any>;
|
|
35
|
+
beforeInit(): Promise<any>;
|
|
36
|
+
beforeEnd(): Promise<any>;
|
|
37
|
+
main(): Promise<any>;
|
|
38
|
+
configFolder(): string;
|
|
39
|
+
configDataFiles(): Promise<any>;
|
|
40
|
+
seedFolder(): string;
|
|
41
|
+
seedMode(): Promise<any>;
|
|
42
|
+
seedManual(): Promise<any>;
|
|
43
|
+
seedMetadata(): Promise<any>;
|
|
44
|
+
triggers(): Promise<any>;
|
|
45
|
+
triggersMerged(): Promise<any>;
|
|
46
|
+
triggersMetadata(): Promise<any>;
|
|
47
|
+
classesSchemas(props: any): Promise<any>;
|
|
48
|
+
schemaFields(props: any): Promise<any>;
|
|
49
|
+
schemaIndexes(props: any): Promise<any>;
|
|
50
|
+
schemaRaw(props?: {}): Promise<any>;
|
|
51
|
+
schemaClassLevelPermissions(props: any): Promise<any>;
|
|
52
|
+
ownProtocols(): Promise<any>;
|
|
53
|
+
ownProtocolsClass(): Promise<any>;
|
|
54
|
+
liveClasses(): Promise<any>;
|
|
55
|
+
systemDockerCompose(): Promise<any>;
|
|
56
|
+
systemDockerComposeExists(): Promise<boolean>;
|
|
57
|
+
systemDockerComposePath(): string;
|
|
58
|
+
systemDockerDataPath(): string;
|
|
59
|
+
systemDockerComposeDirPath(): string;
|
|
60
|
+
configDirPath_obs(): string;
|
|
61
|
+
configData_obs(): Promise<any>;
|
|
62
|
+
systemDockerPayloadAdapter(): Promise<any>;
|
|
63
|
+
functions(): Promise<any>;
|
|
64
|
+
services(): Promise<any>;
|
|
65
|
+
routes(): Promise<{}>;
|
|
66
|
+
targetRoutes(): Promise<any[]>;
|
|
67
|
+
liveQueries(): Promise<any[]>;
|
|
68
|
+
jobFiles(): Promise<any>;
|
|
69
|
+
}
|
|
70
|
+
import BaseClass from './base.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function getOnePlain(props: any): Promise<any>;
|
|
2
|
+
export function formatQuery(props: any): void;
|
|
3
|
+
export function getOneGeneric({ objectId, className, include }?: {}): Promise<any>;
|
|
4
|
+
export function performBatchOnQuery({ query, batchSize, action }: {
|
|
5
|
+
query: any;
|
|
6
|
+
batchSize?: number;
|
|
7
|
+
action: any;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
export function performBatchOnQueryPerGroup({ query, batchSize, action }: {
|
|
10
|
+
query: any;
|
|
11
|
+
batchSize?: number;
|
|
12
|
+
action: any;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
export function fetchObjectIfNeeded({ object, className, forceFetch, includes, excludes, useMasterKey }?: {
|
|
15
|
+
forceFetch?: boolean;
|
|
16
|
+
includes?: any[];
|
|
17
|
+
excludes?: any[];
|
|
18
|
+
useMasterKey?: boolean;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
export function fetchObject({ objectId, className, forceFetch, includes, excludes, useMasterKey }?: {
|
|
21
|
+
includes?: any[];
|
|
22
|
+
excludes?: any[];
|
|
23
|
+
useMasterKey?: boolean;
|
|
24
|
+
}): Promise<any>;
|
|
25
|
+
export function destroyRowsWithQuery({ query, limitPerBatch }?: {}): Promise<void>;
|
|
26
|
+
export function destroyAllRowsWithQuery({ query, limitPerBatch }?: {
|
|
27
|
+
limitPerBatch?: number;
|
|
28
|
+
}): any;
|
|
29
|
+
export function prepareRequestWithUser({ params, headers, user, fetchOptions }?: {
|
|
30
|
+
fetchOptions?: {};
|
|
31
|
+
}): Promise<any>;
|
|
32
|
+
export function destroyItems({ object, keys }: {
|
|
33
|
+
object: any;
|
|
34
|
+
keys: any;
|
|
35
|
+
}): Promise<any[]>;
|
|
36
|
+
export function destroyItem(props: any): Promise<any>;
|
|
37
|
+
export function destroyItemsInArray(props: any): Promise<any[]>;
|
|
38
|
+
export function saveFileDataToFS({ file, path }: {
|
|
39
|
+
file: any;
|
|
40
|
+
path?: string;
|
|
41
|
+
}): Promise<string>;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import accessManifest from './manifest/access/index.js';
|
|
2
|
+
import documentProtocol from './document/gateway/all/index.js';
|
|
3
|
+
import extractProtocol from './manifest/extract/index.js';
|
|
4
|
+
import * as ManifestEnums from './manifest/data/1.0.0/enums.js';
|
|
5
|
+
import * as ManifestEnumsV1_1_0 from './manifest/data/1.0.0/enums.js';
|
|
6
|
+
import buildSchema from './schema/build/index.js';
|
|
7
|
+
import validateSchema from './schema/validate/index.js';
|
|
8
|
+
import compileArtifact from './schema/artifact/index.js';
|
|
9
|
+
import { hashOf as artifactHashOf } from './schema/artifact/index.js';
|
|
10
|
+
import { normalizeArtifact } from './schema/artifact/index.js';
|
|
11
|
+
import plan from './schema/plan/index.js';
|
|
12
|
+
import generateSchemaTypes from './schema/types/index.js';
|
|
13
|
+
import buildProtocolResources from './schema/protocolResources/index.js';
|
|
14
|
+
import generateProtocolResourceTypes from './schema/protocolResources/generateTypes.js';
|
|
15
|
+
import cleanProtocols from './lib/cleanProtocols.js';
|
|
16
|
+
import generateGithubReadme from './document/gateway/generateGithubReadme/index.js';
|
|
17
|
+
import defineConfig from './lib/defineConfig.js';
|
|
18
|
+
export namespace Domain {
|
|
19
|
+
export { Servable };
|
|
20
|
+
}
|
|
21
|
+
import Servable from './domain/servable/index.js';
|
|
22
|
+
export { accessManifest, documentProtocol, extractProtocol, ManifestEnums, ManifestEnumsV1_1_0, buildSchema, validateSchema, compileArtifact, artifactHashOf, normalizeArtifact, plan, generateSchemaTypes, buildProtocolResources, generateProtocolResourceTypes, cleanProtocols, generateGithubReadme, defineConfig };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} ServableDockerConfig
|
|
3
|
+
* @property {boolean} [enabled] - whether local docker-compose orchestration runs at all.
|
|
4
|
+
* Defaults to `true`.
|
|
5
|
+
* @property {string[]} [environments] - which `NODE_ENV` values this applies to. Defaults
|
|
6
|
+
* to `['development']`.
|
|
7
|
+
* @property {string} [namespace] - isolates this worktree's docker-compose stack (project
|
|
8
|
+
* name and any explicit `container_name`) from another worktree of the same app running
|
|
9
|
+
* at the same time. Unset (the default) is a complete no-op.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {object} ServableSystemConfig
|
|
13
|
+
* @property {ServableDockerConfig} [docker]
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} ServableCorsConfig
|
|
17
|
+
* @property {string[]} [allowedOrigins] - static allow-list.
|
|
18
|
+
* @property {(hostname: string) => boolean} [isOriginAllowed] - dynamic check, e.g. for a
|
|
19
|
+
* custom-domains feature backed by a verified-domains store. Runs in addition to
|
|
20
|
+
* `allowedOrigins`, not instead of it.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Passed almost as-is to the underlying Parse Server instance - see that engine's own
|
|
24
|
+
* `doLaunch()` for the full set of keys it actually reads (`mongoOptions`, `auth`,
|
|
25
|
+
* `sessionLength`, `masterKeyIps`, etc). Only the ones every app is likely to set are
|
|
26
|
+
* named below; the `Record<string, any>` intersection keeps any other Parse Server option
|
|
27
|
+
* from being rejected.
|
|
28
|
+
*
|
|
29
|
+
* @typedef {{
|
|
30
|
+
* sessionLength?: number,
|
|
31
|
+
* masterKeyIps?: string[],
|
|
32
|
+
* auth?: object,
|
|
33
|
+
* } & Record<string, any>} ServableParseConfig
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {object} ServableAppConfig
|
|
37
|
+
* @property {ServableCorsConfig} [cors]
|
|
38
|
+
* @property {ServableParseConfig} [parse]
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {object} ServableConfiguration
|
|
42
|
+
* @property {ServableAppConfig} [config]
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {object} ServableDryRunConfig
|
|
46
|
+
* @property {boolean} [enabled]
|
|
47
|
+
* @property {string[]} [environments] - which `NODE_ENV` values dry-run applies to.
|
|
48
|
+
* @property {{ users?: Array<{ email?: string, id?: string, phoneNumber?: string }> }} [exceptions] -
|
|
49
|
+
* accounts exempted from dry-run behavior even when it's on.
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* The shape `servable.config.js` exports as its default. Every field is optional -
|
|
53
|
+
* `@servable/server`'s own `adaptConfig` fills in defaults for whatever's missing (see
|
|
54
|
+
* `lib/adaptConfig/basic.js`) - this type exists purely for editor autocomplete on the file
|
|
55
|
+
* an app author actually hand-writes, not as a runtime schema.
|
|
56
|
+
*
|
|
57
|
+
* @typedef {object} ServableConfig
|
|
58
|
+
* @property {string} id - this app's identity (not a per-checkout/worktree identity -
|
|
59
|
+
* stays the same across worktrees of the same app).
|
|
60
|
+
* @property {ServableSystemConfig} [system]
|
|
61
|
+
* @property {ServableConfiguration} [configuration]
|
|
62
|
+
* @property {ServableDryRunConfig} [dryRun]
|
|
63
|
+
* @property {string[]} [protocols] - additional local protocol search paths, prepended to
|
|
64
|
+
* (not replacing) the framework's own bundled protocols and the app's own `protocols/`.
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* Identity helper for `servable.config.js` - returns `config` completely unchanged. Its
|
|
68
|
+
* only purpose is to give the object literal a known type, the same pattern
|
|
69
|
+
* Vite/Next.js/Docusaurus use their own `defineConfig()` for: wrap the export, get
|
|
70
|
+
* autocomplete and inline docs on every field, no runtime behavior added.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* // servable.config.js
|
|
74
|
+
* import { defineConfig } from '@servable/tools'
|
|
75
|
+
*
|
|
76
|
+
* export default defineConfig({
|
|
77
|
+
* id: 'my-app',
|
|
78
|
+
* system: { docker: { namespace: 'my-epic' } },
|
|
79
|
+
* })
|
|
80
|
+
*
|
|
81
|
+
* @param {ServableConfig} config
|
|
82
|
+
* @returns {ServableConfig} the same `config`, unmodified.
|
|
83
|
+
*/
|
|
84
|
+
export default function defineConfig(config: ServableConfig): ServableConfig;
|
|
85
|
+
export type ServableDockerConfig = {
|
|
86
|
+
/**
|
|
87
|
+
* - whether local docker-compose orchestration runs at all.
|
|
88
|
+
* Defaults to `true`.
|
|
89
|
+
*/
|
|
90
|
+
enabled?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* - which `NODE_ENV` values this applies to. Defaults
|
|
93
|
+
* to `['development']`.
|
|
94
|
+
*/
|
|
95
|
+
environments?: string[];
|
|
96
|
+
/**
|
|
97
|
+
* - isolates this worktree's docker-compose stack (project
|
|
98
|
+
* name and any explicit `container_name`) from another worktree of the same app running
|
|
99
|
+
* at the same time. Unset (the default) is a complete no-op.
|
|
100
|
+
*/
|
|
101
|
+
namespace?: string;
|
|
102
|
+
};
|
|
103
|
+
export type ServableSystemConfig = {
|
|
104
|
+
docker?: ServableDockerConfig;
|
|
105
|
+
};
|
|
106
|
+
export type ServableCorsConfig = {
|
|
107
|
+
/**
|
|
108
|
+
* - static allow-list.
|
|
109
|
+
*/
|
|
110
|
+
allowedOrigins?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* - dynamic check, e.g. for a
|
|
113
|
+
* custom-domains feature backed by a verified-domains store. Runs in addition to
|
|
114
|
+
* `allowedOrigins`, not instead of it.
|
|
115
|
+
*/
|
|
116
|
+
isOriginAllowed?: (hostname: string) => boolean;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Passed almost as-is to the underlying Parse Server instance - see that engine's own
|
|
120
|
+
* `doLaunch()` for the full set of keys it actually reads (`mongoOptions`, `auth`,
|
|
121
|
+
* `sessionLength`, `masterKeyIps`, etc). Only the ones every app is likely to set are
|
|
122
|
+
* named below; the `Record<string, any>` intersection keeps any other Parse Server option
|
|
123
|
+
* from being rejected.
|
|
124
|
+
*/
|
|
125
|
+
export type ServableParseConfig = {
|
|
126
|
+
sessionLength?: number;
|
|
127
|
+
masterKeyIps?: string[];
|
|
128
|
+
auth?: object;
|
|
129
|
+
} & Record<string, any>;
|
|
130
|
+
export type ServableAppConfig = {
|
|
131
|
+
cors?: ServableCorsConfig;
|
|
132
|
+
parse?: ServableParseConfig;
|
|
133
|
+
};
|
|
134
|
+
export type ServableConfiguration = {
|
|
135
|
+
config?: ServableAppConfig;
|
|
136
|
+
};
|
|
137
|
+
export type ServableDryRunConfig = {
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* - which `NODE_ENV` values dry-run applies to.
|
|
141
|
+
*/
|
|
142
|
+
environments?: string[];
|
|
143
|
+
/**
|
|
144
|
+
* -
|
|
145
|
+
* accounts exempted from dry-run behavior even when it's on.
|
|
146
|
+
*/
|
|
147
|
+
exceptions?: {
|
|
148
|
+
users?: Array<{
|
|
149
|
+
email?: string;
|
|
150
|
+
id?: string;
|
|
151
|
+
phoneNumber?: string;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* The shape `servable.config.js` exports as its default. Every field is optional -
|
|
157
|
+
* `@servable/server`'s own `adaptConfig` fills in defaults for whatever's missing (see
|
|
158
|
+
* `lib/adaptConfig/basic.js`) - this type exists purely for editor autocomplete on the file
|
|
159
|
+
* an app author actually hand-writes, not as a runtime schema.
|
|
160
|
+
*/
|
|
161
|
+
export type ServableConfig = {
|
|
162
|
+
/**
|
|
163
|
+
* - this app's identity (not a per-checkout/worktree identity -
|
|
164
|
+
* stays the same across worktrees of the same app).
|
|
165
|
+
*/
|
|
166
|
+
id: string;
|
|
167
|
+
system?: ServableSystemConfig;
|
|
168
|
+
configuration?: ServableConfiguration;
|
|
169
|
+
dryRun?: ServableDryRunConfig;
|
|
170
|
+
/**
|
|
171
|
+
* - additional local protocol search paths, prepended to
|
|
172
|
+
* (not replacing) the framework's own bundled protocols and the app's own `protocols/`.
|
|
173
|
+
*/
|
|
174
|
+
protocols?: string[];
|
|
175
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default operation;
|
|
2
|
+
/**
|
|
3
|
+
* Ensures the directory containing `filePath` exists, creating any missing
|
|
4
|
+
* parent directories along the way (like `mkdir -p`).
|
|
5
|
+
*
|
|
6
|
+
* Found via `checkJs` (lucide, PEAKUB DX initiative): the two-line body used to
|
|
7
|
+
* call an undefined `ensureDirectoryExistence` and import `./checkFileExists`
|
|
8
|
+
* with no extension - the latter throws `ERR_MODULE_NOT_FOUND` under Node ESM,
|
|
9
|
+
* so this function has never actually worked. Nothing in this package calls it
|
|
10
|
+
* today (confirmed via a repo-wide grep), so the bug was latent, not live.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} filePath - a file path whose parent directory should exist.
|
|
13
|
+
* @returns {Promise<true>} resolves once the directory exists (or already did).
|
|
14
|
+
*/
|
|
15
|
+
declare function operation(filePath: string): Promise<true>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function _default({ path, variant, mimeType, item, type, formatData, extraction: _extraction }: {
|
|
2
|
+
path?: string;
|
|
3
|
+
variant?: string;
|
|
4
|
+
mimeType?: string;
|
|
5
|
+
item: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
formatData?: boolean;
|
|
8
|
+
extraction?: object;
|
|
9
|
+
}): Promise<object | null>;
|
|
10
|
+
export default _default;
|