@devvit/shared-types 0.11.0-next-2024-08-14-74944e076.0 → 0.11.0-next-2024-08-14-02fb03297.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ConfigImpl.d.ts +20 -0
- package/ConfigImpl.d.ts.map +1 -0
- package/ConfigImpl.js +80 -0
- package/package.json +6 -6
package/ConfigImpl.d.ts
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { ActorSpec, Definition, DependencySpec, PackageQuery } from '@devvit/protos';
|
2
|
+
import type { AssetMap } from './Assets.js';
|
3
|
+
import type { DeepPartial } from './BuiltinTypes.js';
|
4
|
+
import type { Config } from './Config.js';
|
5
|
+
import type { Namespace } from './Namespace.js';
|
6
|
+
export type ClientFactory = {
|
7
|
+
Build<T>(desc: Definition, spec: PackageQuery): T;
|
8
|
+
};
|
9
|
+
export declare class ConfigImpl implements Config {
|
10
|
+
#private;
|
11
|
+
get assets(): Readonly<AssetMap>;
|
12
|
+
get webviewAssets(): Readonly<AssetMap>;
|
13
|
+
get providedDefinitions(): Readonly<Definition>[];
|
14
|
+
constructor(factory: ClientFactory, actorSpec: ActorSpec, assets: AssetMap, webviewAssets: AssetMap);
|
15
|
+
export(namespace: Readonly<Namespace>): DependencySpec;
|
16
|
+
provides(definition: Readonly<Definition>): void;
|
17
|
+
use<T>(definition: Readonly<Definition>, options?: Readonly<DeepPartial<PackageQuery>>): T;
|
18
|
+
uses(definition: Readonly<Definition>): boolean;
|
19
|
+
}
|
20
|
+
//# sourceMappingURL=ConfigImpl.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ConfigImpl.d.ts","sourceRoot":"","sources":["../src/ConfigImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AAClG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,GAAG,CAAC,CAAC;CACnD,CAAC;AAEF,qBAAa,UAAW,YAAW,MAAM;;IASvC,IAAI,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAE/B;IAED,IAAI,aAAa,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAEtC;IAED,IAAI,mBAAmB,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE,CAEhD;gBAGC,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,QAAQ,EAChB,aAAa,EAAE,QAAQ;IAUzB,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,cAAc;IActD,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI;IAIhD,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,GAAE,QAAQ,CAAC,WAAW,CAAC,YAAY,CAAC,CAAM,GAAG,CAAC;IAY9F,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO;CAWhD"}
|
package/ConfigImpl.js
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
5
|
+
};
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
11
|
+
};
|
12
|
+
var _ConfigImpl_instances, _ConfigImpl_factory, _ConfigImpl_name, _ConfigImpl_owner, _ConfigImpl_provides, _ConfigImpl_useQueries, _ConfigImpl_version, _ConfigImpl_assets, _ConfigImpl_webviewAssets, _ConfigImpl_newActorSpec;
|
13
|
+
import { ActorSpec, Definition, DependencySpec, PackageQuery, PackageSpec } from '@devvit/protos';
|
14
|
+
import { NonNull } from './NonNull.js';
|
15
|
+
import { PLUGIN_NAME, resolveActorHostname } from './HostnameUtil.js';
|
16
|
+
export class ConfigImpl {
|
17
|
+
get assets() {
|
18
|
+
return __classPrivateFieldGet(this, _ConfigImpl_assets, "f");
|
19
|
+
}
|
20
|
+
get webviewAssets() {
|
21
|
+
return __classPrivateFieldGet(this, _ConfigImpl_webviewAssets, "f");
|
22
|
+
}
|
23
|
+
get providedDefinitions() {
|
24
|
+
return __classPrivateFieldGet(this, _ConfigImpl_provides, "f");
|
25
|
+
}
|
26
|
+
constructor(factory, actorSpec, assets, webviewAssets) {
|
27
|
+
_ConfigImpl_instances.add(this);
|
28
|
+
_ConfigImpl_factory.set(this, void 0);
|
29
|
+
_ConfigImpl_name.set(this, void 0);
|
30
|
+
_ConfigImpl_owner.set(this, void 0);
|
31
|
+
_ConfigImpl_provides.set(this, []);
|
32
|
+
_ConfigImpl_useQueries.set(this, []);
|
33
|
+
_ConfigImpl_version.set(this, void 0);
|
34
|
+
_ConfigImpl_assets.set(this, void 0);
|
35
|
+
_ConfigImpl_webviewAssets.set(this, void 0);
|
36
|
+
__classPrivateFieldSet(this, _ConfigImpl_factory, factory, "f");
|
37
|
+
__classPrivateFieldSet(this, _ConfigImpl_name, actorSpec.name, "f");
|
38
|
+
__classPrivateFieldSet(this, _ConfigImpl_owner, actorSpec.owner, "f");
|
39
|
+
__classPrivateFieldSet(this, _ConfigImpl_version, actorSpec.version, "f");
|
40
|
+
__classPrivateFieldSet(this, _ConfigImpl_assets, Object.freeze(assets), "f");
|
41
|
+
__classPrivateFieldSet(this, _ConfigImpl_webviewAssets, Object.freeze(webviewAssets), "f");
|
42
|
+
}
|
43
|
+
export(namespace) {
|
44
|
+
return DependencySpec.fromPartial({
|
45
|
+
actor: __classPrivateFieldGet(this, _ConfigImpl_instances, "m", _ConfigImpl_newActorSpec).call(this),
|
46
|
+
hostname: resolveActorHostname(NonNull(__classPrivateFieldGet(this, _ConfigImpl_name, "f")), namespace),
|
47
|
+
provides: __classPrivateFieldGet(this, _ConfigImpl_provides, "f").map((definition) => {
|
48
|
+
return PackageSpec.fromPartial({
|
49
|
+
actor: __classPrivateFieldGet(this, _ConfigImpl_instances, "m", _ConfigImpl_newActorSpec).call(this),
|
50
|
+
definition: Definition.toSerializable(definition),
|
51
|
+
});
|
52
|
+
}),
|
53
|
+
uses: __classPrivateFieldGet(this, _ConfigImpl_useQueries, "f"),
|
54
|
+
});
|
55
|
+
}
|
56
|
+
provides(definition) {
|
57
|
+
__classPrivateFieldGet(this, _ConfigImpl_provides, "f").push(definition);
|
58
|
+
}
|
59
|
+
use(definition, options = {}) {
|
60
|
+
const query = PackageQuery.fromPartial({
|
61
|
+
...options,
|
62
|
+
name: options.name ?? PLUGIN_NAME,
|
63
|
+
owner: options.owner,
|
64
|
+
versions: options.versions,
|
65
|
+
typeName: definition.fullName,
|
66
|
+
});
|
67
|
+
__classPrivateFieldGet(this, _ConfigImpl_useQueries, "f").push(query);
|
68
|
+
return __classPrivateFieldGet(this, _ConfigImpl_factory, "f").Build(definition, query);
|
69
|
+
}
|
70
|
+
uses(definition) {
|
71
|
+
return __classPrivateFieldGet(this, _ConfigImpl_useQueries, "f").some((query) => query.typeName === definition.fullName);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
_ConfigImpl_factory = new WeakMap(), _ConfigImpl_name = new WeakMap(), _ConfigImpl_owner = new WeakMap(), _ConfigImpl_provides = new WeakMap(), _ConfigImpl_useQueries = new WeakMap(), _ConfigImpl_version = new WeakMap(), _ConfigImpl_assets = new WeakMap(), _ConfigImpl_webviewAssets = new WeakMap(), _ConfigImpl_instances = new WeakSet(), _ConfigImpl_newActorSpec = function _ConfigImpl_newActorSpec() {
|
75
|
+
return ActorSpec.fromPartial({
|
76
|
+
name: __classPrivateFieldGet(this, _ConfigImpl_name, "f") ?? '',
|
77
|
+
owner: __classPrivateFieldGet(this, _ConfigImpl_owner, "f") ?? '',
|
78
|
+
version: __classPrivateFieldGet(this, _ConfigImpl_version, "f") ?? '',
|
79
|
+
});
|
80
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@devvit/shared-types",
|
3
|
-
"version": "0.11.0-next-2024-08-14-
|
3
|
+
"version": "0.11.0-next-2024-08-14-02fb03297.0",
|
4
4
|
"license": "BSD-3-Clause",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -24,14 +24,14 @@
|
|
24
24
|
},
|
25
25
|
"types": "./index.d.ts",
|
26
26
|
"dependencies": {
|
27
|
-
"@devvit/protos": "0.11.0-next-2024-08-14-
|
27
|
+
"@devvit/protos": "0.11.0-next-2024-08-14-02fb03297.0",
|
28
28
|
"jsonschema": "1.4.1",
|
29
29
|
"uuid": "9.0.0"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
|
-
"@devvit/eslint-config": "0.11.0-next-2024-08-14-
|
33
|
-
"@devvit/repo-tools": "0.11.0-next-2024-08-14-
|
34
|
-
"@devvit/tsconfig": "0.11.0-next-2024-08-14-
|
32
|
+
"@devvit/eslint-config": "0.11.0-next-2024-08-14-02fb03297.0",
|
33
|
+
"@devvit/repo-tools": "0.11.0-next-2024-08-14-02fb03297.0",
|
34
|
+
"@devvit/tsconfig": "0.11.0-next-2024-08-14-02fb03297.0",
|
35
35
|
"@types/redis-mock": "0.17.1",
|
36
36
|
"@types/uuid": "9.0.0",
|
37
37
|
"eslint": "8.9.0",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"directory": "dist"
|
46
46
|
},
|
47
47
|
"source": "./src/index.ts",
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "14d82c7b9d9f925cd38e058e32ea59ea529e38d6"
|
49
49
|
}
|