@permaweb/libs 0.0.1-beta

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 (66) hide show
  1. package/dist/bundle.esm.js +1 -0
  2. package/dist/common/ao.d.ts +24 -0
  3. package/dist/common/ao.js +326 -0
  4. package/dist/common/ao.js.map +1 -0
  5. package/dist/common/arweave.d.ts +7 -0
  6. package/dist/common/arweave.js +62 -0
  7. package/dist/common/arweave.js.map +1 -0
  8. package/dist/common/gql.d.ts +3 -0
  9. package/dist/common/gql.js +176 -0
  10. package/dist/common/gql.js.map +1 -0
  11. package/dist/common/index.d.ts +3 -0
  12. package/dist/common/index.js +4 -0
  13. package/dist/common/index.js.map +1 -0
  14. package/dist/helpers/config.d.ts +67 -0
  15. package/dist/helpers/config.js +68 -0
  16. package/dist/helpers/config.js.map +1 -0
  17. package/dist/helpers/endpoints.d.ts +3 -0
  18. package/dist/helpers/endpoints.js +17 -0
  19. package/dist/helpers/endpoints.js.map +1 -0
  20. package/dist/helpers/index.d.ts +4 -0
  21. package/dist/helpers/index.js +5 -0
  22. package/dist/helpers/index.js.map +1 -0
  23. package/dist/helpers/types.d.ts +184 -0
  24. package/dist/helpers/types.js +2 -0
  25. package/dist/helpers/types.js.map +1 -0
  26. package/dist/helpers/utils.d.ts +37 -0
  27. package/dist/helpers/utils.js +245 -0
  28. package/dist/helpers/utils.js.map +1 -0
  29. package/dist/index.cjs +28 -0
  30. package/dist/index.cjs.js +153 -0
  31. package/dist/index.cjs.js.map +7 -0
  32. package/dist/index.cjs.map +7 -0
  33. package/dist/index.d.ts +3 -0
  34. package/dist/index.esm.js +41 -0
  35. package/dist/index.esm.js.map +7 -0
  36. package/dist/index.js +28 -0
  37. package/dist/index.js.map +7 -0
  38. package/dist/services/assets.d.ts +5 -0
  39. package/dist/services/assets.js +277 -0
  40. package/dist/services/assets.js.map +1 -0
  41. package/dist/services/index.d.ts +3 -0
  42. package/dist/services/index.js +4 -0
  43. package/dist/services/index.js.map +1 -0
  44. package/dist/services/profiles.d.ts +5 -0
  45. package/dist/services/profiles.js +146 -0
  46. package/dist/services/profiles.js.map +1 -0
  47. package/dist/services/zones.d.ts +10 -0
  48. package/dist/services/zones.js +78 -0
  49. package/dist/services/zones.js.map +1 -0
  50. package/dist/types/common/ao.d.ts +25 -0
  51. package/dist/types/common/arweave.d.ts +8 -0
  52. package/dist/types/common/gql.d.ts +3 -0
  53. package/dist/types/common/index.d.ts +3 -0
  54. package/dist/types/helpers/config.d.ts +82 -0
  55. package/dist/types/helpers/endpoints.d.ts +3 -0
  56. package/dist/types/helpers/index.d.ts +4 -0
  57. package/dist/types/helpers/types.d.ts +230 -0
  58. package/dist/types/helpers/utils.d.ts +38 -0
  59. package/dist/types/index.d.ts +63 -0
  60. package/dist/types/services/assets.d.ts +7 -0
  61. package/dist/types/services/collections.d.ts +18 -0
  62. package/dist/types/services/comments.d.ts +27 -0
  63. package/dist/types/services/index.d.ts +5 -0
  64. package/dist/types/services/profiles.d.ts +5 -0
  65. package/dist/types/services/zones.d.ts +10 -0
  66. package/package.json +65 -0
