@playdrop/playdrop-cli 0.3.4-build.1 → 0.3.5-build.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.
Files changed (141) hide show
  1. package/README.md +60 -23
  2. package/config/client-meta.json +5 -5
  3. package/dist/apps/upload.js +5 -3
  4. package/dist/assets/model-artifacts.js +1 -1
  5. package/dist/catalogue.d.ts +6 -0
  6. package/dist/catalogue.js +38 -1
  7. package/dist/commandContext.d.ts +1 -0
  8. package/dist/commandContext.js +45 -15
  9. package/dist/commands/browse.d.ts +16 -0
  10. package/dist/commands/browse.js +370 -0
  11. package/dist/commands/build.js +4 -9
  12. package/dist/commands/capture.js +24 -24
  13. package/dist/commands/captureRemote.d.ts +11 -0
  14. package/dist/commands/captureRemote.js +90 -0
  15. package/dist/commands/comments.d.ts +14 -0
  16. package/dist/commands/comments.js +189 -0
  17. package/dist/commands/create.js +112 -72
  18. package/dist/commands/creations.d.ts +49 -0
  19. package/dist/commands/creations.js +657 -0
  20. package/dist/commands/credits.d.ts +10 -0
  21. package/dist/commands/credits.js +91 -0
  22. package/dist/commands/detail.d.ts +2 -2
  23. package/dist/commands/detail.js +148 -290
  24. package/dist/commands/dev.js +24 -24
  25. package/dist/commands/devShared.js +2 -2
  26. package/dist/commands/documentation.d.ts +4 -1
  27. package/dist/commands/documentation.js +79 -104
  28. package/dist/commands/feedback.d.ts +12 -9
  29. package/dist/commands/feedback.js +125 -257
  30. package/dist/commands/format.js +6 -13
  31. package/dist/commands/generation.d.ts +11 -0
  32. package/dist/commands/generation.js +204 -42
  33. package/dist/commands/gettingStarted.d.ts +1 -0
  34. package/dist/commands/gettingStarted.js +26 -0
  35. package/dist/commands/init.js +26 -24
  36. package/dist/commands/login.js +9 -8
  37. package/dist/commands/logout.js +2 -1
  38. package/dist/commands/notifications.d.ts +14 -0
  39. package/dist/commands/notifications.js +179 -0
  40. package/dist/commands/search.d.ts +13 -0
  41. package/dist/commands/search.js +198 -0
  42. package/dist/commands/upload.js +20 -17
  43. package/dist/commands/validate.js +15 -1
  44. package/dist/commands/versionsBrowse.d.ts +7 -0
  45. package/dist/commands/versionsBrowse.js +209 -0
  46. package/dist/commands/whoami.js +9 -8
  47. package/dist/errors.d.ts +9 -0
  48. package/dist/errors.js +52 -0
  49. package/dist/externalAssetPackValidation.d.ts +2 -0
  50. package/dist/externalAssetPackValidation.js +115 -0
  51. package/dist/http.js +1 -1
  52. package/dist/index.js +570 -630
  53. package/dist/messages.js +11 -11
  54. package/dist/output.d.ts +5 -0
  55. package/dist/output.js +45 -0
  56. package/dist/playwright.js +1 -1
  57. package/dist/refs.d.ts +18 -0
  58. package/dist/refs.js +105 -0
  59. package/node_modules/@playdrop/ai-client/dist/index.d.ts +42 -15
  60. package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
  61. package/node_modules/@playdrop/ai-client/package.json +1 -0
  62. package/node_modules/@playdrop/api-client/dist/client.d.ts +39 -27
  63. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
  64. package/node_modules/@playdrop/api-client/dist/client.js +280 -1669
  65. package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +9 -0
  66. package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -0
  67. package/node_modules/@playdrop/api-client/dist/core/errors.js +46 -0
  68. package/node_modules/@playdrop/api-client/dist/core/request.d.ts +27 -0
  69. package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -0
  70. package/node_modules/@playdrop/api-client/dist/core/request.js +122 -0
  71. package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +75 -0
  72. package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -0
  73. package/node_modules/@playdrop/api-client/dist/domains/admin.js +282 -0
  74. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +22 -0
  75. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -0
  76. package/node_modules/@playdrop/api-client/dist/domains/ai.js +15 -0
  77. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +60 -0
  78. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -0
  79. package/node_modules/@playdrop/api-client/dist/domains/apps.js +301 -0
  80. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +59 -0
  81. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -0
  82. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +297 -0
  83. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +62 -0
  84. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -0
  85. package/node_modules/@playdrop/api-client/dist/domains/assets.js +297 -0
  86. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +28 -0
  87. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -0
  88. package/node_modules/@playdrop/api-client/dist/domains/auth.js +78 -0
  89. package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +29 -0
  90. package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -0
  91. package/node_modules/@playdrop/api-client/dist/domains/comments.js +65 -0
  92. package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +24 -0
  93. package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -0
  94. package/node_modules/@playdrop/api-client/dist/domains/me.js +35 -0
  95. package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +37 -0
  96. package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -0
  97. package/node_modules/@playdrop/api-client/dist/domains/payments.js +148 -0
  98. package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +27 -0
  99. package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -0
  100. package/node_modules/@playdrop/api-client/dist/domains/search.js +65 -0
  101. package/node_modules/@playdrop/api-client/dist/index.d.ts +33 -56
  102. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
  103. package/node_modules/@playdrop/api-client/dist/index.js +103 -44
  104. package/node_modules/@playdrop/api-client/package.json +3 -2
  105. package/node_modules/@playdrop/boxel-core/package.json +1 -1
  106. package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +1 -1
  107. package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +1 -1
  108. package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +1 -1
  109. package/node_modules/@playdrop/boxel-three/package.json +2 -1
  110. package/node_modules/@playdrop/config/client-meta.json +5 -5
  111. package/node_modules/@playdrop/config/dist/src/constants.d.ts +5 -0
  112. package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
  113. package/node_modules/@playdrop/config/dist/src/constants.js +5 -1
  114. package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
  115. package/node_modules/@playdrop/config/package.json +1 -1
  116. package/node_modules/@playdrop/types/dist/api.d.ts +178 -17
  117. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
  118. package/node_modules/@playdrop/types/dist/api.js +30 -1
  119. package/node_modules/@playdrop/types/dist/app.d.ts +0 -14
  120. package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
  121. package/node_modules/@playdrop/types/dist/app.js +0 -10
  122. package/node_modules/@playdrop/types/dist/asset-pack.d.ts +11 -1
  123. package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
  124. package/node_modules/@playdrop/types/dist/asset.d.ts +65 -0
  125. package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
  126. package/node_modules/@playdrop/types/dist/realtime.d.ts +26 -26
  127. package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
  128. package/node_modules/@playdrop/types/dist/version.d.ts +5 -0
  129. package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
  130. package/package.json +2 -3
  131. package/bin/playdrop-cli +0 -2
  132. package/dist/commands/asset-packs.d.ts +0 -27
  133. package/dist/commands/asset-packs.js +0 -508
  134. package/dist/commands/assets.d.ts +0 -35
  135. package/dist/commands/assets.js +0 -668
  136. package/dist/commands/list.d.ts +0 -7
  137. package/dist/commands/list.js +0 -347
  138. package/dist/commands/migrateCatalogueV2.d.ts +0 -1
  139. package/dist/commands/migrateCatalogueV2.js +0 -142
  140. package/dist/commands/versions.d.ts +0 -17
  141. package/dist/commands/versions.js +0 -384
