@servable/tools 2.0.1 → 2.2.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.
Files changed (104) hide show
  1. package/global.d.ts +13 -0
  2. package/package.json +17 -15
  3. package/src/domain/protocolInstance/factory/index.js +8 -4
  4. package/src/domain/protocolInstance/index.js +15 -2
  5. package/src/domain/protocolLoader/base.js +19 -0
  6. package/src/domain/protocolLoader/v1.0.0.js +6 -3
  7. package/src/domain/protocolLoader/v1.1.0.js +7 -4
  8. package/src/domain/servable/parse/utils/index.js +21 -6
  9. package/src/index.js +8 -0
  10. package/src/lib/defineConfig.js +94 -0
  11. package/src/lib/directoryFilesRecursive.js +9 -1
  12. package/src/lib/directoryGlob.js +15 -1
  13. package/src/lib/ensureDirectoryExists.js +18 -5
  14. package/src/lib/getModuleDir.js +8 -3
  15. package/src/manifest/access/index.js +21 -0
  16. package/src/manifest/extract/extractItem.js +1 -1
  17. package/src/manifest/extract/route/extractFiles.js +8 -4
  18. package/src/manifest/extract/route/imageToBase64.js +12 -0
  19. package/src/schema/build/buildProtocol/classStruct/preserveMostRestricted.js +16 -2
  20. package/src/schema/build/index.js +4 -1
  21. package/src/schema/protocolResources/generateTypes.js +106 -0
  22. package/src/schema/protocolResources/index.js +103 -0
  23. package/src/schema/types/index.js +109 -0
  24. package/src/schema/validate/index.js +0 -1
  25. package/types/config/candidates/index.d.ts +2 -0
  26. package/types/config/candidates/protocolCandidates/index.d.ts +9 -0
  27. package/types/config/index.d.ts +2 -0
  28. package/types/config/validate/index.d.ts +4 -0
  29. package/types/config/validate/protocol/index.d.ts +5 -0
  30. package/types/document/gateway/all/index.d.ts +2 -0
  31. package/types/document/gateway/generateGithubReadme/index.d.ts +2 -0
  32. package/types/domain/lib/checkFileExists.d.ts +2 -0
  33. package/types/domain/protocol/factory/absoluteModuleSrcPath.d.ts +2 -0
  34. package/types/domain/protocol/factory/index.d.ts +7 -0
  35. package/types/domain/protocol/factory/protocolPath.d.ts +2 -0
  36. package/types/domain/protocol/index.d.ts +34 -0
  37. package/types/domain/protocol/lib/instancesPathIdUniqueId.d.ts +5 -0
  38. package/types/domain/protocolInstance/factory/getLoaderWithPayload.d.ts +4 -0
  39. package/types/domain/protocolInstance/factory/index.d.ts +6 -0
  40. package/types/domain/protocolInstance/factory/instancesWithPath.d.ts +6 -0
  41. package/types/domain/protocolInstance/index.d.ts +71 -0
  42. package/types/domain/protocolLoader/base.d.ts +52 -0
  43. package/types/domain/protocolLoader/factory/getModule.d.ts +6 -0
  44. package/types/domain/protocolLoader/factory/index.d.ts +4 -0
  45. package/types/domain/protocolLoader/lib/importJSDefault.d.ts +6 -0
  46. package/types/domain/protocolLoader/lib/importJSONDefault.d.ts +6 -0
  47. package/types/domain/protocolLoader/lib/mergeClassProtocols.d.ts +6 -0
  48. package/types/domain/protocolLoader/lib/triggerItems.d.ts +2 -0
  49. package/types/domain/protocolLoader/v1.0.0.d.ts +68 -0
  50. package/types/domain/protocolLoader/v1.1.0.d.ts +70 -0
  51. package/types/domain/servable/index.d.ts +8 -0
  52. package/types/domain/servable/parse/index.d.ts +5 -0
  53. package/types/domain/servable/parse/utils/index.d.ts +41 -0
  54. package/types/index.d.ts +22 -0
  55. package/types/lib/adaptConfig/basic.d.ts +4 -0
  56. package/types/lib/adaptProtocolPayload.d.ts +2 -0
  57. package/types/lib/checkFileExists.d.ts +2 -0
  58. package/types/lib/cleanProtocols.d.ts +2 -0
  59. package/types/lib/defineConfig.d.ts +175 -0
  60. package/types/lib/directories.d.ts +9 -0
  61. package/types/lib/directoryFilesRecursive.d.ts +7 -0
  62. package/types/lib/directoryGlob.d.ts +5 -0
  63. package/types/lib/ensureDirectoryExists.d.ts +15 -0
  64. package/types/lib/foldersInFolder.d.ts +9 -0
  65. package/types/lib/getModuleDir.d.ts +2 -0
  66. package/types/lib/importFileAsText.d.ts +2 -0
  67. package/types/lib/importJSONAsync.d.ts +2 -0
  68. package/types/lib/protocolApiVersion.d.ts +4 -0
  69. package/types/lib/sanitize.d.ts +2 -0
  70. package/types/lib/stableStringify.d.ts +2 -0
  71. package/types/manifest/access/accessChildInTreeWithRoute.d.ts +5 -0
  72. package/types/manifest/access/index.d.ts +10 -0
  73. package/types/manifest/data/1.0.0/enums.d.ts +382 -0
  74. package/types/manifest/data/1.1.0/enums.d.ts +401 -0
  75. package/types/manifest/extract/extractAst.d.ts +2 -0
  76. package/types/manifest/extract/extractItem.d.ts +2 -0
  77. package/types/manifest/extract/formatFile.d.ts +4 -0
  78. package/types/manifest/extract/index.d.ts +8 -0
  79. package/types/manifest/extract/route/extractFileWithVariants.d.ts +2 -0
  80. package/types/manifest/extract/route/extractFiles.d.ts +2 -0
  81. package/types/manifest/extract/route/imageToBase64.d.ts +13 -0
  82. package/types/manifest/extract/route/index.d.ts +2 -0
  83. package/types/manifest/extract/templateDataForId.d.ts +5 -0
  84. package/types/schema/artifact/index.d.ts +21 -0
  85. package/types/schema/build/buildProtocol/classStruct/extractProtocolsProtocols.d.ts +6 -0
  86. package/types/schema/build/buildProtocol/classStruct/index.d.ts +15 -0
  87. package/types/schema/build/buildProtocol/classStruct/preserveMostRestricted.d.ts +4 -0
  88. package/types/schema/build/buildProtocol/classStruct/protocolInClassClassSchema.d.ts +2 -0
  89. package/types/schema/build/buildProtocol/extractClassesProtocol.d.ts +8 -0
  90. package/types/schema/build/buildProtocol/index.d.ts +7 -0
  91. package/types/schema/build/buildProtocol/index.for.d.ts +7 -0
  92. package/types/schema/build/buildProtocol/index.promiseall.d.ts +7 -0
  93. package/types/schema/build/index.d.ts +9 -0
  94. package/types/schema/build/lib/getProtocolsLiveClasses.d.ts +4 -0
  95. package/types/schema/build/lib/updateProtocolsExcerpt.d.ts +5 -0
  96. package/types/schema/plan/classifyField.d.ts +23 -0
  97. package/types/schema/plan/index.d.ts +11 -0
  98. package/types/schema/protocolResources/generateTypes.d.ts +11 -0
  99. package/types/schema/protocolResources/index.d.ts +42 -0
  100. package/types/schema/types/index.d.ts +18 -0
  101. package/types/schema/validate/handleProtocol/computeVersions.d.ts +16 -0
  102. package/types/schema/validate/handleProtocol/index.d.ts +18 -0
  103. package/types/schema/validate/index.d.ts +26 -0
  104. package/src/schema/index.js +0 -56
