@xyd-js/sources 0.0.0-build

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 (97) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/ISSUES.md +10 -0
  3. package/LICENSE +21 -0
  4. package/README.md +3 -0
  5. package/TODO.md +9 -0
  6. package/__fixtures__/-1.typescript/package.json +5 -0
  7. package/__fixtures__/-1.typescript/src/index.ts +0 -0
  8. package/__fixtures__/-1.typescript/src/settings.ts +592 -0
  9. package/__fixtures__/-1.typescript/tsconfig.json +8 -0
  10. package/__fixtures__/-2.react.basic/1.flat-interface.output.json +114 -0
  11. package/__fixtures__/-2.react.basic/2.file-connect-interface.output.json +60 -0
  12. package/__fixtures__/-2.react.basic/2a.file-connect-interface-advanced.output.json +92 -0
  13. package/__fixtures__/-2.react.basic/3.props-as-variants.output.json +166 -0
  14. package/__fixtures__/-2.react.basic/4.outside-interface.output.json +60 -0
  15. package/__fixtures__/-2.react.basic/5.inline-props.output.json +60 -0
  16. package/__fixtures__/-2.react.basic/5.outside-inline-props.output.json +60 -0
  17. package/__fixtures__/-2.react.basic/5a.inline-props+outside.output.json +60 -0
  18. package/__fixtures__/-2.react.basic/5b.inline-props+interfaces.output.json +92 -0
  19. package/__fixtures__/-2.react.basic/package.json +4 -0
  20. package/__fixtures__/-2.react.basic/src/1.flat-interface.tsx +41 -0
  21. package/__fixtures__/-2.react.basic/src/2.file-connect-interface.tsx +28 -0
  22. package/__fixtures__/-2.react.basic/src/2a.file-connect-interace+advanced.tsx +54 -0
  23. package/__fixtures__/-2.react.basic/src/3.props-as-variants.tsx +67 -0
  24. package/__fixtures__/-2.react.basic/src/4.outside-interface.tsx +13 -0
  25. package/__fixtures__/-2.react.basic/src/4.outside-interface2.ts +15 -0
  26. package/__fixtures__/-2.react.basic/src/5.inline-props.tsx +19 -0
  27. package/__fixtures__/-2.react.basic/src/5a.inline-props+outside.tsx +19 -0
  28. package/__fixtures__/-2.react.basic/src/5b.inline-props+interfaces.tsx +62 -0
  29. package/__fixtures__/-2.react.basic/src/index.ts +0 -0
  30. package/__fixtures__/-2.react.basic/tsconfig.json +8 -0
  31. package/__tests__/sourcesToUniform.test.ts +167 -0
  32. package/__tests__/testResolvePropertySymbol.ts +838 -0
  33. package/__tests__/types.ts +12 -0
  34. package/__tests__/utils.ts +108 -0
  35. package/dist/index.cjs +2 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.cts +2 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/react.cjs +237 -0
  42. package/dist/react.cjs.map +1 -0
  43. package/dist/react.d.cts +6 -0
  44. package/dist/react.d.ts +6 -0
  45. package/dist/react.js +212 -0
  46. package/dist/react.js.map +1 -0
  47. package/dist/ts.cjs +1794 -0
  48. package/dist/ts.cjs.map +1 -0
  49. package/dist/ts.d.cts +14 -0
  50. package/dist/ts.d.ts +14 -0
  51. package/dist/ts.js +1760 -0
  52. package/dist/ts.js.map +1 -0
  53. package/package.json +41 -0
  54. package/packages/react/index.ts +1 -0
  55. package/packages/react/uniformToReactUniform.ts +275 -0
  56. package/packages/ts/SignatureText.ts +233 -0
  57. package/packages/ts/TypeDocTransformer.ts +1519 -0
  58. package/packages/ts/__fixtures__/packages/package-a/package.json +4 -0
  59. package/packages/ts/__fixtures__/packages/package-a/src/index.ts +56 -0
  60. package/packages/ts/__fixtures__/packages/package-a/tsconfig.json +23 -0
  61. package/packages/ts/__fixtures__/packages/package-b/package.json +7 -0
  62. package/packages/ts/__fixtures__/packages/package-b/src/billing.ts +193 -0
  63. package/packages/ts/__fixtures__/packages/package-b/src/index.ts +8 -0
  64. package/packages/ts/__fixtures__/packages/package-b/tsconfig.json +20 -0
  65. package/packages/ts/__fixtures__/packages2/package-a/package.json +4 -0
  66. package/packages/ts/__fixtures__/packages2/package-a/src/index.ts +496 -0
  67. package/packages/ts/__fixtures__/packages2/package-a/tsconfig.json +6 -0
  68. package/packages/ts/__fixtures__/packages3/package-a/package.json +4 -0
  69. package/packages/ts/__fixtures__/packages3/package-a/src/index.ts +488 -0
  70. package/packages/ts/__fixtures__/packages3/package-a/tsconfig.json +6 -0
  71. package/packages/ts/__fixtures__/packages3/project.json +171 -0
  72. package/packages/ts/__fixtures__/react/react-a/package.json +5 -0
  73. package/packages/ts/__fixtures__/react/react-a/src/TestAbc.tsx +90 -0
  74. package/packages/ts/__fixtures__/react/react-a/src/TestBasic.tsx +27 -0
  75. package/packages/ts/__fixtures__/react/react-a/src/TestNamedParameters.tsx +27 -0
  76. package/packages/ts/__fixtures__/react/react-a/src/TestNamedParameters2.tsx +26 -0
  77. package/packages/ts/__fixtures__/react/react-a/src/TestUnion.tsx +32 -0
  78. package/packages/ts/__fixtures__/react/react-a/src/index.ts +1 -0
  79. package/packages/ts/__fixtures__/react/react-a/tsconfig.json +8 -0
  80. package/packages/ts/__fixtures__/references-output-project.json +344 -0
  81. package/packages/ts/__fixtures__/references-output-react.json +68 -0
  82. package/packages/ts/__fixtures__/references-output.json +129 -0
  83. package/packages/ts/__tests__/sourcesToUniform.test.ts +106 -0
  84. package/packages/ts/context.ts +0 -0
  85. package/packages/ts/converterts/ts-class.ts +0 -0
  86. package/packages/ts/converterts/ts-enum.ts +0 -0
  87. package/packages/ts/converterts/ts-function.ts +0 -0
  88. package/packages/ts/converterts/ts-interface.ts +0 -0
  89. package/packages/ts/converterts/ts-type.ts +0 -0
  90. package/packages/ts/index.ts +129 -0
  91. package/packages/ts/ts-core.ts +0 -0
  92. package/packages/ts/uniformToMiniUniform.ts +486 -0
  93. package/src/index.ts +0 -0
  94. package/test-cmd/index.ts +62 -0
  95. package/tsconfig.json +38 -0
  96. package/tsup.config.ts +39 -0
  97. package/vitest.config.ts +34 -0
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "@xyd-sources-examples/package-a",
3
+ "main": "dist/index.js"
4
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Returns a hello world message.
3
+ */
4
+ export function helloWorld(): string {
5
+ return 'Hello world!';
6
+ }
7
+
8
+ /**
9
+ * Returns a personalized hello world message.
10
+ *
11
+ * @param name - Name of the person to greet.
12
+ * @param enthusiastic - If true, adds an exclamation point to the greeting.
13
+ * @returns A greeting message string.
14
+ */
15
+ export function helloWorldV2(name: string, enthusiastic: boolean = false): string {
16
+ return enthusiastic ? `Hello, ${name}!` : `Hello, ${name}`;
17
+ }
18
+
19
+ /**
20
+ * Returns a personalized hello world message.
21
+ * @param name - Name of the person to greet.
22
+ * @typeParam T - The type of the name.
23
+ * @returns A greeting message string.
24
+ */
25
+ export function helloWorldV3<T>(name: T): string {
26
+ return `Hello, ${name}!`
27
+ }
28
+
29
+ /**
30
+ * Returns a personalized hello world message.
31
+ */
32
+ export class ExampleClass {
33
+ /**
34
+ * Returns a hello world message.
35
+ */
36
+ helloWorld(): string {
37
+ return 'Hello world!';
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Converts a GraphQL schema file to references.
43
+ *
44
+ * @param schemaLocation - The location of the schema file.
45
+ *
46
+ * @returns references
47
+ */
48
+ export function gqlSchemaToReferences(
49
+ schemaLocation: string
50
+ ): Promise<[]> {
51
+ if (schemaLocation.endsWith(".graphql")) {
52
+ return Promise.resolve([])
53
+ }
54
+
55
+ return Promise.resolve([])
56
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "incremental": true,
14
+ "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
15
+ },
16
+ "include": [
17
+ "src/**/*.ts"
18
+ ],
19
+ "exclude": [
20
+ "node_modules",
21
+ "dist"
22
+ ]
23
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@xyd-sources-examples/package-b",
3
+ "files": [
4
+ "./dist"
5
+ ],
6
+ "main": "./dist/index.js"
7
+ }
@@ -0,0 +1,193 @@
1
+ /**
2
+ *
3
+ * Includes enums for payment methods and transaction statuses, interfaces for billing transactions and receipts,
4
+ * and services to process transactions, manage billing history, and generate receipts.
5
+ *
6
+ * This module ensures comprehensive handling of billing data and operations, facilitating integrations with various payment providers and internal systems. It serves as a foundation for the financial transaction processing system, providing traceability and accountability through structured data and services.
7
+ *
8
+ * @module
9
+ */
10
+
11
+ /**
12
+ * Enum representing different types of payment methods.
13
+ * These are used to specify the payment mechanism chosen by a customer.
14
+ */
15
+ export enum PaymentMethod {
16
+ /** Payment through credit card. */
17
+ CreditCard = "Credit Card",
18
+
19
+ /** Payment through PayPal. Ideal for users who prefer not to directly use their credit card details. */
20
+ PayPal = "PayPal",
21
+
22
+ /** Payment via direct bank transfer. Used typically for larger transactions or where credit cards and PayPal are not viable. */
23
+ BankTransfer = "Bank Transfer",
24
+ }
25
+
26
+ /**
27
+ * Enum representing different transaction statuses.
28
+ * These statuses indicate the current state of a billing transaction in the process pipeline.
29
+ */
30
+ export enum TransactionStatus {
31
+ /** Transaction has been initiated but not yet processed. */
32
+ Pending = "Pending",
33
+
34
+ /** Transaction has been successfully processed. */
35
+ Completed = "Completed",
36
+
37
+ /** Transaction failed due to an error or rejection. */
38
+ Failed = "Failed",
39
+ }
40
+
41
+ /**
42
+ * Interface representing a billing transaction.
43
+ * This structure encapsulates all key details of a financial transaction within the system.
44
+ */
45
+ export interface BillingTransaction {
46
+ /**
47
+ * Unique identifier for the transaction. This ID is used to track and reference the transaction
48
+ * throughout the billing process.
49
+ */
50
+ transactionId: string;
51
+
52
+ /**
53
+ * Identifier for the order associated with this transaction. Helps link the transaction to specific goods or services purchased.
54
+ */
55
+ orderId: string;
56
+
57
+ /**
58
+ * The total amount of money involved in the transaction. This is usually in the smallest unit of the currency,
59
+ * such as cents in USD.
60
+ */
61
+ amount: number;
62
+
63
+ /**
64
+ * The method of payment used for the transaction, as defined by the PaymentMethod enum.
65
+ * This indicates how the customer chose to pay (e.g., Credit Card, PayPal, Bank Transfer).
66
+ */
67
+ paymentMethod: PaymentMethod;
68
+
69
+ /**
70
+ * The current status of the transaction, categorized by the TransactionStatus enum. Indicates whether the
71
+ * transaction is pending, completed, or has failed.
72
+ */
73
+ status: TransactionStatus;
74
+ }
75
+
76
+ /**
77
+ * Interface representing a billing receipt.
78
+ * Provides a record of the transaction for both the customer and the business.
79
+ */
80
+ export interface BillingReceipt {
81
+ /**
82
+ * Unique identifier for the receipt. This ID is crucial for referencing and tracking the receipt
83
+ * in financial records and customer queries.
84
+ */
85
+ receiptId: string;
86
+
87
+ /**
88
+ * The transaction details associated with this receipt. Links the receipt to the actual transaction
89
+ * that took place.
90
+ */
91
+ transaction: BillingTransaction;
92
+
93
+ /**
94
+ * The timestamp (in UNIX epoch time) when the receipt was generated. Provides a precise record of when
95
+ * the transaction was finalized and acknowledged.
96
+ */
97
+ timestamp: number;
98
+ }
99
+
100
+ /**
101
+ * Service for managing billing transactions.
102
+ * Provides functionality to process and retrieve billing transactions.
103
+ * @class
104
+ */
105
+ export class BillingService {
106
+ /** Holds all processed transactions within the service. */
107
+ private transactions: BillingTransaction[] = [];
108
+
109
+ /**
110
+ * Processes a billing transaction by adding it to the list of transactions.
111
+ * This simulates the transaction execution and storage in a production environment.
112
+ * @param transaction - The billing transaction to be processed.
113
+ * @returns The processed billing transaction, now stored in the service.
114
+ */
115
+ processTransaction(transaction: BillingTransaction): BillingTransaction {
116
+ this.transactions.push(transaction);
117
+ return transaction;
118
+ }
119
+
120
+ /**
121
+ * Retrieves all the billing transactions that have been processed.
122
+ * Useful for audits and general transaction management.
123
+ * @returns An array of all billing transactions.
124
+ */
125
+ getAllTransactions(): BillingTransaction[] {
126
+ return this.transactions;
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Service for managing billing history.
132
+ * Provides functionality to store and retrieve the history of transactions.
133
+ * @class
134
+ */
135
+ export class BillingHistoryService {
136
+ /** Holds all transactions that have been added to the billing history. */
137
+ private history: BillingTransaction[] = [];
138
+
139
+ /**
140
+ * Adds a transaction to the billing history.
141
+ * This method is typically called after a transaction is completed to maintain a record.
142
+ * @param transaction - The billing transaction to be added to the history.
143
+ */
144
+ addTransactionToHistory(transaction: BillingTransaction): void {
145
+ this.history.push(transaction);
146
+ }
147
+
148
+ /**
149
+ * Retrieves the complete billing history, providing access to all transactions that have been recorded.
150
+ * This is useful for historical analysis and auditing purposes.
151
+ * @returns An array of all billing transactions in the history.
152
+ */
153
+ getBillingHistory(): BillingTransaction[] {
154
+ return this.history;
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Service for generating billing receipts.
160
+ * Provides functionality to generate and retrieve receipts for transactions.
161
+ * @class
162
+ */
163
+ export class BillingReceiptService {
164
+ /**
165
+ * Stores all receipts generated for transactions.
166
+ */
167
+ public receipts: BillingReceipt[] = [];
168
+
169
+ /**
170
+ * Generates a billing receipt for a transaction and stores it.
171
+ * Each receipt includes a unique ID and timestamp, essential for record-keeping and customer service.
172
+ * @param transaction - The billing transaction for which to generate a receipt.
173
+ * @returns The generated billing receipt.
174
+ */
175
+ generateReceipt(transaction: BillingTransaction): BillingReceipt {
176
+ const receipt: BillingReceipt = {
177
+ receiptId: `receipt_${Date.now()}`,
178
+ transaction,
179
+ timestamp: Date.now(),
180
+ };
181
+ this.receipts.push(receipt);
182
+ return receipt;
183
+ }
184
+
185
+ /**
186
+ * Retrieves all the billing receipts that have been generated.
187
+ * Useful for providing customers with copies of their receipts or for internal financial tracking.
188
+ * @returns An array of all billing receipts.
189
+ */
190
+ getAllReceipts(): BillingReceipt[] {
191
+ return this.receipts;
192
+ }
193
+ }
@@ -0,0 +1,8 @@
1
+ export * from "./billing"
2
+
3
+ /**
4
+ * Returns a message builder message.
5
+ */
6
+ export function messageBuilder(): string {
7
+ return 'Hello world!';
8
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "outDir": "./dist",
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "incremental": true,
14
+ "tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
15
+ },
16
+ "include": [
17
+ "src/**/*.ts"
18
+ ],
19
+ "exclude": ["node_modules", "dist"]
20
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "@xyd-sources-examples/package-a",
3
+ "main": "dist/index.js"
4
+ }