@@ -0,0 +1,28 @@
1
+ import type { CompleteGoogleSignupRequest, CompleteGoogleSignupResponse, GooglePendingSignupResponse, LoginRequest, LoginResponse, RegisterRequest, RegisterResponse, UnlinkGoogleResponse, UnlinkXResponse, UsernameAvailableResponse } from '@playdrop/types';
2
+ type ApiResponseLike<T> = {
3
+ status: number;
4
+ body: T;
5
+ headers: Headers;
6
+ };
7
+ type RequestExecutor = <T>(input: {
8
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
9
+ path: string;
10
+ body?: unknown;
11
+ headers?: Record<string, string>;
12
+ signal?: AbortSignal;
13
+ }) => Promise<ApiResponseLike<T>>;
14
+ type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
15
+ export declare function buildAuthApiClientMethods(input: {
16
+ request: RequestExecutor;
17
+ handleApiError: ErrorHandler;
18
+ }): {
19
+ login(loginRequest: LoginRequest): Promise<LoginResponse>;
20
+ register(registerRequest: RegisterRequest): Promise<RegisterResponse>;
21
+ unlinkX(): Promise<UnlinkXResponse>;
22
+ unlinkGoogle(): Promise<UnlinkGoogleResponse>;
23
+ fetchGooglePendingSignup(token: string): Promise<GooglePendingSignupResponse>;
24
+ checkUsernameAvailable(username: string): Promise<UsernameAvailableResponse>;
25
+ completeGoogleSignup(signupRequest: CompleteGoogleSignupRequest): Promise<CompleteGoogleSignupResponse>;
26
+ };
27
+ export {};
28
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/domains/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B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
3
+ return {
4
+ async login(loginRequest) {
5
+ const response = await request({
6
+ method: 'POST',
7
+ path: '/auth/login',
8
+ body: loginRequest,
9
+ });
10
+ if (response.status !== 200) {
11
+ handleApiError(response, 'login');
12
+ }
13
+ return response.body;
14
+ },
15
+ async register(registerRequest) {
16
+ const response = await request({
17
+ method: 'POST',
18
+ path: '/auth/register',
19
+ body: registerRequest,
20
+ });
21
+ if (response.status !== 201) {
22
+ handleApiError(response, 'register');
23
+ }
24
+ return response.body;
25
+ },
26
+ async unlinkX() {
27
+ const response = await request({
28
+ method: 'POST',
29
+ path: '/auth/x/unlink',
30
+ });
31
+ if (response.status !== 200) {
32
+ handleApiError(response, 'unlink_x');
33
+ }
34
+ return response.body;
35
+ },
36
+ async unlinkGoogle() {
37
+ const response = await request({
38
+ method: 'POST',
39
+ path: '/auth/google/unlink',
40
+ });
41
+ if (response.status !== 200) {
42
+ handleApiError(response, 'unlink_google');
43
+ }
44
+ return response.body;
45
+ },
46
+ async fetchGooglePendingSignup(token) {
47
+ const response = await request({
48
+ method: 'GET',
49
+ path: `/auth/google/pending/${encodeURIComponent(token)}`,
50
+ });
51
+ if (response.status !== 200) {
52
+ handleApiError(response, 'fetch_google_pending_signup');
53
+ }
54
+ return response.body;
55
+ },
56
+ async checkUsernameAvailable(username) {
57
+ const response = await request({
58
+ method: 'GET',
59
+ path: `/auth/username-available/${encodeURIComponent(username)}`,
60
+ });
61
+ if (response.status !== 200) {
62
+ handleApiError(response, 'check_username_available');
63
+ }
64
+ return response.body;
65
+ },
66
+ async completeGoogleSignup(signupRequest) {
67
+ const response = await request({
68
+ method: 'POST',
69
+ path: '/auth/google/complete-signup',
70
+ body: signupRequest,
71
+ });
72
+ if (response.status !== 201) {
73
+ handleApiError(response, 'complete_google_signup');
74
+ }
75
+ return response.body;
76
+ },
77
+ };
78
+ }
@@ -0,0 +1,29 @@
1
+ import type { ContentCommentsResponse, CreateContentCommentRequest, CreateContentCommentResponse, DeleteContentCommentResponse, LikedItemMutationResponse, SavedItemKind } from '@playdrop/types';
2
+ type ApiResponseLike<T> = {
3
+ status: number;
4
+ body: T;
5
+ headers: Headers;
6
+ };
7
+ type RequestExecutor = <T>(input: {
8
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
9
+ path: string;
10
+ body?: unknown;
11
+ headers?: Record<string, string>;
12
+ signal?: AbortSignal;
13
+ }) => Promise<ApiResponseLike<T>>;
14
+ type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
15
+ export declare function buildCommentsApiClientMethods(input: {
16
+ request: RequestExecutor;
17
+ handleApiError: ErrorHandler;
18
+ normalizeSavedItemKindInput: (kind: SavedItemKind) => SavedItemKind;
19
+ normalizeCreatorItemSlug: (value: string, field: 'creator' | 'name') => string;
20
+ normalizePositiveIntegerInput: (value: number, errorCode: string) => number;
21
+ }): {
22
+ fetchContentComments(kind: SavedItemKind, creatorUsername: string, itemName: string): Promise<ContentCommentsResponse>;
23
+ createContentComment(kind: SavedItemKind, creatorUsername: string, itemName: string, requestBody: CreateContentCommentRequest): Promise<CreateContentCommentResponse>;
24
+ likeContentComment(commentId: number): Promise<LikedItemMutationResponse>;
25
+ unlikeContentComment(commentId: number): Promise<LikedItemMutationResponse>;
26
+ deleteContentComment(commentId: number): Promise<DeleteContentCommentResponse>;
27
+ };
28
+ export {};
29
+ //# sourceMappingURL=comments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/domains/comments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,EACzB,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,KAAK,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,KAAK,KAAK,CAAC;AAE1F,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,OAAO,EAAE,eAAe,CAAC;IACzB,cAAc,EAAE,YAAY,CAAC;IAC7B,2BAA2B,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,aAAa,CAAC;IACpE,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,KAAK,MAAM,CAAC;IAC/E,6BAA6B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7E;+BAUoC,aAAa,mBAAmB,MAAM,YAAY,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;+BAepH,aAAa,mBACF,MAAM,YACb,MAAM,eACH,2BAA2B,GACvC,OAAO,CAAC,4BAA4B,CAAC;kCAeJ,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;oCAYzC,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;oCAY3C,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC;EAYvF"}
@@ -0,0 +1,65 @@
1
+ export function buildCommentsApiClientMethods(input) {
2
+ const { request, handleApiError, normalizeSavedItemKindInput, normalizeCreatorItemSlug, normalizePositiveIntegerInput, } = input;
3
+ return {
4
+ async fetchContentComments(kind, creatorUsername, itemName) {
5
+ const normalizedKind = normalizeSavedItemKindInput(kind);
6
+ const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
7
+ const name = normalizeCreatorItemSlug(itemName, 'name');
8
+ const response = await request({
9
+ method: 'GET',
10
+ path: `/comments/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
11
+ });
12
+ if (response.status !== 200) {
13
+ handleApiError(response, 'fetch_content_comments');
14
+ }
15
+ return response.body;
16
+ },
17
+ async createContentComment(kind, creatorUsername, itemName, requestBody) {
18
+ const normalizedKind = normalizeSavedItemKindInput(kind);
19
+ const creator = normalizeCreatorItemSlug(creatorUsername, 'creator');
20
+ const name = normalizeCreatorItemSlug(itemName, 'name');
21
+ const response = await request({
22
+ method: 'POST',
23
+ path: `/me/comments/${encodeURIComponent(normalizedKind)}/${encodeURIComponent(creator)}/${encodeURIComponent(name)}`,
24
+ body: requestBody,
25
+ });
26
+ if (response.status !== 200) {
27
+ handleApiError(response, 'create_content_comment');
28
+ }
29
+ return response.body;
30
+ },
31
+ async likeContentComment(commentId) {
32
+ const normalizedCommentId = normalizePositiveIntegerInput(commentId, 'invalid_comment_id');
33
+ const response = await request({
34
+ method: 'PUT',
35
+ path: `/me/comments/${encodeURIComponent(String(normalizedCommentId))}/likes`,
36
+ });
37
+ if (response.status !== 200) {
38
+ handleApiError(response, 'like_content_comment');
39
+ }
40
+ return response.body;
41
+ },
42
+ async unlikeContentComment(commentId) {
43
+ const normalizedCommentId = normalizePositiveIntegerInput(commentId, 'invalid_comment_id');
44
+ const response = await request({
45
+ method: 'DELETE',
46
+ path: `/me/comments/${encodeURIComponent(String(normalizedCommentId))}/likes`,
47
+ });
48
+ if (response.status !== 200) {
49
+ handleApiError(response, 'unlike_content_comment');
50
+ }
51
+ return response.body;
52
+ },
53
+ async deleteContentComment(commentId) {
54
+ const normalizedCommentId = normalizePositiveIntegerInput(commentId, 'invalid_comment_id');
55
+ const response = await request({
56
+ method: 'DELETE',
57
+ path: `/me/comments/${encodeURIComponent(String(normalizedCommentId))}`,
58
+ });
59
+ if (response.status !== 200) {
60
+ handleApiError(response, 'delete_content_comment');
61
+ }
62
+ return response.body;
63
+ },
64
+ };
65
+ }
@@ -0,0 +1,24 @@
1
+ import type { BootstrapResponse, MyAppsResponse, TemplateScaffoldResponse } from '@playdrop/types';
2
+ type ApiResponseLike<T> = {
3
+ status: number;
4
+ body: T;
5
+ headers: Headers;
6
+ };
7
+ type RequestExecutor = <T>(input: {
8
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
9
+ path: string;
10
+ body?: unknown;
11
+ headers?: Record<string, string>;
12
+ signal?: AbortSignal;
13
+ }) => Promise<ApiResponseLike<T>>;
14
+ type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
15
+ export declare function buildMeApiClientMethods(input: {
16
+ request: RequestExecutor;
17
+ handleApiError: ErrorHandler;
18
+ }): {
19
+ fetchMyApps(): Promise<MyAppsResponse>;
20
+ fetchBootstrap(): Promise<BootstrapResponse>;
21
+ fetchTemplateScaffold(namespace: string, slug: string): Promise<TemplateScaffoldResponse>;
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=me.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/domains/me.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACzB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,KAAK,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,KAAK,KAAK,CAAC;AAE1F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,OAAO,EAAE,eAAe,CAAC;IACzB,cAAc,EAAE,YAAY,CAAC;CAC9B;mBAIwB,OAAO,CAAC,cAAc,CAAC;sBAWpB,OAAO,CAAC,iBAAiB,CAAC;qCAWX,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;EAWlG"}
@@ -0,0 +1,35 @@
1
+ export function buildMeApiClientMethods(input) {
2
+ const { request, handleApiError } = input;
3
+ return {
4
+ async fetchMyApps() {
5
+ const response = await request({
6
+ method: 'GET',
7
+ path: '/me/apps',
8
+ });
9
+ if (response.status !== 200) {
10
+ handleApiError(response, 'fetch_my_apps');
11
+ }
12
+ return response.body;
13
+ },
14
+ async fetchBootstrap() {
15
+ const response = await request({
16
+ method: 'GET',
17
+ path: '/me/bootstrap',
18
+ });
19
+ if (response.status !== 200) {
20
+ handleApiError(response, 'fetch_bootstrap');
21
+ }
22
+ return response.body;
23
+ },
24
+ async fetchTemplateScaffold(namespace, slug) {
25
+ const response = await request({
26
+ method: 'GET',
27
+ path: `/me/templates/${encodeURIComponent(namespace)}/${encodeURIComponent(slug)}`,
28
+ });
29
+ if (response.status !== 200) {
30
+ handleApiError(response, 'fetch_template_scaffold');
31
+ }
32
+ return response.body;
33
+ },
34
+ };
35
+ }
@@ -0,0 +1,37 @@
1
+ import type { AssetPurchaseRequest, CreditPackCheckoutSessionResponse, CreditPackCheckoutStatusResponse, IapPurchaseRequest, IapPurchaseResponse, IapReceiptListParams, IapReceiptResponse, IapReceiptsResponse, PurchaseResponse, ShopResponse, TransactionsResponse } from '@playdrop/types';
2
+ type ApiResponseLike<T> = {
3
+ status: number;
4
+ body: T;
5
+ headers: Headers;
6
+ };
7
+ type RequestExecutor = <T>(input: {
8
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
9
+ path: string;
10
+ body?: unknown;
11
+ headers?: Record<string, string>;
12
+ signal?: AbortSignal;
13
+ }) => Promise<ApiResponseLike<T>>;
14
+ type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
15
+ export declare function buildPaymentsApiClientMethods(input: {
16
+ request: RequestExecutor;
17
+ handleApiError: ErrorHandler;
18
+ buildIapQuery: (params?: IapReceiptListParams) => string | null;
19
+ }): {
20
+ fetchCreditShop(): Promise<ShopResponse>;
21
+ createCreditPackCheckoutSession(sku: string): Promise<CreditPackCheckoutSessionResponse>;
22
+ fetchCreditPackCheckoutStatus(sessionId: string): Promise<CreditPackCheckoutStatusResponse>;
23
+ purchaseAsset(body: AssetPurchaseRequest): Promise<PurchaseResponse>;
24
+ purchaseIap(body: IapPurchaseRequest): Promise<IapPurchaseResponse>;
25
+ fetchIapReceipts(params?: IapReceiptListParams): Promise<IapReceiptsResponse>;
26
+ cancelIapReceipt(receiptId: number): Promise<IapReceiptResponse>;
27
+ fetchAppIapReceipts(params?: Omit<IapReceiptListParams, "appId">): Promise<IapReceiptsResponse>;
28
+ consumeAppIapReceipt(receiptId: number): Promise<IapReceiptResponse>;
29
+ grantAppIapReceipt(receiptId: number): Promise<IapReceiptResponse>;
30
+ cancelAppIapReceipt(receiptId: number): Promise<IapReceiptResponse>;
31
+ fetchCreditTransactions(options?: {
32
+ limit?: number;
33
+ offset?: number;
34
+ }): Promise<TransactionsResponse>;
35
+ };
36
+ export {};
37
+ //# sourceMappingURL=payments.d.ts.map
@@ -0,0 +1 @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AAgB,CAAC;sBAYlD,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;8BAYzC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;gCAajD,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;iCAWnC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;oCAa/D,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;kCAWtC,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;mCAWnC,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;sCAWjC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC;EAoB9G"}
@@ -0,0 +1,148 @@
1
+ export function buildPaymentsApiClientMethods(input) {
2
+ const { request, handleApiError, buildIapQuery } = input;
3
+ return {
4
+ async fetchCreditShop() {
5
+ const response = await request({
6
+ method: 'GET',
7
+ path: '/shop',
8
+ });
9
+ if (response.status !== 200) {
10
+ handleApiError(response, 'fetch_shop');
11
+ }
12
+ return response.body;
13
+ },
14
+ async createCreditPackCheckoutSession(sku) {
15
+ const normalizedSku = sku.trim();
16
+ if (!normalizedSku) {
17
+ throw new Error('invalid_credit_pack_sku');
18
+ }
19
+ const response = await request({
20
+ method: 'POST',
21
+ path: `/shop/credit-packs/${encodeURIComponent(normalizedSku)}/checkout-session`,
22
+ });
23
+ if (response.status !== 200) {
24
+ handleApiError(response, 'create_credit_pack_checkout_session');
25
+ }
26
+ return response.body;
27
+ },
28
+ async fetchCreditPackCheckoutStatus(sessionId) {
29
+ const normalizedSessionId = sessionId.trim();
30
+ if (!normalizedSessionId) {
31
+ throw new Error('invalid_checkout_session_id');
32
+ }
33
+ const response = await request({
34
+ method: 'GET',
35
+ path: `/shop/credit-packs/checkout-session/${encodeURIComponent(normalizedSessionId)}`,
36
+ });
37
+ if (response.status !== 200) {
38
+ handleApiError(response, 'fetch_credit_pack_checkout_status');
39
+ }
40
+ return response.body;
41
+ },
42
+ async purchaseAsset(body) {
43
+ const response = await request({
44
+ method: 'POST',
45
+ path: '/purchase',
46
+ body,
47
+ });
48
+ if (response.status !== 200) {
49
+ handleApiError(response, 'purchase_asset');
50
+ }
51
+ return response.body;
52
+ },
53
+ async purchaseIap(body) {
54
+ const response = await request({
55
+ method: 'POST',
56
+ path: '/iap/purchase',
57
+ body,
58
+ });
59
+ if (response.status !== 200) {
60
+ handleApiError(response, 'purchase_iap');
61
+ }
62
+ return response.body;
63
+ },
64
+ async fetchIapReceipts(params) {
65
+ const query = buildIapQuery(params);
66
+ const path = query ? `/iap/receipts?${query}` : '/iap/receipts';
67
+ const response = await request({
68
+ method: 'GET',
69
+ path,
70
+ });
71
+ if (response.status !== 200) {
72
+ handleApiError(response, 'fetch_iap_receipts');
73
+ }
74
+ return response.body;
75
+ },
76
+ async cancelIapReceipt(receiptId) {
77
+ const response = await request({
78
+ method: 'POST',
79
+ path: `/iap/receipts/${encodeURIComponent(String(receiptId))}/cancel`,
80
+ });
81
+ if (response.status !== 200) {
82
+ handleApiError(response, 'cancel_iap_receipt');
83
+ }
84
+ return response.body;
85
+ },
86
+ async fetchAppIapReceipts(params) {
87
+ const query = buildIapQuery(params);
88
+ const path = query ? `/app/iap/receipts?${query}` : '/app/iap/receipts';
89
+ const response = await request({
90
+ method: 'GET',
91
+ path,
92
+ });
93
+ if (response.status !== 200) {
94
+ handleApiError(response, 'fetch_app_iap_receipts');
95
+ }
96
+ return response.body;
97
+ },
98
+ async consumeAppIapReceipt(receiptId) {
99
+ const response = await request({
100
+ method: 'POST',
101
+ path: `/app/iap/receipts/${encodeURIComponent(String(receiptId))}/consume`,
102
+ });
103
+ if (response.status !== 200) {
104
+ handleApiError(response, 'consume_app_iap_receipt');
105
+ }
106
+ return response.body;
107
+ },
108
+ async grantAppIapReceipt(receiptId) {
109
+ const response = await request({
110
+ method: 'POST',
111
+ path: `/app/iap/receipts/${encodeURIComponent(String(receiptId))}/grant`,
112
+ });
113
+ if (response.status !== 200) {
114
+ handleApiError(response, 'grant_app_iap_receipt');
115
+ }
116
+ return response.body;
117
+ },
118
+ async cancelAppIapReceipt(receiptId) {
119
+ const response = await request({
120
+ method: 'POST',
121
+ path: `/app/iap/receipts/${encodeURIComponent(String(receiptId))}/cancel`,
122
+ });
123
+ if (response.status !== 200) {
124
+ handleApiError(response, 'cancel_app_iap_receipt');
125
+ }
126
+ return response.body;
127
+ },
128
+ async fetchCreditTransactions(options) {
129
+ const params = new URLSearchParams();
130
+ if (options?.limit !== undefined) {
131
+ params.set('limit', String(options.limit));
132
+ }
133
+ if (options?.offset !== undefined) {
134
+ params.set('offset', String(options.offset));
135
+ }
136
+ const query = params.toString();
137
+ const path = query ? `/transactions?${query}` : '/transactions';
138
+ const response = await request({
139
+ method: 'GET',
140
+ path,
141
+ });
142
+ if (response.status !== 200) {
143
+ handleApiError(response, 'fetch_credit_transactions');
144
+ }
145
+ return response.body;
146
+ },
147
+ };
148
+ }
@@ -0,0 +1,27 @@
1
+ import type { SearchAssetType, SearchKind, SearchMode, SearchRequest, SearchResponse, SearchSuggestRequest, SearchSuggestResponse } from '@playdrop/types';
2
+ type ApiResponseLike<T> = {
3
+ status: number;
4
+ body: T;
5
+ headers: Headers;
6
+ };
7
+ type RequestExecutor = <T>(input: {
8
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
9
+ path: string;
10
+ body?: unknown;
11
+ headers?: Record<string, string>;
12
+ signal?: AbortSignal;
13
+ }) => Promise<ApiResponseLike<T>>;
14
+ type ErrorHandler = (response: ApiResponseLike<unknown>, defaultMessage: string) => never;
15
+ export declare function buildSearchApiClientMethods(input: {
16
+ request: RequestExecutor;
17
+ handleApiError: ErrorHandler;
18
+ normalizeSearchModeInput: (mode: SearchMode) => SearchMode;
19
+ normalizeSearchKindInput: (kind: SearchKind) => SearchKind;
20
+ normalizeSearchAssetTypeInput: (assetType: SearchAssetType) => SearchAssetType;
21
+ normalizePositiveIntegerInput: (value: number, errorCode: string) => number;
22
+ }): {
23
+ search(searchRequest: SearchRequest): Promise<SearchResponse>;
24
+ suggestSearch(searchRequest: SearchSuggestRequest): Promise<SearchSuggestResponse>;
25
+ };
26
+ export {};
27
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/domains/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,eAAe,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,KAAK,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,MAAM,KAAK,KAAK,CAAC;AAE1F,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,OAAO,EAAE,eAAe,CAAC;IACzB,cAAc,EAAE,YAAY,CAAC;IAC7B,wBAAwB,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;IAC3D,wBAAwB,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC;IAC3D,6BAA6B,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,eAAe,CAAC;IAC/E,6BAA6B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7E;0BAW+B,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;iCAmDhC,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;EAkB3F"}
@@ -0,0 +1,65 @@
1
+ export function buildSearchApiClientMethods(input) {
2
+ const { request, handleApiError, normalizeSearchModeInput, normalizeSearchKindInput, normalizeSearchAssetTypeInput, normalizePositiveIntegerInput, } = input;
3
+ return {
4
+ async search(searchRequest) {
5
+ const query = typeof searchRequest.q === 'string' ? searchRequest.q.trim() : '';
6
+ if (!query) {
7
+ throw new Error('invalid_search_query');
8
+ }
9
+ const params = new URLSearchParams();
10
+ params.set('q', query);
11
+ if (searchRequest.mode) {
12
+ params.set('mode', normalizeSearchModeInput(searchRequest.mode));
13
+ }
14
+ if (searchRequest.kind) {
15
+ params.set('kind', normalizeSearchKindInput(searchRequest.kind));
16
+ }
17
+ if (searchRequest.page !== undefined) {
18
+ params.set('page', String(normalizePositiveIntegerInput(searchRequest.page, 'invalid_search_page')));
19
+ }
20
+ if (searchRequest.pageSize !== undefined) {
21
+ params.set('pageSize', String(normalizePositiveIntegerInput(searchRequest.pageSize, 'invalid_search_page_size')));
22
+ }
23
+ if (searchRequest.appType) {
24
+ params.set('appType', searchRequest.appType);
25
+ }
26
+ if (searchRequest.assetType) {
27
+ params.set('assetType', normalizeSearchAssetTypeInput(searchRequest.assetType));
28
+ }
29
+ if (searchRequest.assetCategory) {
30
+ params.set('assetCategory', searchRequest.assetCategory);
31
+ }
32
+ if (typeof searchRequest.assetSubcategory === 'string' && searchRequest.assetSubcategory.trim().length > 0) {
33
+ params.set('assetSubcategory', searchRequest.assetSubcategory.trim());
34
+ }
35
+ if (searchRequest.packContainsCategory) {
36
+ params.set('packContainsCategory', searchRequest.packContainsCategory);
37
+ }
38
+ if (typeof searchRequest.packContainsSubcategory === 'string' && searchRequest.packContainsSubcategory.trim().length > 0) {
39
+ params.set('packContainsSubcategory', searchRequest.packContainsSubcategory.trim());
40
+ }
41
+ const response = await request({
42
+ method: 'GET',
43
+ path: `/search?${params.toString()}`,
44
+ });
45
+ if (response.status !== 200) {
46
+ handleApiError(response, 'search');
47
+ }
48
+ return response.body;
49
+ },
50
+ async suggestSearch(searchRequest) {
51
+ const query = typeof searchRequest.q === 'string' ? searchRequest.q.trim() : '';
52
+ if (!query) {
53
+ throw new Error('invalid_search_query');
54
+ }
55
+ const response = await request({
56
+ method: 'GET',
57
+ path: `/search/suggest?q=${encodeURIComponent(query)}`,
58
+ });
59
+ if (response.status !== 200) {
60
+ handleApiError(response, 'suggest_search');
61
+ }
62
+ return response.body;
63
+ },
64
+ };
65
+ }