@@ -0,0 +1,106 @@
1
+ // lucide 0.6 (protocol-resources), PEAKUB DX initiative - the codegen half of
2
+ // buildProtocolResources(). Turns that scan's output into a `.d.ts` that merges into
3
+ // @servable/server's `ServableServiceCallMap` (see that package's own global.d.ts for why that
4
+ // interface is declared open there rather than typed fully in one place). Each entry references
5
+ // the real service file with `typeof import(path).default` - not a serialized copy of its
6
+ // signature - so the generated type can never drift from the live handler: whatever JSDoc that
7
+ // file has on its `handler` IS the type, always, by construction.
8
+ //
9
+ // Jobs are emitted as a plain per-protocol listing (`ServableProtocolJobs`), not merged into any
10
+ // call-map, since nothing invokes a job by id - see buildProtocolResources()'s own file for why.
11
+
12
+ const HEADER = `// AUTO-GENERATED by \`servable schema protocol-types\` - do not hand-edit, it will be
13
+ // overwritten on the next run. Regenerate whenever a protocol adds/removes/renames a service or
14
+ // job. Commit it alongside servable.schema.json so editors don't need to run the generator to
15
+ // get these types.
16
+ //
17
+ // Every \`typeof import(...)\` below points at the real, live service/job file - the type is
18
+ // never a hand-maintained copy of that file's signature, so it can't drift from it.
19
+ `
20
+
21
+ /**
22
+ * @param {string} path - absolute path to a service/job file.
23
+ * @returns {string} a module specifier safe to embed in a `typeof import('...')` type query.
24
+ */
25
+ const importSpecifier = path => JSON.stringify(path)
26
+
27
+ /**
28
+ * @param {import('./index.js').ProtocolResourceEntry} service
29
+ * @returns {string}
30
+ */
31
+ const serviceEntryLine = service =>
32
+ ` ${JSON.stringify(service.id)}: typeof import(${importSpecifier(service.path)})['default']`
33
+
34
+ /**
35
+ * @param {import('./index.js').ProtocolResourceEntry} job
36
+ * @returns {string}
37
+ */
38
+ const jobEntryLine = job =>
39
+ ` ${JSON.stringify(job.id)}: typeof import(${importSpecifier(job.path)})['default']`
40
+
41
+ /**
42
+ * Generates a `.d.ts` that:
43
+ * - merges every discovered service into `ServableServiceCallMap` (sharpening
44
+ * `Servable.Services.call({ id, params })`'s `params`/return type for that `id`).
45
+ * - emits one `ServableProtocolJobs` interface per protocol, keyed by protocol id, listing its
46
+ * jobs for discoverability (no call-site typing - nothing invokes a job by id).
47
+ *
48
+ * @param {Record<string, import('./index.js').ProtocolResources>} resources - `buildProtocolResources()`'s output.
49
+ * @returns {string} the full `.d.ts` file contents.
50
+ */
51
+ export default function generateProtocolResourceTypes(resources) {
52
+ const protocolIds = Object.keys(resources || {}).sort((a, b) => a.localeCompare(b))
53
+
54
+ // Deduped by `id`, first occurrence wins - mirrors the real registry's own semantics
55
+ // (domain/servable/services/index.js's `register()` skips a service whose `id`+`version` is
56
+ // already registered), and keeps this from ever emitting a TS interface with a duplicate
57
+ // property name, which would be invalid output.
58
+ const seenServiceIds = new Set()
59
+ const allServices = protocolIds
60
+ .flatMap(protocolId => resources[protocolId].services)
61
+ .sort((a, b) => a.id.localeCompare(b.id))
62
+ .filter(service => {
63
+ if (seenServiceIds.has(service.id)) {
64
+ return false
65
+ }
66
+ seenServiceIds.add(service.id)
67
+ return true
68
+ })
69
+
70
+ // Sanitizing a protocol id into an identifier can collide (e.g. `@a/foo-bar` and `@a/foo_bar`
71
+ // both sanitize to `_a_foo_bar`) even though real protocol ids never collide with each other -
72
+ // disambiguated with a numeric suffix rather than risk emitting two interfaces with the same
73
+ // name, which would be invalid output.
74
+ const seenJobInterfaceNames = new Set()
75
+ const jobInterfaces = protocolIds
76
+ .filter(protocolId => resources[protocolId].jobs.length)
77
+ .map(protocolId => {
78
+ const jobs = resources[protocolId].jobs.slice().sort((a, b) => a.id.localeCompare(b.id))
79
+ const jobLines = jobs.map(jobEntryLine).join('\n')
80
+ let safeProtocolName = protocolId.replace(/[^A-Za-z0-9_$]/g, '_')
81
+ let interfaceName = `ServableProtocolJobs_${safeProtocolName}`
82
+ let suffix = 2
83
+ while (seenJobInterfaceNames.has(interfaceName)) {
84
+ interfaceName = `ServableProtocolJobs_${safeProtocolName}_${suffix}`
85
+ suffix += 1
86
+ }
87
+ seenJobInterfaceNames.add(interfaceName)
88
+ return `/** Jobs defined by protocol \`${protocolId}\`. */\n` +
89
+ `export interface ${interfaceName} {\n${jobLines}\n}`
90
+ })
91
+ .join('\n\n')
92
+
93
+ // Omitted entirely (rather than merged as an empty/index-signature interface) when there are
94
+ // no services anywhere in the app - @servable/server's own `ServableServiceCallMap` already
95
+ // declares the open, loose-fallback index signature; restating it here would be redundant.
96
+ const serviceMapMerge = allServices.length
97
+ ? `declare global {\n interface ServableServiceCallMap {\n${allServices.map(serviceEntryLine).join('\n')}\n }\n}\n`
98
+ : ''
99
+
100
+ return [
101
+ HEADER,
102
+ serviceMapMerge,
103
+ jobInterfaces,
104
+ 'export {}\n',
105
+ ].filter(Boolean).join('\n')
106
+ }
@@ -0,0 +1,103 @@
1
+ import checkFileExists from '../../lib/checkFileExists.js'
2
+ import directoryFilesRecursive from '../../lib/directoryFilesRecursive.js'
3
+
4
+ // lucide 0.6 (protocol-resources), PEAKUB DX initiative.
5
+ //
6
+ // A separate, additive pass over an app's already-built protocol list - NOT part of
7
+ // buildSchema()/protocolLoader's own boot-critical path, and never invoked at server boot.
8
+ // buildSchema() already has a known perf finding (redundant reads, unparallelized loops); this
9
+ // module intentionally does not touch it or run as part of it, so it can't make that worse or
10
+ // put schema-compatibility-floor correctness at risk. It's meant to be called once, by a CLI
11
+ // command (see @servable/cli's `servable schema protocol-types`), consuming the `protocols`
12
+ // array `buildSchema()` already produces as plain input - not re-discovering protocols itself.
13
+ //
14
+ // Only `services/` and `jobs/` are scanned. Routes and Parse Cloud functions were deliberately
15
+ // left out of this first pass (not because they're unsupported, but because they're not a good
16
+ // fit yet): no live protocol under a real app currently has a `routes/` directory (the
17
+ // convention is only exercised by the app-level `app/routes/` tree), and `functions/`/`cloudCode`
18
+ // files use a structurally different export shape (multiple named exports, each becoming its own
19
+ // `Parse.Cloud.define()`-registered function, rather than one `{ id, handler }` default export)
20
+ // that this scanner doesn't handle yet. Both are real gaps, not silently ignored - see this
21
+ // package's own CLAUDE.md or file a follow-up rather than assuming they're covered.
22
+ //
23
+ // Services are the one resource here actually invoked through a string-keyed indirection
24
+ // (`Servable.Services.call({ id, params })`) that static analysis can't see through on its own -
25
+ // that's the whole reason this exists. Jobs are listed for discoverability (so an editor can show
26
+ // "what jobs does this protocol define"), not because anything calls a job by name - jobs run on
27
+ // their own cron schedule.
28
+
29
+ /**
30
+ * @typedef {object} ProtocolResourceEntry
31
+ * @property {string} id - the resource's own `id` field (services) or `id`/name (jobs).
32
+ * @property {string} path - absolute path to the file that exports it, for `typeof import(...)`.
33
+ * @property {string} [cron] - jobs only.
34
+ */
35
+
36
+ /**
37
+ * @typedef {object} ProtocolResources
38
+ * @property {ProtocolResourceEntry[]} services
39
+ * @property {ProtocolResourceEntry[]} jobs
40
+ */
41
+
42
+ /**
43
+ * Scans `services/` and `jobs/` for every protocol in `protocols`, keyed by protocol id.
44
+ * Protocols with neither directory (or with directories that only contain malformed exports -
45
+ * missing `id`, logged and skipped rather than thrown) are omitted from the result entirely.
46
+ *
47
+ * @param {object} props
48
+ * @param {any[]} props.protocols - the `protocols` array `buildSchema()` already produced (each
49
+ * a `ProtocolInstance` with `.id` and `.loader.path`).
50
+ * @returns {Promise<Record<string, ProtocolResources>>}
51
+ */
52
+ export default async function buildProtocolResources({ protocols }) {
53
+ /** @type {Record<string, ProtocolResources>} */
54
+ const result = {}
55
+
56
+ for (const protocol of protocols || []) {
57
+ const protocolId = protocol && protocol.id
58
+ const rootPath = protocol && protocol.loader && protocol.loader.path
59
+ if (!protocolId || !rootPath) {
60
+ continue
61
+ }
62
+
63
+ const services = await scanResourceDir({ dirPath: `${rootPath}/services` })
64
+ const jobs = await scanResourceDir({ dirPath: `${rootPath}/jobs`, isJob: true })
65
+
66
+ if (!services.length && !jobs.length) {
67
+ continue
68
+ }
69
+
70
+ result[protocolId] = { services, jobs }
71
+ }
72
+
73
+ return result
74
+ }
75
+
76
+ /**
77
+ * @param {object} props
78
+ * @param {string} props.dirPath
79
+ * @param {boolean} [props.isJob]
80
+ * @returns {Promise<ProtocolResourceEntry[]>}
81
+ */
82
+ const scanResourceDir = async ({ dirPath, isJob = false }) => {
83
+ if (!(await checkFileExists(dirPath))) {
84
+ return []
85
+ }
86
+
87
+ const files = await directoryFilesRecursive({ path: dirPath, includeMeta: true })
88
+ if (!files) {
89
+ return []
90
+ }
91
+
92
+ return files
93
+ .map(({ module, path }) => {
94
+ const exported = module && module.default
95
+ if (!exported || !exported.id) {
96
+ return null
97
+ }
98
+ return isJob
99
+ ? { id: exported.id, path, cron: exported.cron }
100
+ : { id: exported.id, path }
101
+ })
102
+ .filter(entry => entry !== null)
103
+ }
@@ -0,0 +1,109 @@
1
+ // lucide (PEAKUB DX initiative) - PEAKUB-321's sibling: `servable.schema.json` already fully
2
+ // describes every class and field (that's the whole point of unischema's committed artifact -
3
+ // see .docs/technical/unischema-plan.md). This turns that same artifact into a `.d.ts` so
4
+ // `object.get('caption')`/`object.set('caption', value)` gets real autocomplete and a typo in a
5
+ // field name gets flagged, for every app-specific class - pure codegen, no new modeling effort,
6
+ // regenerated fresh on every `servable schema build` (see `servable schema types`, the CLI
7
+ // command this backs).
8
+
9
+ /** Parse field type -> the TS type a getter/setter for it should carry. */
10
+ const FIELD_TYPE_MAP = {
11
+ String: 'string',
12
+ Number: 'number',
13
+ Boolean: 'boolean',
14
+ Date: 'Date',
15
+ Array: 'any[]',
16
+ Object: 'Record<string, any>',
17
+ GeoPoint: '{ latitude: number, longitude: number }',
18
+ Polygon: 'Array<[number, number]>',
19
+ File: '{ url: () => string, name: () => string }',
20
+ ACL: 'Record<string, { read?: boolean, write?: boolean }>',
21
+ Relation: 'ServableRelation<any>',
22
+ }
23
+
24
+ /**
25
+ * @param {{ type: string, targetClass?: string }} field
26
+ * @param {Set<string>} knownClassNames - classes the artifact actually defines; a `Pointer`
27
+ * to anything else (e.g. a core Parse class like `_User` when only app classes were passed
28
+ * in) falls back to a generic shape rather than referencing a type that won't exist.
29
+ */
30
+ const tsTypeForField = (field, knownClassNames) => {
31
+ if (field.type === 'Pointer') {
32
+ return field.targetClass && knownClassNames.has(field.targetClass)
33
+ ? `ServablePointer<${field.targetClass}>`
34
+ : 'ServablePointer<any>'
35
+ }
36
+
37
+ return FIELD_TYPE_MAP[field.type] || 'any'
38
+ }
39
+
40
+ const HEADER = `// AUTO-GENERATED by \`servable schema types\` from servable.schema.json - do not hand-edit,
41
+ // it will be overwritten on the next \`servable schema build\`. Commit it alongside
42
+ // servable.schema.json itself so editors don't need to run the generator to get these types.
43
+ //
44
+ // Every field is optional: Parse never enforces a field's presence purely from schema (that's
45
+ // what CLPs/beforeSave validation are for), so a freshly-fetched or not-yet-saved object may
46
+ // legitimately be missing any of them.
47
+
48
+ /** A Parse Pointer field, narrowed to the class it points at. */
49
+ export interface ServablePointer<T> {
50
+ id: string
51
+ className: string
52
+ get<K extends keyof T>(key: K): T[K]
53
+ set<K extends keyof T>(key: K, value: T[K]): this
54
+ fetch(options?: Record<string, any>): Promise<this>
55
+ }
56
+
57
+ /** A Parse Relation field, narrowed to the class it relates to. */
58
+ export interface ServableRelation<T> {
59
+ query(): { find(options?: Record<string, any>): Promise<T[]> }
60
+ add(object: T): void
61
+ remove(object: T): void
62
+ }
63
+ `
64
+
65
+ /**
66
+ * Generates one TypeScript interface per class in a `servable.schema.json` artifact, each
67
+ * field typed from its Parse field type (`Pointer`/`Relation` narrowed to the target class
68
+ * when that class is also present in the artifact) - plus a merge into
69
+ * @servable/parse-server-engine's `ServableClassMap`, keyed by class name, powering
70
+ * `Servable.App.Typed.object('ClassName')`/`.query('ClassName')` (see that package's own
71
+ * global.d.ts for why that's a separate, opt-in surface rather than a change to `Object`/`Query`
72
+ * themselves).
73
+ *
74
+ * @param {{ classes: Array<{ className: string, fields: Record<string, { type: string, targetClass?: string }> }> }} artifact
75
+ * - a normalized `servable.schema.json` (or anything with the same `classes` shape).
76
+ * @returns {string} the full `.d.ts` file contents.
77
+ */
78
+ export default function generateSchemaTypes(artifact) {
79
+ const classes = artifact?.classes || []
80
+ const knownClassNames = new Set(classes.map(c => c.className))
81
+
82
+ const sortedClasses = classes.slice().sort((a, b) => a.className.localeCompare(b.className))
83
+
84
+ const interfaces = sortedClasses
85
+ .map(({ className, fields = {} }) => {
86
+ const fieldLines = Object.entries(fields)
87
+ .sort(([a], [b]) => a.localeCompare(b))
88
+ .map(([fieldName, field]) => {
89
+ const safeName = /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(fieldName)
90
+ ? fieldName
91
+ : JSON.stringify(fieldName)
92
+ return ` ${safeName}?: ${tsTypeForField(field, knownClassNames)}`
93
+ })
94
+ .join('\n')
95
+
96
+ return `export interface ${className} {\n${fieldLines || ' [key: string]: any'}\n}`
97
+ })
98
+ .join('\n\n')
99
+
100
+ // Omitted entirely (rather than merged as an empty interface) when there are no classes at
101
+ // all - matches generateProtocolResourceTypes()'s own ServableServiceCallMap handling.
102
+ const classMapMerge = sortedClasses.length
103
+ ? `declare global {\n interface ServableClassMap {\n${sortedClasses
104
+ .map(({ className }) => ` ${JSON.stringify(className)}: ${className}`)
105
+ .join('\n')}\n }\n}\n`
106
+ : ''
107
+
108
+ return [HEADER, interfaces, classMapMerge].filter(Boolean).join('\n')
109
+ }
@@ -19,7 +19,6 @@ export default async ({
19
19
 
20
20
  const problematic = comparisons.filter(a => {
21
21
  const {
22
- highestVersion,
23
22
  lowestCompatibleVersion,
24
23
  lowestVersion
25
24
  } = a
@@ -0,0 +1,2 @@
1
+ declare function _default(props: any): Promise<any>;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare function _default(props: any): Promise<{
2
+ protocol: any;
3
+ id: any;
4
+ type: string;
5
+ mode: string;
6
+ path: any;
7
+ files: any;
8
+ }[]>;
9
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { validate };
2
+ import validate from './validate/index.js';
@@ -0,0 +1,4 @@
1
+ declare function _default({ items }: {
2
+ items: any;
3
+ }): Promise<any[]>;
4
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare function _default(props: any): Promise<{
2
+ isValid: boolean;
3
+ message: string;
4
+ }>;
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(props: any): Promise<any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(props: any): Promise<any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(file: any): Promise<boolean>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(item: any): string;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare function _default({ protocolPayload, servableConfig, protocolsCache, instancesPathId }: {
2
+ protocolPayload: any;
3
+ servableConfig: any;
4
+ protocolsCache: any;
5
+ instancesPathId: any;
6
+ }): Promise<any>;
7
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function _default(props: any): Promise<string>;
2
+ export default _default;
@@ -0,0 +1,34 @@
1
+ export default class Protocol {
2
+ constructor(props: any);
3
+ _id: any;
4
+ _type: any;
5
+ _instances: any[];
6
+ _extractionStatus: number;
7
+ addInstanceIfNeeded({ protocolPayload, servableConfig, instancesPathId }: {
8
+ protocolPayload: any;
9
+ servableConfig: any;
10
+ instancesPathId: any;
11
+ }): Promise<any>;
12
+ set instances(value: any[]);
13
+ get instances(): any[];
14
+ instancesClassesPayloads(): {
15
+ protocolPayload: any;
16
+ instancesPathId: any;
17
+ instancesPathIdString: any;
18
+ instance: any;
19
+ }[];
20
+ set mainInstance(value: any);
21
+ get mainInstance(): any;
22
+ set version(value: any);
23
+ get version(): any;
24
+ set params(value: any);
25
+ get params(): any;
26
+ set loader(value: any);
27
+ get loader(): any;
28
+ set extractionStatus(value: number);
29
+ get extractionStatus(): number;
30
+ set schema(value: any);
31
+ get schema(): any;
32
+ set id(value: any);
33
+ get id(): any;
34
+ }
@@ -0,0 +1,5 @@
1
+ declare function _default({ instancesPathId, currentProtocolId }: {
2
+ instancesPathId: any;
3
+ currentProtocolId: any;
4
+ }): string;
5
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare function _default({ protocolPayload }: {
2
+ protocolPayload: any;
3
+ }): Promise<import("../../protocolLoader/v1.0.0.js").default>;
4
+ export default _default;
@@ -0,0 +1,6 @@
1
+ export function getWithCache({ protocolPayload, servableConfig, instancesPathId, instances, }: {
2
+ protocolPayload: any;
3
+ servableConfig: any;
4
+ instancesPathId: any;
5
+ instances: any;
6
+ }): Promise<any>;
@@ -0,0 +1,6 @@
1
+ declare function _default({ className, instances, path }: {
2
+ className: any;
3
+ instances: any;
4
+ path: any;
5
+ }): any;
6
+ export default _default;
@@ -0,0 +1,71 @@
1
+ export default class ProtocolInstance {
2
+ constructor(props: any);
3
+ _className: any;
4
+ _params: {};
5
+ _instancesPathId: any[];
6
+ _instancesPathIdString: any;
7
+ _loader: any;
8
+ _version: string;
9
+ _minimumCompatibleVersion: string;
10
+ _loadState: number;
11
+ _module: {};
12
+ _path: any;
13
+ _id: any;
14
+ _protocolPayload: any;
15
+ _schema: {
16
+ classes: {
17
+ managed: any[];
18
+ all: any[];
19
+ };
20
+ };
21
+ /**
22
+ * @param {object} [props]
23
+ * @param {object} [props.servableConfig] - used to resolve a pinned version for this
24
+ * protocol instance from `servableConfig.versions`, if present.
25
+ */
26
+ load({ servableConfig }?: {
27
+ servableConfig?: object;
28
+ }): Promise<void>;
29
+ set loadState(value: number);
30
+ get loadState(): number;
31
+ set module(value: {});
32
+ get module(): {};
33
+ set version(value: string);
34
+ get version(): string;
35
+ set className(value: any);
36
+ get className(): any;
37
+ set params(value: {});
38
+ get params(): {};
39
+ set protocolPayload(value: any);
40
+ get protocolPayload(): any;
41
+ toString(): string;
42
+ set instancesPathIdString(value: any);
43
+ get instancesPathIdString(): any;
44
+ set instancesPathId(value: any[]);
45
+ get instancesPathId(): any[];
46
+ set id(value: any);
47
+ get id(): any;
48
+ set path(value: any);
49
+ get path(): any;
50
+ set minimumCompatibleVersion(value: string);
51
+ get minimumCompatibleVersion(): string;
52
+ set loader(value: any);
53
+ get loader(): any;
54
+ set schema(value: {
55
+ classes: {
56
+ managed: any[];
57
+ all: any[];
58
+ };
59
+ });
60
+ get schema(): {
61
+ classes: {
62
+ managed: any[];
63
+ all: any[];
64
+ };
65
+ };
66
+ /**
67
+ * @returns {Promise<object | null>} this protocol instance's raw `schema.json`
68
+ * contents, memoized by the loader.
69
+ */
70
+ schemaRaw(): Promise<object | null>;
71
+ }
@@ -0,0 +1,52 @@
1
+ export default class ProtocolLoader {
2
+ constructor(props: any);
3
+ _cache: {};
4
+ _extraClasses: {};
5
+ _extraction: any;
6
+ _path: any;
7
+ _protocolInstance: any;
8
+ set path(value: any);
9
+ get path(): any;
10
+ set cache(value: {});
11
+ get cache(): {};
12
+ set extraction(value: any);
13
+ get extraction(): any;
14
+ set protocolInstance(value: any);
15
+ get protocolInstance(): any;
16
+ /**
17
+ * @param {object} [props]
18
+ * @param {object} [props.servableConfig] - currently unused by this base
19
+ * implementation; accepted for interface parity with the loader subclasses that do
20
+ * read it (e.g. version resolution).
21
+ */
22
+ loadExtraction({ servableConfig }?: {
23
+ servableConfig?: object;
24
+ }): Promise<void>;
25
+ _accessManifestItem({ item }: {
26
+ item: any;
27
+ }): Promise<any>;
28
+ isValid(): Promise<boolean>;
29
+ getModule(): Promise<any>;
30
+ /**
31
+ * @param {object} props
32
+ * @param {string} props.path
33
+ * @param {string} [props.cacheKey] - most callers omit this. Note:
34
+ * `importJSDefault`/`importJSONDefault` currently accept `cache`/`cacheKey` but never
35
+ * read them - every call is a fresh dynamic `import()`, not actually cached. Caching
36
+ * in this class goes through the separate `_valueInCache`/`this.cache` mechanism
37
+ * instead (see e.g. `classFunctions()`).
38
+ */
39
+ _importJSDefault({ path, cacheKey }: {
40
+ path: string;
41
+ cacheKey?: string;
42
+ }): Promise<any>;
43
+ /** @param {object} props
44
+ * @param {string} props.path
45
+ * @param {string} [props.cacheKey] - see `_importJSDefault`'s note; unused today.
46
+ */
47
+ _importJSONDefault({ path, cacheKey }: {
48
+ path: string;
49
+ cacheKey?: string;
50
+ }): Promise<any>;
51
+ _valueInCache(value: any): any;
52
+ }
@@ -0,0 +1,6 @@
1
+ declare function _default({ path, version }: {
2
+ path: any;
3
+ version: any;
4
+ }): Promise<typeof v1_0_0>;
5
+ export default _default;
6
+ import v1_0_0 from '../v1.0.0.js';
@@ -0,0 +1,4 @@
1
+ export function getByPathAndVersion({ path, version }: {
2
+ path: any;
3
+ version: any;
4
+ }): Promise<import("../v1.0.0.js").default>;
@@ -0,0 +1,6 @@
1
+ declare function _default({ path, cache, cacheKey }: {
2
+ path: any;
3
+ cache: any;
4
+ cacheKey: any;
5
+ }): Promise<any>;
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare function _default({ path, cache, cacheKey }: {
2
+ path: any;
3
+ cache: any;
4
+ cacheKey: any;
5
+ }): Promise<any>;
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare function _default({ items, _class, withProtocolsProtocols }: {
2
+ items?: any[];
3
+ _class: any;
4
+ withProtocolsProtocols: any;
5
+ }): any[];
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;