@@ -0,0 +1,38 @@
1
+ export declare function checkValidAddress(address: string | null): boolean;
2
+ export declare function formatAddress(address: string | null, wrap: boolean): string;
3
+ export declare function getTagValue(list: {
4
+ [key: string]: any;
5
+ }[], name: string): string | null;
6
+ export declare function formatCount(count: string): string;
7
+ export declare function formatPercentage(percentage: any): string;
8
+ export declare function formatDate(dateArg: string | number | null, dateType: 'iso' | 'epoch', fullTime?: boolean): string | null;
9
+ export declare function getRelativeDate(timestamp: number): string;
10
+ export declare function formatRequiredField(field: string): string;
11
+ export declare function splitTagValue(tag: any): any;
12
+ export declare function getTagDisplay(value: string): string;
13
+ export declare function getDataURLContentType(dataURL: string): string | null;
14
+ export declare function getBase64Data(dataURL: string): string;
15
+ export declare function getByteSize(input: string | Buffer): number;
16
+ export declare function getTotalTokenBalance(tokenBalances: {
17
+ profileBalance: number;
18
+ walletBalance: number;
19
+ } | null): number | null;
20
+ export declare function isFirefox(): boolean;
21
+ export declare function reverseDenomination(number: number): number;
22
+ export declare function cleanProcessField(value: string): string;
23
+ export declare function cleanTagValue(value: string): string;
24
+ /**
25
+ * Extracts all values from a key-value store that match a given prefix
26
+ * @param store The key-value store object to search
27
+ * @param prefix The prefix to filter keys by (e.g., 'portal')
28
+ * @returns Array of values whose keys match the prefix
29
+ */
30
+ export declare function getStoreNamespace<T = any>(prefix: string, store: Record<string, T>): T[];
31
+ export declare function buildStoreNamespace(prefix: string, value: string): string;
32
+ export declare const globalLog: (...args: any[]) => void;
33
+ export declare function mapToProcessCase(obj: any): any;
34
+ export declare function mapFromProcessCase(obj: any): any;
35
+ export declare function getBootTag(key: string, value: string): {
36
+ name: string;
37
+ value: string;
38
+ };
@@ -0,0 +1,63 @@
1
+ import * as Helpers from 'helpers';
2
+ import * as Common from './common';
3
+ import * as Services from './services';
4
+ declare function init(deps: Helpers.DependencyType): {
5
+ createAtomicAsset: (args: Helpers.AssetCreateArgsType, callback?: (status: any) => void) => Promise<string>;
6
+ getAtomicAsset: (id: string) => Promise<Helpers.AssetDetailType | null>;
7
+ getAtomicAssets: typeof Services.getAtomicAssets;
8
+ createComment: (args: Helpers.CommentCreateArgType, callback?: (status: any) => void) => Promise<string>;
9
+ getComment: (id: string) => Promise<Helpers.CommentDetailType | null>;
10
+ getComments: (args: {
11
+ parentId?: string;
12
+ rootId?: string;
13
+ }) => Promise<{
14
+ content: string;
15
+ dataSource: string;
16
+ rootSource: string;
17
+ id: string;
18
+ owner: string | null;
19
+ creator: string | null;
20
+ name: string | null;
21
+ description: string | null;
22
+ type: string | null;
23
+ topics: string[] | null;
24
+ implementation: string | null;
25
+ contentType: string | null;
26
+ renderWith: string | null;
27
+ thumbnail: string | null;
28
+ udl: Helpers.UDLicenseType | null;
29
+ collectionId: string | null;
30
+ dateCreated: number | null;
31
+ blockHeight: number | null;
32
+ tags?: Helpers.TagType[];
33
+ }[]>;
34
+ createCollection: (args: {
35
+ title: string;
36
+ description: string;
37
+ creator: string;
38
+ banner: any;
39
+ thumbnail: any;
40
+ }, callback?: (status: any) => void) => Promise<string>;
41
+ updateCollectionAssets: (args: {
42
+ collectionId: string;
43
+ assetIds: string[];
44
+ creator: string;
45
+ updateType: "Add" | "Remove";
46
+ }) => Promise<string>;
47
+ getCollection: (collectionId: string) => Promise<Helpers.CollectionDetailType | null>;
48
+ getCollections: (args: {
49
+ creator?: string;
50
+ }) => Promise<Helpers.CollectionType[] | null>;
51
+ resolveTransaction: (data: any) => Promise<any>;
52
+ getGQLData: typeof Common.getGQLData;
53
+ createProcess: (args: Helpers.ProcessCreateType, statusCB?: (status: any) => void) => Promise<string>;
54
+ readProcess: (args: Helpers.MessageSendType) => Promise<any>;
55
+ sendMessage: (args: Helpers.MessageSendType) => Promise<string>;
56
+ mapFromProcessCase: typeof Helpers.mapFromProcessCase;
57
+ mapToProcessCase: typeof Helpers.mapToProcessCase;
58
+ };
59
+ declare const _default: {
60
+ init: typeof init;
61
+ };
62
+ export default _default;
63
+ export * from './helpers/types';
@@ -0,0 +1,7 @@
1
+ import { AoAssetType, AssetCreateArgsType, AssetDetailType, AssetHeaderType, DependencyType, GQLNodeResponseType } from 'helpers/types';
2
+ export declare function createAtomicAssetWith(deps: DependencyType): (args: AssetCreateArgsType, callback?: (status: any) => void) => Promise<string>;
3
+ export declare function getAtomicAsset(deps: DependencyType, id: string): Promise<AssetDetailType | null>;
4
+ export declare function getAtomicAssetWith(deps: DependencyType): (id: string) => Promise<AssetDetailType | null>;
5
+ export declare function getAoAtomicAssetWith(deps: DependencyType): (processId: string) => Promise<AoAssetType>;
6
+ export declare function getAtomicAssets(ids: string[]): Promise<AssetHeaderType[] | null>;
7
+ export declare function buildAsset(element: GQLNodeResponseType): AssetHeaderType;
@@ -0,0 +1,18 @@
1
+ import { CollectionDetailType, CollectionType, DependencyType } from 'helpers/types';
2
+ export declare function createCollectionWith(deps: DependencyType): (args: {
3
+ title: string;
4
+ description: string;
5
+ creator: string;
6
+ banner: any;
7
+ thumbnail: any;
8
+ }, callback?: (status: any) => void) => Promise<string>;
9
+ export declare function updateCollectionAssetsWith(deps: DependencyType): (args: {
10
+ collectionId: string;
11
+ assetIds: string[];
12
+ creator: string;
13
+ updateType: "Add" | "Remove";
14
+ }) => Promise<string>;
15
+ export declare function getCollectionWith(deps: DependencyType): (collectionId: string) => Promise<CollectionDetailType | null>;
16
+ export declare function getCollectionsWith(deps: DependencyType): (args: {
17
+ creator?: string;
18
+ }) => Promise<CollectionType[] | null>;
@@ -0,0 +1,27 @@
1
+ import { CommentCreateArgType, CommentDetailType, DependencyType, TagType } from 'helpers/types';
2
+ export declare function createCommentWith(deps: DependencyType): (args: CommentCreateArgType, callback?: (status: any) => void) => Promise<string>;
3
+ export declare function getCommentWith(deps: DependencyType): (id: string) => Promise<CommentDetailType | null>;
4
+ export declare function getCommentsWith(_deps: DependencyType): (args: {
5
+ parentId?: string;
6
+ rootId?: string;
7
+ }) => Promise<{
8
+ content: string;
9
+ dataSource: string;
10
+ rootSource: string;
11
+ id: string;
12
+ owner: string | null;
13
+ creator: string | null;
14
+ name: string | null;
15
+ description: string | null;
16
+ type: string | null;
17
+ topics: string[] | null;
18
+ implementation: string | null;
19
+ contentType: string | null;
20
+ renderWith: string | null;
21
+ thumbnail: string | null;
22
+ udl: import("helpers/types").UDLicenseType | null;
23
+ collectionId: string | null;
24
+ dateCreated: number | null;
25
+ blockHeight: number | null;
26
+ tags?: TagType[];
27
+ }[]>;
@@ -0,0 +1,5 @@
1
+ export * from './assets';
2
+ export * from './collections';
3
+ export * from './comments';
4
+ export * from './profiles';
5
+ export * from './zones';
@@ -0,0 +1,5 @@
1
+ import { DependencyType, ProfileArgsType, ProfileType } from 'helpers/types';
2
+ export declare function createProfileWith(deps: DependencyType): (args: ProfileArgsType, callback?: (status: any) => void) => Promise<string | null>;
3
+ export declare function updateProfileWith(deps: DependencyType): (args: ProfileArgsType, profileId: string, callback?: (status: any) => void) => Promise<string | null>;
4
+ export declare function getProfileByIdWith(deps: DependencyType): (profileId: string) => Promise<ProfileType | null>;
5
+ export declare function getProfileByWalletAddressWith(deps: DependencyType): (walletAddress: string) => Promise<(ProfileType & any) | null>;
@@ -0,0 +1,10 @@
1
+ import { DependencyType, TagType } from 'helpers/types';
2
+ export declare function createZoneWith(deps: DependencyType): (args: {
3
+ tags?: TagType[];
4
+ }, callback?: (status: any) => void) => Promise<string | null>;
5
+ export declare function updateZoneWith(deps: DependencyType): (args: object, zoneId: string) => Promise<string | null>;
6
+ export declare function addToZoneWith(deps: DependencyType): (args: {
7
+ path: string;
8
+ data: object;
9
+ }, zoneId: string) => Promise<string | null>;
10
+ export declare function getZoneWith(deps: DependencyType): (zoneId: string) => Promise<any | null>;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@permaweb/libs",
3
+ "version": "0.0.1-beta",
4
+ "type": "module",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "browser": "./dist/index.esm.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "typesVersions": {
10
+ "*": {
11
+ "browser": [
12
+ "./dist/types/index.d.ts"
13
+ ],
14
+ ".": [
15
+ "./dist/types/index.d.ts"
16
+ ]
17
+ }
18
+ },
19
+ "description": "",
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "keywords": [],
24
+ "author": "",
25
+ "license": "ISC",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/permaweb/permaweb-libs.git",
29
+ "directory": "sdk"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "import": "./dist/index.esm.js",
34
+ "require": "./dist/index.cjs",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "./browser": "./dist/index.esm.js",
38
+ "./node": "./dist/index.js"
39
+ },
40
+ "scripts": {
41
+ "format": "eslint --fix . && npx prettier --write .",
42
+ "build": "node build.js"
43
+ },
44
+ "dependencies": {
45
+ "arweave": "^1.15.5",
46
+ "buffer": "^6.0.3",
47
+ "process": "^0.11.10",
48
+ "tsc-alias": "^1.8.10"
49
+ },
50
+ "devDependencies": {
51
+ "@types/async-retry": "^1.4.9",
52
+ "@types/node": "^22.10.4",
53
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
54
+ "@typescript-eslint/parser": "^5.57.1",
55
+ "esbuild": "^0.24.2",
56
+ "esbuild-plugin-d.ts": "^1.3.1",
57
+ "eslint": "^8.35.0",
58
+ "eslint-plugin-import": "^2.27.5",
59
+ "eslint-plugin-simple-import-sort": "^10.0.0",
60
+ "ts-loader": "^9.5.1",
61
+ "typescript": "^5.7.2",
62
+ "webpack": "^5.97.1",
63
+ "webpack-cli": "^6.0.1"
64
+ }
65
+ }