@junobuild/cdn 0.0.1
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/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/declarations/console/console.did.d.ts +266 -0
- package/dist/declarations/console/console.factory.certified.did.js +284 -0
- package/dist/declarations/console/console.factory.did.js +284 -0
- package/dist/declarations/console/console.factory.did.mjs +284 -0
- package/dist/declarations/mission_control/mission_control.did.d.ts +430 -0
- package/dist/declarations/mission_control/mission_control.factory.certified.did.js +455 -0
- package/dist/declarations/mission_control/mission_control.factory.did.js +455 -0
- package/dist/index.js +1 -0
- package/dist/node/index.mjs +4 -0
- package/dist/node/index.mjs.map +7 -0
- package/dist/types/api/_actor.api.d.ts +4 -0
- package/dist/types/api/proposal.api.d.ts +18 -0
- package/dist/types/api/storage.api.d.ts +8 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/types/actor.params.d.ts +56 -0
- package/dist/types/types/cdn.d.ts +11 -0
- package/dist/types/utils/actor.utils.d.ts +9 -0
- package/package.json +61 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CdnParameters } from '../types/actor.params';
|
|
2
|
+
import type { CommitProposal, Proposal, ProposalId, ProposalType } from '../types/cdn';
|
|
3
|
+
export declare const initProposal: ({ cdn, proposalType }: {
|
|
4
|
+
proposalType: ProposalType;
|
|
5
|
+
cdn: CdnParameters;
|
|
6
|
+
}) => Promise<[ProposalId, Proposal]>;
|
|
7
|
+
export declare const submitProposal: ({ cdn, proposalId }: {
|
|
8
|
+
cdn: CdnParameters;
|
|
9
|
+
proposalId: ProposalId;
|
|
10
|
+
}) => Promise<[ProposalId, Proposal]>;
|
|
11
|
+
export declare const commitProposal: ({ cdn, commitProposal }: {
|
|
12
|
+
cdn: CdnParameters;
|
|
13
|
+
commitProposal: CommitProposal;
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
export declare const deleteProposalAssets: ({ cdn, proposalIds }: {
|
|
16
|
+
cdn: CdnParameters;
|
|
17
|
+
proposalIds: ProposalId[];
|
|
18
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type UploadAsset } from '@junobuild/storage';
|
|
2
|
+
import type { CdnParameters } from '../types/actor.params';
|
|
3
|
+
import type { ProposalId } from '../types/cdn';
|
|
4
|
+
export declare const uploadAssetWithProposal: ({ cdn, proposalId, asset }: {
|
|
5
|
+
asset: UploadAsset;
|
|
6
|
+
cdn: CdnParameters;
|
|
7
|
+
proposalId: ProposalId;
|
|
8
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { HttpAgent, Identity } from '@dfinity/agent';
|
|
2
|
+
import type { Principal } from '@dfinity/principal';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the parameters for an actor.
|
|
5
|
+
* @interface
|
|
6
|
+
*/
|
|
7
|
+
export interface ActorParameters {
|
|
8
|
+
/**
|
|
9
|
+
* The identity associated with the actor.
|
|
10
|
+
* @type {Identity}
|
|
11
|
+
*/
|
|
12
|
+
identity: Identity;
|
|
13
|
+
/**
|
|
14
|
+
* Specifies whether the actor is calling the local development Docker container or provides the container URL.
|
|
15
|
+
* @type {boolean | string}
|
|
16
|
+
* @optional
|
|
17
|
+
*/
|
|
18
|
+
container?: boolean | string;
|
|
19
|
+
/**
|
|
20
|
+
* An optional HttpAgent. If none is provided, a new agent will automatically be created to execute calls.
|
|
21
|
+
*/
|
|
22
|
+
agent?: HttpAgent;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents the parameters for a Console actor.
|
|
26
|
+
* @interface
|
|
27
|
+
* @extends {ActorParameters}
|
|
28
|
+
*/
|
|
29
|
+
export interface ConsoleParameters extends ActorParameters {
|
|
30
|
+
/**
|
|
31
|
+
* The unique identifier for the Console.
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
consoleId: string | Principal;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Represents the parameters for a Mission Control actor.
|
|
38
|
+
* @interface
|
|
39
|
+
* @extends {ActorParameters}
|
|
40
|
+
*/
|
|
41
|
+
export interface MissionControlParameters extends ActorParameters {
|
|
42
|
+
/**
|
|
43
|
+
* The unique identifier for the Mission Control.
|
|
44
|
+
* @type {string}
|
|
45
|
+
*/
|
|
46
|
+
missionControlId: string | Principal;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents initialization parameters for either a Console or Mission Control actor.
|
|
50
|
+
* Use discriminated unions to pass the correct parameters depending on the CDN to target.
|
|
51
|
+
*/
|
|
52
|
+
export type CdnParameters = {
|
|
53
|
+
console: ConsoleParameters;
|
|
54
|
+
} | {
|
|
55
|
+
missionControl: MissionControlParameters;
|
|
56
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as CdnConsole from '../../declarations/console/console.did';
|
|
2
|
+
import type * as CdnMissionControl from '../../declarations/mission_control/mission_control.did';
|
|
3
|
+
export type CommitProposal = CdnConsole.CommitProposal | CdnMissionControl.CommitProposal;
|
|
4
|
+
export type ProposalId = bigint;
|
|
5
|
+
export type Proposal = CdnConsole.Proposal | CdnMissionControl.Proposal;
|
|
6
|
+
export type ProposalStatus = CdnConsole.ProposalStatus | CdnMissionControl.ProposalStatus;
|
|
7
|
+
export type ProposalType = CdnConsole.ProposalType | CdnMissionControl.ProposalType;
|
|
8
|
+
export type AssetsUpgradeOptions = CdnConsole.AssetsUpgradeOptions | CdnMissionControl.AssetsUpgradeOptions;
|
|
9
|
+
export type SegmentsDeploymentOptions = CdnConsole.SegmentsDeploymentOptions | CdnMissionControl.SegmentsDeploymentOptions;
|
|
10
|
+
export type InitAssetKey = CdnConsole.InitAssetKey | CdnMissionControl.InitAssetKey;
|
|
11
|
+
export type InitUploadResult = CdnConsole.InitUploadResult | CdnMissionControl.InitUploadResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ActorConfig, type ActorMethod, type ActorSubclass } from '@dfinity/agent';
|
|
2
|
+
import type { IDL } from '@dfinity/candid';
|
|
3
|
+
import type { Principal } from '@dfinity/principal';
|
|
4
|
+
import type { ActorParameters } from '../types/actor.params';
|
|
5
|
+
export declare const createActor: <T = Record<string, ActorMethod>>({ canisterId, idlFactory, config, ...rest }: {
|
|
6
|
+
idlFactory: IDL.InterfaceFactory;
|
|
7
|
+
canisterId: string | Principal;
|
|
8
|
+
config?: Pick<ActorConfig, "callTransform" | "queryTransform">;
|
|
9
|
+
} & ActorParameters) => Promise<ActorSubclass<T>>;
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@junobuild/cdn",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A toolkit for working with modules that implement Juno's CDN functionality",
|
|
5
|
+
"author": "David Dal Busco (https://daviddalbusco.com)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/node/index.mjs",
|
|
9
|
+
"module": "./dist/browser/index.js",
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/types/index.d.ts",
|
|
15
|
+
"default": "./dist/browser/index.js"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/types/index.d.ts",
|
|
19
|
+
"default": "./dist/node/index.mjs"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"rmdir": "node ../../scripts/rmdir.mjs",
|
|
30
|
+
"ts-declaration": "tsc --emitDeclarationOnly --outDir dist/types",
|
|
31
|
+
"build": "npm run rmdir && mkdir -p dist && cp -R declarations dist && node esbuild.mjs && npm run ts-declaration",
|
|
32
|
+
"prepack": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/junobuild/juno-js.git",
|
|
37
|
+
"directory": "packages/cdn"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/junobuild/juno-js"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"cdn",
|
|
44
|
+
"content-delivery",
|
|
45
|
+
"developer-tools",
|
|
46
|
+
"cloud-toolkit",
|
|
47
|
+
"serverless",
|
|
48
|
+
"infrastructure"
|
|
49
|
+
],
|
|
50
|
+
"homepage": "https://juno.build",
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@dfinity/agent": "^2.3.0",
|
|
53
|
+
"@dfinity/candid": "^2.3.0",
|
|
54
|
+
"@dfinity/identity": "^2.3.0",
|
|
55
|
+
"@dfinity/principal": "^2.3.0",
|
|
56
|
+
"@dfinity/utils": "^2",
|
|
57
|
+
"@junobuild/config": "*",
|
|
58
|
+
"@junobuild/storage": "*",
|
|
59
|
+
"semver": "7.*"
|
|
60
|
+
}
|
|
61
|
+
}
|