@stacksjs/socials 0.75.539 → 0.75.541

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.
@@ -1,4 +1,14 @@
1
1
  import type { BlueskyCredentialOptions, InstagramCredentialOptions, LinkedInCredentialOptions, MastodonCredentialOptions, SocialCredentialPlatform, SocialCredentialsByPlatform, SocialIdentityOptions, ThreadsCredentialOptions, TwitterCredentialOptions } from '@stacksjs/types';
2
+ /**
3
+ * The environment segment for an identity name.
4
+ *
5
+ * `home-lang` becomes `HOMELANG`, so the variable is
6
+ * `SOCIALS_HOMELANG_BLUESKY_PASSWORD`. Anything that is not a letter or digit
7
+ * is dropped rather than replaced with `_`, because `HOME_LANG_BLUESKY_...`
8
+ * cannot be told apart from an identity actually called `home` on a platform
9
+ * called `lang`.
10
+ */
11
+ export declare function envSegment(identity: string): string;
2
12
  /** `SOCIALS_STACKS_BLUESKY_PASSWORD`, for the error messages and the docs. */
3
13
  export declare function envName(identity: string, platform: SocialCredentialPlatform, field: string): string;
4
14
  /**
@@ -73,54 +83,22 @@ export declare function resolveThreadsCredentials(identity?: string, env?: Recor
73
83
  * Exported so a test can hold them against the drivers rather than against
74
84
  * this file: these tables ARE the claim that a platform's credentials are
75
85
  * complete, and a claim nothing checks is a comment.
76
- * @defaultValue
77
- * ```ts
78
- * {
79
- * bluesky: ['identifier', 'password', 'service'],
80
- * twitter: ['clientId', 'clientSecret', 'accessToken', 'refreshToken'],
81
- * linkedin: ['accessToken', 'memberUrn', 'clientId', 'clientSecret', 'apiVersion'],
82
- * mastodon: ['accessToken', 'instanceUrl'],
83
- * instagram: ['accessToken', 'accountId', 'clientId', 'clientSecret'],
84
- * threads: ['accessToken', 'userId', 'clientId', 'clientSecret'],
85
- * } as const satisfies Record<SocialCredentialPlatform, readonly string[]>
86
- *
87
- * /**
88
- * * The fields a platform cannot act without.
89
- * *
90
- * * Taken from what each driver's `publish()` dereferences and throws over, not
91
- * * from what its API documents. LinkedIn, Mastodon, Instagram and Threads each
92
- * * need a second value besides the token - the member URN, the instance, the
93
- * * account id, the user id - because a token alone does not say where or as
94
- * * whom to post, and each driver refuses without it.
95
- * *
96
- * * `clientId` and `clientSecret` are NOT required for those four: they are for
97
- * * refreshing, and an identity with a live token posts without them. Requiring
98
- * * them would refuse a working configuration.
99
- * *\/
100
- * export const REQUIRED_SOCIAL_CREDENTIALS = {
101
- * bluesky: ['identifier', 'password'],
102
- * twitter: ['clientId', 'clientSecret', 'accessToken'],
103
- * linkedin: ['accessToken', 'memberUrn'],
104
- * mastodon: ['accessToken', 'instanceUrl'],
105
- * instagram: ['accessToken', 'accountId'],
106
- * threads: ['accessToken', 'userId']
107
- * }
108
- * ```
109
86
  */
110
- export declare const SOCIAL_CREDENTIAL_FIELDS: Record<SocialCredentialPlatform, readonly string[]>
111
-
87
+ export declare const SOCIAL_CREDENTIAL_FIELDS: Record<SocialCredentialPlatform, readonly string[]>;
112
88
  /**
113
- * The environment segment for an identity name.
89
+ * The fields a platform cannot act without.
114
90
  *
115
- * `home-lang` becomes `HOMELANG`, so the variable is
116
- * `SOCIALS_HOMELANG_BLUESKY_PASSWORD`. Anything that is not a letter or digit
117
- * is dropped rather than replaced with `_`, because `HOME_LANG_BLUESKY_...`
118
- * cannot be told apart from an identity actually called `home` on a platform
119
- * called `lang`.
91
+ * Taken from what each driver's `publish()` dereferences and throws over, not
92
+ * from what its API documents. LinkedIn, Mastodon, Instagram and Threads each
93
+ * need a second value besides the token - the member URN, the instance, the
94
+ * account id, the user id - because a token alone does not say where or as
95
+ * whom to post, and each driver refuses without it.
96
+ *
97
+ * `clientId` and `clientSecret` are NOT required for those four: they are for
98
+ * refreshing, and an identity with a live token posts without them. Requiring
99
+ * them would refuse a working configuration.
120
100
  */
121
- export function envSegment(identity: string): string {
122
- return identity.toUpperCase().replace(/[^A-Z0-9]/g, '')
123
- };
101
+ export declare const REQUIRED_SOCIAL_CREDENTIALS: Record<SocialCredentialPlatform, readonly string[]>;
124
102
  export declare interface SocialsShape {
125
103
  default?: string
126
104
  identities?: Record<string, SocialIdentityOptions>
package/dist/publish.d.ts CHANGED
@@ -75,25 +75,13 @@ export declare function publishAs(platform: SocialCredentialPlatform, post: Publ
75
75
  * so taking one from configuration would be a second source for a value the
76
76
  * network already answers.
77
77
  * - `twitter` never reads it. Posting is scoped by the token alone.
78
- * @defaultValue
79
- * ```ts
80
- * {
81
- * linkedin: 'memberUrn',
82
- * mastodon: 'instanceUrl',
83
- * instagram: 'accountId',
84
- * threads: 'userId'
85
- * }
86
- * ```
87
78
  */
88
- export declare const DRIVER_DID_FIELD: Record<SocialCredentialPlatform, string | null>
89
-
79
+ export declare const DRIVER_DID_FIELD: Record<SocialCredentialPlatform, string | null>;
90
80
  /** Driver constructor options that come from a credential rather than a default. */
91
- export interface SocialDriverOptions {
92
- /** Bluesky: a PDS other than `https://bsky.social`. */
81
+ export declare interface SocialDriverOptions {
93
82
  service?: string
94
- /** LinkedIn: the `LinkedIn-Version` this tenant is on. */
95
83
  apiVersion?: string
96
- };
84
+ }
97
85
  /** Everything needed to post as one identity on one platform. */
98
86
  export declare interface SocialPublishTarget {
99
87
  name: string
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/socials",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.539",
5
+ "version": "0.75.541",
6
6
  "description": "A simple and elegant social authentication package for Stacks.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -57,14 +57,14 @@
57
57
  "prepublishOnly": "bun run build"
58
58
  },
59
59
  "dependencies": {
60
- "@stacksjs/api": "0.75.539",
61
- "@stacksjs/composables": "0.75.539",
62
- "@stacksjs/config": "0.75.539",
63
- "@stacksjs/database": "0.75.539"
60
+ "@stacksjs/api": "0.75.541",
61
+ "@stacksjs/composables": "0.75.541",
62
+ "@stacksjs/config": "0.75.541",
63
+ "@stacksjs/database": "0.75.541"
64
64
  },
65
65
  "devDependencies": {
66
- "@stacksjs/error-handling": "0.75.539",
67
- "@stacksjs/router": "0.75.539",
66
+ "@stacksjs/error-handling": "0.75.541",
67
+ "@stacksjs/router": "0.75.541",
68
68
  "better-dx": "^0.2.24"
69
69
  }
70
70
  }